CTM-553 - Make bearer token optional in postAccessURL endpoint#2113
Draft
snf2ye wants to merge 1 commit into
Draft
CTM-553 - Make bearer token optional in postAccessURL endpoint#2113snf2ye wants to merge 1 commit into
snf2ye wants to merge 1 commit into
Conversation
The Authorization header is only required for self-hosted snapshots accessed with an x-user-project header. Eagerly throwing when the header is absent blocked passport-auth users who don't need the token at all. Defer enforcement to the service layer, which already handles a null token correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
snf2ye
marked this pull request as ready for review
June 17, 2026 13:28
snf2ye
requested review from
calypsomatic and
davidangb
and removed request for
a team
June 17, 2026 13:28
snf2ye
marked this pull request as draft
June 17, 2026 13:30
calypsomatic
approved these changes
Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



https://broadworkbench.atlassian.net/browse/CTM-553
Summary
postAccessURL(POST /ga4gh/drs/v1/objects/{object_id}/access/{access_id}) previously calledbearerTokenFactory.from(request)unconditionally, throwingUnauthorizedExceptionif noAuthorizationheader was present.DrsService.signGoogleUrlwhen two conditions are both true: the snapshot is self-hosted AND anx-user-projectheader is provided. In all other cases (non-self-hosted snapshots, or self-hosted with no user project) the token is never accessed.Note on the non-self-hosted case
Even when
x-user-projectis provided, if the snapshot is not self-hosted the bearer token is still never used — the URL is signed using the snapshot's own Google project credentials. So even Option A (only requiring the token whenx-user-projectis present) would have been overly strict. By checking theAuthorizationheader and passingnullwhen absent, we let the natural enforcement point insignGoogleUrlfire only when it actually needs the token.Test plan
nulltoken when noAuthorizationheader is senttestPostAccessURLPassesNullTokenWhenNoAuthHeader— verifies requests without anAuthorizationheader succeed (token passed asnullto service)testPostAccessURLPassesTokenWhenAuthHeaderPresent— verifies the token is still extracted and forwarded when the header is presentDataRepositoryServiceApiControllerTesttests pass🤖 Generated with Claude Code