Skip to content

Sidecar: gate agent identity parameters behind AllowOverrides#3871

Merged
iNinja merged 4 commits into
masterfrom
iinglese/sidecar-agent-override-gating
Jun 17, 2026
Merged

Sidecar: gate agent identity parameters behind AllowOverrides#3871
iNinja merged 4 commits into
masterfrom
iinglese/sidecar-agent-override-gating

Conversation

@iNinja

@iNinja iNinja commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Hardens the Entra Identity sidecar by ensuring agent identity query parameters (AgentIdentity, AgentUsername, AgentUserId) are only processed when the per-route AllowOverrides flag is enabled. Previously these parameters were applied unconditionally, bypassing the override gating that was already in place for other option overrides.

Changes

Security hardening (commit 1)

  • Moved AgentOverrides.SetOverrides() inside the if (allowOverrides) block in both AuthorizationHeaderEndpoint and DownstreamApiEndpoint.
  • Added 6 new tests in AgentOverrideGatingTests covering all four sidecar routes, verifying that agent identity parameters are ignored when AllowOverrides is false and applied when true.

Documentation (commit 2)

  • Updated WithDescription strings on all four endpoints to clarify that agent identity parameters are subject to the AllowOverrides setting.
  • Updated the sidecar README to document agent identity parameter behaviour under AllowOverrides.
  • Regenerated the OpenAPI spec.

Diagnostics (commit 3)

  • Added a warning log (AgentIdentityOverridesIgnored) that fires when agent identity parameters are provided on a route where AllowOverrides is disabled. The warning names the route and the configuration key to set, so operators can diagnose and remediate without guessing.

Testing

All 12 gating tests pass (6 existing SidecarOverrideGatingTests + 6 new AgentOverrideGatingTests).

iNinja and others added 2 commits June 17, 2026 15:13
…s flag

AgentIdentity, AgentUsername, and AgentUserId query parameters were applied
unconditionally on all sidecar endpoints, regardless of the per-route
AllowOverrides configuration. This meant that even on unauthenticated routes
where optionsOverride parameters were correctly ignored, agent identity
parameters were still honoured.

Move the AgentOverrides.SetOverrides() call inside the existing allowOverrides
check in both AuthorizationHeaderEndpoint and DownstreamApiEndpoint, so agent
identity parameters follow the same per-route gating as all other caller-
supplied overrides.

No change in behaviour for authenticated routes (AllowOverrides defaults to
true). Unauthenticated routes (AllowOverrides defaults to false) will now
correctly ignore agent identity parameters unless the operator explicitly
opts in.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…larity

- Updated WithDescription strings on all four sidecar endpoints to clarify
  that agent identity parameters are subject to AllowOverrides gating.
- Updated README to document agent identity parameter behavior under
  AllowOverrides and the runtime composition table.
- Regenerated OpenAPI spec to reflect description changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@iNinja iNinja requested a review from a team as a code owner June 17, 2026 14:20
When agent identity query parameters are provided on a route where
AllowOverrides is disabled, emit a warning log that names the route
and the configuration key needed to re-enable agent identity overrides.
This avoids silent behaviour changes for existing deployments.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@soodt

soodt commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

LGTM!

@iNinja iNinja merged commit 35b0de8 into master Jun 17, 2026
4 checks passed
@iNinja iNinja deleted the iinglese/sidecar-agent-override-gating branch June 17, 2026 16:32
This was referenced Jun 24, 2026
This was referenced Jun 24, 2026
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.

3 participants