Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/+domain-aware-endpoints.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Trustify REST endpoints (`scan`, `advisories`, `gate-advisories`, npm audit) are now registered under the domain-aware API root, so they resolve at domain-scoped paths and scan tasks run within the target repository's domain.
15 changes: 11 additions & 4 deletions pulp_trustify/app/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""URL configuration for pulp_trustify plugin."""

from django.conf import settings
from django.urls import path

from pulp_trustify.app.viewsets import (
Expand All @@ -9,24 +10,30 @@
ScanViewSet,
)

if settings.DOMAIN_ENABLED:
API_ROOT = "/<slug:pulp_domain>/api/v3/"
else:
API_ROOT = "/api/v3/"
API_ROOT = settings.API_ROOT.strip("/") + API_ROOT

urlpatterns = [
path(
"pulp/api/v3/trustify/scan/",
API_ROOT + "trustify/scan/",
ScanViewSet.as_view({"post": "create"}),
name="scan",
),
path(
"pulp/api/v3/trustify/advisories/",
API_ROOT + "trustify/advisories/",
ScanAdvisoryViewSet.as_view({"get": "list"}),
name="advisories",
),
path(
"pulp/api/v3/trustify/gate-advisories/",
API_ROOT + "trustify/gate-advisories/",
GateAdvisoryViewSet.as_view({"get": "list"}),
name="gate-advisories",
),
path(
"pulp/api/v3/trustify/-/npm/v1/security/advisories/bulk",
API_ROOT + "trustify/-/npm/v1/security/advisories/bulk",
NpmBulkAdvisoryView.as_view(),
name="npm-audit-bulk",
),
Expand Down
Loading