Skip to content

[security] Restrict plugin upload endpoint to admin role (#4149) - #4257

Open
Bhavya-Sonigra wants to merge 12 commits into
apache:masterfrom
Bhavya-Sonigra:restrict-plugin-admin-role
Open

[security] Restrict plugin upload endpoint to admin role (#4149)#4257
Bhavya-Sonigra wants to merge 12 commits into
apache:masterfrom
Bhavya-Sonigra:restrict-plugin-admin-role

Conversation

@Bhavya-Sonigra

Copy link
Copy Markdown

Fixes #4149

What's changed?

The /api/plugin endpoint had no role-based access control in sureness.yml, unlike every other API path in the file. Since plugin upload loads custom JAR code into the JVM via ServiceLoader, this meant any authenticated (or in some cases unauthenticated) user could manage plugins with the same access as an admin.

This PR adds explicit admin-only role mappings for /api/plugin/**, following the exact pattern used elsewhere in the file:

  • /api/plugin/**===get===[admin]
  • /api/plugin/**===post===[admin]
  • /api/plugin/**===put===[admin]
  • /api/plugin/**===delete===[admin]

Tested locally:

  • Request to /api/plugin with no auth token → 401 Unauthorized
  • Request to /api/plugin with an admin token → 200 OK with expected data

Checklist

  • I have read the Contributing Guide
  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

@Bhavya-Sonigra

Copy link
Copy Markdown
Author

Hi! Just following up on this PR. I've resolved the merge conflicts and updated the branch with the latest master. Whenever someone has time, I'd really appreciate a review. Thank you!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Restrict plugin upload endpoint to admin role

2 participants