Skip to content

fix(api): register Trustify endpoints under the domain-aware API root - #1

Open
carlosthe19916 wants to merge 1 commit into
pulp:mainfrom
carlosthe19916:fix/domain-aware-endpoints
Open

fix(api): register Trustify endpoints under the domain-aware API root#1
carlosthe19916 wants to merge 1 commit into
pulp:mainfrom
carlosthe19916:fix/domain-aware-endpoints

Conversation

@carlosthe19916

@carlosthe19916 carlosthe19916 commented Aug 17, 2026

Copy link
Copy Markdown

Problem statement

The plugin advertises domain support (domain_compatible = True), so Pulp will start with DOMAIN_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 registered scan, advisories, gate-advisories, and the npm audit route as hardcoded pulp/api/v3/trustify/... paths. Those patterns do not include the domain slug, and they ignore a custom API_ROOT (for example /api/pulp/).

The result: clients call /api/pulp/<domain>/api/v3/trustify/scan/ and get 404. Even if a request matched, DomainMiddleware would not see a pulp_domain slug, so scan tasks would run in the default domain instead of the repository's domain.

Summary

  • Register Trustify REST routes (scan, advisories, gate-advisories, npm audit) under settings.API_ROOT, adding <slug:pulp_domain> when DOMAIN_ENABLED is on, matching pulpcore's API layout.
  • Domain-scoped requests now resolve, and dispatched scan tasks inherit the request domain from the URL.

Test plan

  • With DOMAIN_ENABLED=True and API_ROOT=/api/pulp/, POST /api/pulp/<domain>/api/v3/trustify/scan/ returns a task (not 404)
  • The returned task href is under the same domain; the worker completes in that domain
  • GET .../trustify/advisories/ and GET .../trustify/gate-advisories/ resolve on the domain-scoped path
  • With DOMAIN_ENABLED=False, the same endpoints still resolve at {API_ROOT}api/v3/trustify/...

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>
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.

1 participant