Skip to content

[fix] Add missing permission annotations to /appAuth/updateSk and /sandbox/proxyGateway#6388

Open
Aias00 wants to merge 15 commits into
masterfrom
fix/auth-security-bypass
Open

[fix] Add missing permission annotations to /appAuth/updateSk and /sandbox/proxyGateway#6388
Aias00 wants to merge 15 commits into
masterfrom
fix/auth-security-bypass

Conversation

@Aias00

@Aias00 Aias00 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix authorization bypass vulnerabilities in two admin dashboard endpoints that allow low-privileged users to rotate arbitrary appAuth secrets and forge signed requests.

Vulnerability Details

1. /appAuth/updateSk — Missing permission annotation (High)

AppAuthController.updateSk() was the only endpoint in the controller without a @RequiresPermissions annotation. Every other endpoint (apply, findPageByQuery, detail, updateDetail, detailPath, updateDetailPath, batchDelete, batchEnabled, batchOpened, syncData) has proper permission checks.

This allowed any authenticated dashboard user (including lowest-privilege default role) to modify the appSecret of any application.

Additionally, the endpoint used @GetMapping, causing appSecret to appear in URLs, browser history, and server access logs.

2. /sandbox/proxyGateway — Missing permission annotation (Medium-High)

SandboxController.proxyGateway() had no @RequiresPermissions annotation. It accepts caller-controlled request data, looks up the server-side appSecret for a given appKey, generates a valid signature, and forwards the request to an allowlisted target.

3. Attack Chain

When combined:

  1. Low-privileged user rotates a target appKey's secret via /appAuth/updateSk
  2. Calls /sandbox/proxyGateway with the controlled appKey and attacker-chosen request data
  3. Server generates a valid signature using the attacker-controlled secret and forwards the request
  4. Result: impersonation of application identities, authenticated access to sign-protected APIs

Changes

  • AppAuthController.java: Add @RequiresPermissions("system:authen:edit") + change @GetMapping to @PostMapping
  • SandboxController.java: Add @RequiresPermissions("system:authen:list")
  • AppAuthControllerTest.java: Update testUpdateSk from GET to POST
  • http-debug-app-auth-controller-api.http: Update updateSk request from GET to POST

Testing

  • All 17 controller tests pass (AppAuthControllerTest: 16, SandboxControllerTest: 1)

Security Impact

  • Prevents low-privilege users from rotating arbitrary appAuth secrets
  • Prevents unauthorized use of the sandbox proxy gateway for signed request forgery
  • Breaks the attack chain described in the security report

Aias00 and others added 13 commits March 31, 2026 19:18
The merge brings in upstream workflow hardening while preserving this branch's existing mvnd-based build flow and k8s test changes. Conflicts were limited to Java setup action selection and the new integrated-test Docker image pre-pull step, so the resolution keeps the retrying local setup-java wrapper and retains the pre-pull retries.

Constraint: Merge was already in progress against origin/master at 86e544b

Rejected: Keep direct actions/setup-java@v4 | would drop upstream retry behavior for transient setup-java failures

Confidence: high

Scope-risk: moderate

Directive: Keep workflow Java setup calls on ./actions/setup-java-with-retry unless upstream removes the retry action

Tested: No conflict markers remain in conflicted workflows; Ruby YAML parse for the three edited workflows; git diff --check for the three edited workflows

Not-tested: Full GitHub Actions execution; full repository build/test suite
…ndbox/proxyGateway

- Add @RequiresPermissions("system:authen:edit") to AppAuthController.updateSk()
  This endpoint was the only one in the controller without a permission check,
  allowing any authenticated user to rotate arbitrary appAuth secrets.
- Change /appAuth/updateSk from GET to POST to prevent appSecret from
  appearing in URLs, browser history, and server access logs.
