Skip to content

Use a common prefix for internal endpoints#4339

Merged
fafk merged 3 commits intomainfrom
move-internal-endpoint-under-prefix
Apr 16, 2026
Merged

Use a common prefix for internal endpoints#4339
fafk merged 3 commits intomainfrom
move-internal-endpoint-under-prefix

Conversation

@fafk
Copy link
Copy Markdown
Contributor

@fafk fafk commented Apr 16, 2026

Description

We now have a few endpoints that we don't want to expose to the public and every single one of them has a) a rule in WAF b) a rule on the infra level that exposes it to partners with an API key.

Instead of setting these every time we create a new internal endpoint we can use the same rules for all endpoints with the /api/internal prefix.

How to test

Existing e2e tests.

@fafk fafk requested a review from a team as a code owner April 16, 2026 09:04
@github-actions
Copy link
Copy Markdown

Reminder: Please consider backward compatibility when modifying the API specification.
If breaking changes are unavoidable, ensure:

  • You explicitly pointed out breaking changes.
  • You communicate the changes to affected teams (at least Frontend team and SAFE team).
  • You provide proper versioning and migration mechanisms.

Caused by:

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the debug and simulation API endpoints by prefixing them with /internal/, changing the path from /api/v1/debug/ to /api/internal/v1/debug/. These changes are consistently applied across the documentation, E2E tests, OpenAPI specification, and the API route handler. No critical issues found; I have no feedback to provide.

@squadgazzz
Copy link
Copy Markdown
Contributor

If a reverse proxy or load balancer has a rule "forward all /api/* to the backend", then /api/internal/* gets forwarded too, so internal endpoints are exposed unless there's an explicit deny rule higher up. With /internal/api/*, a blanket /api/* forward rule can't accidentally reach internal endpoints. Internal routes are in a completely separate namespace by default.

Copy link
Copy Markdown
Member

@AryanGodara AryanGodara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor note: the Prometheus metric labels emitted by the with_matched_path_metric (in api.rs1 but in L115, not in this diff) middleware will change (e.g. GET /api/v1/debug/order/{uid}GET /api/internal/v1/debug/order/{uid}), so any Grafana panels filtering on the old labels will need updating.
I"m not sure if we have a dashboard which depends on this, or if the endpoints in that are hardcoded. But maybe worth a check.

Comment thread crates/orderbook/src/api.rs Outdated
Copy link
Copy Markdown
Contributor

@MartinquaXD MartinquaXD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting restricted / permissioned endpoints under a common prefix makes sense to me.
internal feels like a poor name, though. I think restricted would be more fitting.

@fafk fafk added this pull request to the merge queue Apr 16, 2026
Merged via the queue into main with commit 63bcb85 Apr 16, 2026
20 checks passed
@fafk fafk deleted the move-internal-endpoint-under-prefix branch April 16, 2026 12:12
@github-actions github-actions bot locked and limited conversation to collaborators Apr 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants