fix(api): register Trustify endpoints under the domain-aware API root - #1
Open
carlosthe19916 wants to merge 1 commit into
Open
fix(api): register Trustify endpoints under the domain-aware API root#1carlosthe19916 wants to merge 1 commit into
carlosthe19916 wants to merge 1 commit into
Conversation
Hardcoded pulp/api/v3 paths 404 when DOMAIN_ENABLED or a custom API_ROOT is set, so scan tasks never inherit the request domain. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Problem statement
The plugin advertises domain support (
domain_compatible = True), so Pulp will start withDOMAIN_ENABLED=True. The Trustify REST endpoints do not follow pulpcore's domain URL layout.Pulpcore serves the platform API at
{API_ROOT}<domain>/api/v3/...when domains are enabled. Trustify registeredscan,advisories,gate-advisories, and the npm audit route as hardcodedpulp/api/v3/trustify/...paths. Those patterns do not include the domain slug, and they ignore a customAPI_ROOT(for example/api/pulp/).The result: clients call
/api/pulp/<domain>/api/v3/trustify/scan/and get 404. Even if a request matched,DomainMiddlewarewould not see apulp_domainslug, so scan tasks would run in the default domain instead of the repository's domain.Summary
scan,advisories,gate-advisories, npm audit) undersettings.API_ROOT, adding<slug:pulp_domain>whenDOMAIN_ENABLEDis on, matching pulpcore's API layout.Test plan
DOMAIN_ENABLED=TrueandAPI_ROOT=/api/pulp/,POST /api/pulp/<domain>/api/v3/trustify/scan/returns a task (not 404)GET .../trustify/advisories/andGET .../trustify/gate-advisories/resolve on the domain-scoped pathDOMAIN_ENABLED=False, the same endpoints still resolve at{API_ROOT}api/v3/trustify/...