Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test that auth token format must match #1400

Merged
merged 1 commit into from
May 23, 2023
Merged

Conversation

tgeoghegan
Copy link
Contributor

If some task accepts an AuthenticationToken::DapAuth, it should not be possible to present its value as an AuthenticationToken::Bearer and have it be accepted (or vice versa, should a Bearer token happen to also be a legal DAP-Auth-Token value). This was already the case because we evaluate tokens using AuthenticationToken::eq, but this commit adds a test to explicitly verify this.

While we're in here, improve a doccomment to explain that AuthenticationToken::DapAuth complies with the interop testing framework as well as the now-obsolete draft-ietf-ppm-dap-01, and add a constant for the collection job route to match the ones for aggregation jobs and aggregate shares.

Closes #1300

If some task accepts an `AuthenticationToken::DapAuth`, it should not be
possible to present its value as an `AuthenticationToken::Bearer` and
have it be accepted (or vice versa, should a Bearer token happen to also
be a legal `DAP-Auth-Token` value). This was already the case because we
evaluate tokens using `AuthenticationToken::eq`, but this commit adds a
test to explicitly verify this.

While we're in here, improve a doccomment to explain that
`AuthenticationToken::DapAuth` complies with the interop testing
framework as well as the now-obsolete `draft-ietf-ppm-dap-01`, and add a
constant for the collection job route to match the ones for aggregation
jobs and aggregate shares.

Closes #1300
@tgeoghegan tgeoghegan requested a review from a team as a code owner May 22, 2023 23:46
.map(|token| AuthenticationToken::Bearer(token.as_ref().to_vec()))
.unwrap();

for auth_token in [Some(wrong_token_value), Some(wrong_token_format), None] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@tgeoghegan tgeoghegan merged commit 583cfad into main May 23, 2023
@tgeoghegan tgeoghegan deleted the timg/enforce-token-type branch May 23, 2023 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enforce auth token type when checking authentication headers in requests
2 participants