fix(security): add RBAC auth to 11 unauthenticated GET endpoints#367
Merged
robotlearning123 merged 2 commits intomainfrom Mar 29, 2026
Merged
fix(security): add RBAC auth to 11 unauthenticated GET endpoints#367robotlearning123 merged 2 commits intomainfrom
robotlearning123 merged 2 commits intomainfrom
Conversation
8ef4ca0 to
8ad7733
Compare
8ad7733 to
09cb405
Compare
…points
11 GET endpoints across 3 route modules had zero authentication:
- documents: GET /, GET /stats, GET /{id}
- inventory: GET /, GET /low-stock, GET /expiring, GET /{id}, GET /{id}/history
- equipment: GET /, GET /{id}
Any unauthenticated user could read all documents (including OCR text
and vendor data), inventory state, and equipment records.
Added view_documents, view_inventory, view_equipment permissions
respectively. All are in _VIEW_PERMS so every authenticated role has them.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
09cb405 to
b5a4704
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
11 GET endpoints across 3 route modules had zero authentication. Any unauthenticated user could read:
Root Cause
router = APIRouter()had no router-level auth. POST/PATCH/DELETE had individualdependencies=[Depends(require_permission(...))], but GET endpoints were overlooked.Fix
Added
dependencies=[Depends(require_permission(...))]to all 11 endpoints:Documents (
view_documents):GET /(list)GET /statsGET /{id}Inventory (
view_inventory):GET /(list)GET /low-stockGET /expiringGET /{id}GET /{id}/historyEquipment (
view_equipment):GET /(list)GET /{id}All 3 permissions are in
_VIEW_PERMS— every authenticated role has access.Test
10 new tests in
test_read_endpoints_auth.pyverifying 401 on each endpoint when auth is enabled.🤖 Found and fixed by bug-hunter autonomous loop.