Skip to content

admin: reject non-canonical config array indices#7592

Open
Amemoyoi wants to merge 2 commits intocaddyserver:masterfrom
Amemoyoi:fix-admin-config-index-auth-bypass
Open

admin: reject non-canonical config array indices#7592
Amemoyoi wants to merge 2 commits intocaddyserver:masterfrom
Amemoyoi:fix-admin-config-index-auth-bypass

Conversation

@Amemoyoi
Copy link
Copy Markdown

@Amemoyoi Amemoyoi commented Mar 24, 2026

This rejects non-canonical numeric array indices in /config traversal.

Previously, array path components were parsed with strconv.Atoi, which meant paths like 01 were accepted and normalized to 1. That could cause the authorization layer to accept one textual path while config traversal resolved a
different array element.

This change introduces canonical index parsing so that only normalized decimal forms are accepted:

  • allowed: 0, 1, 10
  • rejected: 01, 002, +1, -0

Validation:

  • go test ./... -run TestUnsyncedConfigAccessRejectsNonCanonicalArrayIndices
  • go test ./... -run TestUnsyncedConfigAccess

I also ran go test ./..., but the run hit an unrelated integration timeout/failure in caddytest/integration (TestACMEServerWithDefaults).

Assistance disclosure:
I used an LLM to help review the code, reason about the behavior, and help draft the original report and parts of the patch/PR text. I manually reproduced the issue, validated the fix, and ran the relevant tests myself.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 24, 2026

CLA assistant check
All committers have signed the CLA.

@Amemoyoi
Copy link
Copy Markdown
Author

I checked the failing CI jobs. The failures appear unrelated to this change:

  • govulncheck is reporting existing findings in ACME/tracing-related code, not in admin.go
  • lint (mac) is reporting existing atomic modernize suggestions in modules/caddyhttp/reverseproxy/*

The targeted tests for this change are passing locally:

  • go test ./... -run TestUnsyncedConfigAccessRejectsNonCanonicalArrayIndices
  • go test ./... -run TestUnsyncedConfigAccess

@mholt
Copy link
Copy Markdown
Member

mholt commented Mar 24, 2026

Thanks. Can you please sign the CLA and restore the deleted assistance disclosure from the PR template?

@Amemoyoi
Copy link
Copy Markdown
Author

I’ve signed the CLA and restored the assistance disclosure in the PR description.

It shows “You have agreed to the CLA for caddyserver/caddy” on my side, so it looks like the signature is in place, but the CLA check may not have updated yet.

@mholt
Copy link
Copy Markdown
Member

mholt commented Mar 24, 2026

The CLA needs to be signed by the same email address as on the commits.

@Amemoyoi Amemoyoi force-pushed the fix-admin-config-index-auth-bypass branch from b6e2bda to 36a0e79 Compare March 25, 2026 03:58
@Amemoyoi
Copy link
Copy Markdown
Author

I checked it and found that the commit email was the issue. I’ve updated it to match the CLA-signed address and pushed the updated commit to the PR branch. Thanks.

Copy link
Copy Markdown
Member

@francislavoie francislavoie left a comment

Choose a reason for hiding this comment

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

LGTM, could use a couple more test cases to cover more of the allowed and rejected cases though (including +/- as described)

@francislavoie francislavoie added the bug 🐞 Something isn't working label Mar 25, 2026
@francislavoie francislavoie added this to the v2.11.3 milestone Mar 25, 2026
@Amemoyoi
Copy link
Copy Markdown
Author

Thanks. I added broader test coverage for both allowed and rejected forms, including the +/- cases, and pushed the update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🐞 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants