Skip to content

Security/document apiserver authn risk - #9875

Open
Calvin S. (calvin197) wants to merge 3 commits into
mainfrom
security/document-apiserver-authn-risk
Open

Calvin S. (calvin197) wants to merge 3 commits into
mainfrom
security/document-apiserver-authn-risk

Conversation

@calvin197

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:
Documents a risk-accepted, by-design security decision for the AgentBaker apiserver sidecar. Addresses Mythos security findings (tracked under ADO 37518878):

• No application-layer authentication (ADO 37518903) and plaintext HTTP / no TLS (ADO 37518917) — apiserver/routers.go registers handlers with only timeout and panic-recovery middleware (no JWT/mTLS/API-key check), and apiserver/apiserver.go serves via ListenAndServe (not ListenAndServeTLS). These are the same underlying root cause, reported twice by different scanner passes.

This is not fixed in code because it's intentional: the apiserver is an internal-only sidecar invoked solely by the AKS RP control plane over the cluster-internal network, never exposed publicly. The enforced security boundary is network isolation (pod/cluster network policy) configured in the RP deployment — outside this repo, not app-layer auth. The handlers are stateless template generators that don't read tenant secrets. Adding real auth (mTLS/token-based) would require a cert/token issuance-and-rotation mechanism plus a coordinated change on the RP caller side (a different repo/system) — out of scope for a security-hardening pass.

This PR adds in-place code comments at NewRouter and ListenAndServe documenting the risk-acceptance rationale and a clear instruction that authentication middleware must be added if this router is ever exposed beyond the trusted RP-only network boundary. No functional/behavioral change. Validated with go build, go vet, and go test ./apiserver/... (all pass).

Which issue(s) this PR fixes:

Fixes #

ADO work items (msazure/CloudNativeCompute): 37518903, 37518917 (parent: 37518878)

Calvin S. (calvin197) and others added 3 commits October 16, 2026 16:54
The AgentBaker apiserver registers HTTP handlers with only timeout and
panic-recovery middleware - no JWT/mTLS/API-key check - and serves over
plaintext HTTP (ListenAndServe, not ListenAndServeTLS).

This is intentional and risk-accepted (By-Design), not an oversight:

  - Internal-only: this is a sidecar invoked solely by the AKS RP control
    plane over the cluster-internal network, never exposed publicly.
  - Boundary enforced elsewhere: the real security control is network
    isolation (pod/cluster network policy) configured in the RP deployment,
    outside this repo - not application-layer auth.
  - Low impact surface: handlers are stateless template generators that do
    not read tenant secrets from a backend store.
  - Real auth (mTLS/token-based) would require a cert/token issuance and
    rotation mechanism plus a coordinated change on the RP caller side (a
    different repo) - out of scope for a point fix here.

Adds explanatory comments at NewRouter (middleware chain) and
ListenAndServe (TLS) so the decision is discoverable in place and
revisited if this service's network exposure ever changes.

Addresses Mythos findings: ADO 37518917 (primary, CWE-306) and ADO 37518903
(duplicate of 37518917, CWE-306/CWE-319).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 350c2577-7031-4d0d-adc1-e99d053fc981
Copilot AI balanced review requested due to automatic review settings October 22, 2026 23:27
@calvin197
Calvin S. (calvin197) requested review from a team as code owners October 22, 2026 23:27
@github-actions

Copy link
Copy Markdown
Contributor

PR Title Lint Failed ❌

Current Title: Security/document apiserver authn risk

Your PR title doesn't follow the expected format. Please update your PR title to follow one of these patterns:

Conventional Commits Format:

  • feat: add new feature - for new features
  • fix: resolve bug in component - for bug fixes
  • docs: update README - for documentation changes
  • refactor: improve code structure - for refactoring
  • test: add unit tests - for test additions
  • chore: remove dead code - for maintenance tasks
  • chore(deps): update dependencies - for updating dependencies
  • ci: update build pipeline - for CI/CD changes

Guidelines:

  • Use lowercase for the type and description
  • Keep the description concise but descriptive
  • Use imperative mood (e.g., "add" not "adds" or "added")
  • Don't end with a period

Examples:

  • ✅ feat(windows): add secure TLS bootstrapping for Windows nodes
  • ✅ fix: resolve kubelet certificate rotation issue
  • ✅ docs: update installation guide
  • ❌ Added new feature
  • ❌ Fix bug.
  • ❌ Update docs

Please update your PR title and the lint check will run again automatically.

@github-actions

Copy link
Copy Markdown
Contributor

Windows Unit Test Results

  3 files   18 suites   52s ⏱️
563 tests 563 ✅ 0 💤 0 ❌
585 runs  585 ✅ 0 💤 0 ❌

Results for commit 085709f.

@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Health
test 0% ❌
windows 27% ❌
staging_cse_windows Package 1 65% ➖
debug 0% ❌
provisioningscripts 2% ❌
parts_windows Package 1 73% ➖
Summary 38% (1652 / 6834) ❌

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Deployment and security owners must confirm the external isolation, boundary TLS/authentication, and risk-acceptance claims.

No open issues 🎉

What changed in this PR

Documents the security risk-acceptance rationale for the AgentBaker apiserver sidecar’s lack of application-layer authentication and use of plaintext HTTP. Changes are comment-only; runtime behavior is unchanged.

Changes:

  • Explains reliance on externally configured RP network isolation.
  • Requires authentication middleware if the router is exposed beyond the trusted boundary.
  • Adds the stated boundary TLS/authentication rationale beside ListenAndServe.
File Description
apiserver/​routers.go Documents authentication rationale and requirements for broader exposure.
apiserver/​apiserver.go Documents intentional plaintext HTTP and stated external security controls.

Review effort: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Health
shellspec spec 28% ❌
Summary 28% (4591 / 16082) ❌

This branch has not been deployed

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

2 participants