- Add @RequiresPermissions("system:authen:list") to SandboxController.proxyGateway()
  This endpoint generates server-side signed requests using stored appSecrets.
  Without permission checks, any authenticated user could abuse it to forge
  signed requests after compromising an appKey via the updateSk vulnerability.

These fixes address an authorization bypass where a low-privileged dashboard
user could chain updateSk + proxyGateway to impersonate arbitrary application
identities and send authenticated requests to allowlisted internal services.

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 16, 2026 09:16

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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR fixes authorization bypass vulnerabilities by adding missing permission checks to two admin endpoints and switching a sensitive secret-rotation endpoint from GET to POST.

Changes:

  • Added @RequiresPermissions to /appAuth/updateSk and /sandbox/proxyGateway.
  • Changed /appAuth/updateSk mapping from GET to POST and updated the related controller test.
  • Updated HTTP debug request docs and refreshed distribution LICENSE dependency listings.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/AppAuthController.java Secures updateSk with permissions and changes it to POST to reduce secret exposure risk.
shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/SandboxController.java Adds permission gating to proxyGateway to prevent unauthorized signed request forwarding.
shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/AppAuthControllerTest.java Updates testUpdateSk to POST to match controller change.
shenyu-admin/src/http/http-debug-app-auth-controller-api.http Updates the debug request to POST (but still includes secret in URL).
shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/LICENSE Updates third-party dependency license listings for the bootstrap distribution.
shenyu-dist/shenyu-admin-dist/src/main/release-docs/LICENSE Updates third-party dependency license listings for the admin distribution.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 64 to 67
POST http://localhost:9095/appAuth/updateSk?appKey=123&appSecret=123
Accept: application/json
Content-Type: application/json
X-Access-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNjQ4NjUwMDg2fQ.aDeChT_Ey6FwYDdzSkc9ZLBHd5v-LVUZ6BPcYqJCo-Y
jsonschema-generator 4.38.0: https://github.com/victools/jsonschema-generator, The Apache License, Version 2.0
jsonschema-module-jackson 4.38.0: https://github.com/victools/jsonschema-generator, The Apache License, Version 2.0
jsonschema-module-swagger-2 4.38.0: https://github.com/victools/jsonschema-generator, The Apache License, Version 2.0
re2j 1.8: https://github.com/google/re2j, Go License
Comment on lines +52 to +53
@PostMapping(path = "/proxyGateway")
@RequiresPermissions("system:authen:list")
…ermission, revert unrelated LICENSE changes

- Change /appAuth/updateSk to accept UpdateSkDTO as @RequestBody instead
  of @RequestParam, preventing appSecret from appearing in URLs, browser
  history, and server access logs (Copilot review comment #1)
- Change /sandbox/proxyGateway permission from system:authen:list to
  system:authen:modify — a write/signing endpoint should not be guarded
  by a read permission (Copilot review comment #3)
- Revert unrelated LICENSE file changes that were accidentally included
  (Copilot review comment #2 — re2j license issue is pre-existing)

Co-Authored-By: Claude <noreply@anthropic.com>
@Aias00

Aias00 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Addressed Copilot Review Comments

Comment #1 — appSecret still in URL query string ✅ Fixed

Changed /appAuth/updateSk to accept a new UpdateSkDTO as @RequestBody instead of @RequestParam. Both appKey and appSecret are now sent in the JSON request body, preventing leakage via URLs, browser history, and server access logs.

Comment #2 — LICENSE file re2j license ✅ Reverted

The LICENSE file changes were unrelated to this security fix and accidentally included from a dirty worktree. They have been reverted from this PR.

Comment #3 — system:authen:list is semantically mismatched ✅ Fixed

Changed the /sandbox/proxyGateway permission from system:authen:list to system:authen:modify. The proxy gateway is a write/signing operation, not a read/list operation, so modify is the semantically correct existing permission. Adding a brand-new system:sandbox:proxy permission would require a database migration across 5 database flavors, which is out of scope for this security fix.

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