FIX: Auth methods registered for base URLs being dropped for capability-declared sub-paths#758
Open
stvoutsin wants to merge 1 commit into
Open
FIX: Auth methods registered for base URLs being dropped for capability-declared sub-paths#758stvoutsin wants to merge 1 commit into
stvoutsin wants to merge 1 commit into
Conversation
…y-declared sub-paths
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #758 +/- ##
==========================================
+ Coverage 79.79% 79.88% +0.08%
==========================================
Files 91 91
Lines 10297 10311 +14
==========================================
+ Hits 8217 8237 +20
+ Misses 2080 2074 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
andamian
approved these changes
Jun 2, 2026
Contributor
andamian
left a comment
There was a problem hiding this comment.
This looks good to me and implements the solution discussed in the issue.
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.
Description
This PR is my attempt to address issue #749 where non-IVOA recognized authentication methods added by the users via
add_security_method_for_url(e.g. bearer tokens) are replaced by auth methods declared in the VOSI capabilities for more specific sub-paths (/tap/tables). Auth fails in this case as the client's custom credentials are no longer in the list of available methods.Cause
AuthURLsstored both caller registrations and capability-discovered methods in the samebase_urlsdict, then used longest-match to pick one entry.A capability entry for
/tap/tableswould win over the caller's /tap registration, discarding it entirely.Fix
The fix proposed here is to split the
base_urlsinto two collections:_explicit_urls: Caller registrations viaadd_security_method_for_url. Methods registered for a base URL apply to all URLs beneath it._capability_urls: Populated from VOSI capabilities, only the most-specific (longest) matching entry is usedTests
Added a few tests covering the various related use-cases
Fixes: #749