Skip to content

Require permission for namespace plugin sync#6384

Open
Aias00 wants to merge 12 commits into
apache:masterfrom
Aias00:fix-plugin-sync-permission
Open

Require permission for namespace plugin sync#6384
Aias00 wants to merge 12 commits into
apache:masterfrom
Aias00:fix-plugin-sync-permission

Conversation

@Aias00

@Aias00 Aias00 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

This PR adds the missing system:plugin:modify permission check to the single namespace plugin sync endpoint.

The bulk plugin sync endpoint already requires system:plugin:modify; the single-plugin sync path can publish plugin data, including uploaded plugin JAR content, to connected gateway nodes and should enforce the same permission boundary.

Make sure that:

  • You have read the contribution guidelines.
  • You submit test cases (unit or integration tests) that back your changes.
  • Your local test passed ./mvnw clean install -Dmaven.javadoc.skip=true.

Tested:

  • ./mvnw -pl shenyu-admin -Dskip.checkstyle=true -DskipLicense=true -Dspotless.check.skip=true -Djacoco.skip=true -Dtest=NamespacePluginControllerTest test -q
  • ./mvnw -pl shenyu-admin -Dskip.checkstyle=true -DskipLicense=true -Dspotless.check.skip=true -Djacoco.skip=true -Dtest=NamespacePluginControllerTest,DataPermissionControllerTest,SelectorControllerTest test -q
  • ./mvnw -pl shenyu-admin -Dskip.checkstyle=true -DskipLicense=true -Dspotless.check.skip=true -Djacoco.skip=true test -q
  • ./mvnw -pl shenyu-admin -DskipTests -Djacoco.skip=true verify -q

Aias00 added 11 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
The namespace plugin sync endpoint can publish uploaded plugin JAR data to connected gateway nodes, so it needs the same plugin modify permission already required by the bulk sync path. This adds the missing method-level Shiro permission and locks the contract with a focused controller regression test.

Constraint: Existing Shiro method authorization depends on @RequiresPermissions annotations.

Rejected: Add a new permission name | existing syncPluginAll already uses system:plugin:modify for the same operation family.

Confidence: high

Scope-risk: narrow

Directive: Keep single-plugin and bulk plugin sync endpoints on equivalent plugin sync permissions.

Tested: ./mvnw -pl shenyu-admin -Dskip.checkstyle=true -DskipLicense=true -Dspotless.check.skip=true -Djacoco.skip=true -Dtest=NamespacePluginControllerTest test -q

Tested: ./mvnw -pl shenyu-admin -Dskip.checkstyle=true -DskipLicense=true -Dspotless.check.skip=true -Djacoco.skip=true -Dtest=NamespacePluginControllerTest,DataPermissionControllerTest,SelectorControllerTest test -q

Tested: ./mvnw -pl shenyu-admin -Dskip.checkstyle=true -DskipLicense=true -Dspotless.check.skip=true -Djacoco.skip=true test -q

Tested: ./mvnw -pl shenyu-admin -DskipTests -Djacoco.skip=true verify -q

Not-tested: End-to-end admin login and WebSocket sync against a running bootstrap.
Copilot AI review requested due to automatic review settings June 16, 2026 02:41

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

This PR closes an authorization gap in the shenyu-admin namespace plugin sync API by enforcing the same system:plugin:modify permission on the single-plugin sync endpoint as is already required for the bulk sync endpoint.

Changes:

  • Added @RequiresPermissions("system:plugin:modify") to NamespacePluginController#syncPluginData.
  • Added a unit test that asserts the permission annotation is present for syncPluginData.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/NamespacePluginController.java Enforces system:plugin:modify permission on the single namespace plugin sync endpoint.
shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/NamespacePluginControllerTest.java Adds a reflection-based test to prevent regressions in the permission requirement for syncPluginData.

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

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