Repository navigation
feat(plugins): add loopback proxy with scope enforcement and secret stripping - #1728
Open
developerkunal wants to merge 12 commits into
Open
developerkunal wants to merge 12 commits into
developerkunal wants to merge 12 commits into
Conversation
developerkunal
force-pushed
the
DXCDT-2606/loopback-proxy
branch
from
October 24, 2026 15:30
9ca63e8 to
172b55b
Compare
developerkunal
force-pushed
the
DXCDT-2606/loopback-proxy
branch
2 times, most recently
from
November 2, 2026 14:31
2063021 to
3460887
Compare
developerkunal
force-pushed
the
DXCDT-2606/loopback-proxy
branch
from
November 2, 2026 19:37
3460887 to
b892768
Compare
developerkunal
force-pushed
the
DXCDT-2606/loopback-proxy
branch
from
November 24, 2026 11:34
b892768 to
1b1d37e
Compare
developerkunal
force-pushed
the
DXCDT-2606/loopback-proxy
branch
from
November 24, 2026 12:03
1b1d37e to
b57cd8a
Compare
bkiran6398
force-pushed
the
DXCDT-2606/loopback-proxy
branch
from
November 27, 2026 06:23
b57cd8a to
d2fdcbd
Compare
developerkunal
force-pushed
the
DXCDT-2606/loopback-proxy
branch
from
November 30, 2026 17:24
d2fdcbd to
cbad0a2
Compare
…tripping - Adds internal/plugins/proxy, a per-run HTTPS proxy on 127.0.0.1 that a plugin calls with a per-run secret instead of the real token. - Denies by default: paths must be canonical and under /api/v2/, methods are allowlisted, and each call must match a rule in the scope table that one of the command's declared scopes satisfies. A denied call gets a 403 that names the missing scope. - Removes secret fields from every JSON response, rejects responses it cannot inspect, and drops request headers that are not on an allowlist. - Refreshes the token once for concurrent 401s, caps refreshes per run, bounds in-flight calls, and exposes a one-line summary of the calls it denied. - Types the scopeTable and secretFields index fields in the registry package with schema validation shared with the proxy.
A call counts as a scope problem only when the proxy denied it or Auth0 answered with the error code insufficient_scope. Every other 4xx answer is reported as refused by Auth0, with the route, status, error code and message, and with no advice about scopes. The plugin still receives the answer unchanged.
The signed index lists the secret fields in two groups. The names under anywhere are removed at any depth, as before. The paths are removed only where they match the full path from the root of the response, so a field that is secret in one place, such as a bind password, no longer removes a harmless field with the same name elsewhere, such as the password entry under authentication methods. The index format version is now 2. The parser refuses version 1 and any unknown version, and refuses names under anywhere that are too ambiguous to remove at every depth.
When the proxy removes members from a response it adds the header X-Auth0-CLI-Stripped with the sorted names of the removed members, so a plugin can tell a removed field from a missing one. The header never carries values, is never sent to Auth0, and a header of that name in an answer from Auth0 is dropped so it cannot be forged.
A 429 answer reaches the plugin with its status, Retry-After and rate limit headers and its body unchanged, and the proxy never retries it.
The proxy gave the token source a deadline but still waited for it to return, so a source that never returned held a proxy slot, and for a refresh the refresh lock, for as long as it hung. The proxy now stops waiting when the deadline passes and discards whatever the source returns late.
A rule in the signed scope table can list field scopes next to its normal scopes. A field scope such as read:connections_options allows the routes that list it and no others, so a plugin that declares it does not gain access to other routes. The registry also reports which scopes are only field scopes, so the consent screen can group them.
A path in secretFields may now use ..name to name a member at any depth below the current position, so a field that sits inside a recursive structure, such as the params of a nested flow action, is removed at every level. A path may have at most two descendant steps, may not start with one, and must name a member that is not ambiguous after the last one. The registry and the proxy share the same match vectors. The proxy keeps the match state of every path on the stack of the stripper, so the cost of a body grows with its size and not with how deeply it is nested.
Policy.KeepSecrets returns a copy of the policy that keeps the members at the given secret paths for one run, while the members below them and every other secret are still removed. The stripper tracks the kept paths with the same automaton, kept members are never listed in X-Auth0-CLI-Stripped, and the index checks every record secret path with the secret path grammar.
developerkunal
force-pushed
the
DXCDT-2606/loopback-proxy
branch
from
December 1, 2026 17:11
cbad0a2 to
7499266
Compare
The wall clock bound failed on slow CI runners. The step count already proves the work stays in proportion to the members.
This branch has not been deployed
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.
🔧 Changes
Adds
internal/plugins/proxy, which sits between a plugin process and the Auth0 Management API. A plugin never gets the real access token. It gets a random secret for the run and calls a local HTTPS proxy, which swaps in the real token on the calls it decides to forward. Nothing calls the proxy yet, so there is no user visible change.The proxy listens on
127.0.0.1on a random port with a certificate made for that run, and a plugin is pointed at it throughAUTH0_PLUGIN_DOMAINandAUTH0_PLUGIN_MANAGEMENT_TOKEN.Requests are denied by default
Hostheader must be the proxy address./api/v2/. Odd paths are rejected, never repaired, so the path that is checked is the path that is forwarded.Authorizationheader is dropped.Responses
session_expirederror.Fail closed. The proxy refuses to start if the registry index does not publish a scope table or a list of secret fields, because forwarding without either would be fail open.
Existing code. In
internal/plugins/registry,scopeTableandsecretFieldswere opaque raw JSON. They are now typed and validated. This is a deliberate change: an index with either field in any other shape is now rejected when parsed.📚 References
DXCDT-2606. Part of the plugin framework stack of 11 PRs, and it builds on the one below it (DXCDT-2603).
🔬 Testing
The new code is covered by unit tests.
📝 Checklist