mirror of
https://github.com/AJaySi/ALwrity.git
synced 2026-04-25 08:55:58 +03:00
[PR #372] [MERGED] Harden user-scoped access in subscription dashboard/alerts/usage routes #678
Labels
No labels
AI Content Agents
AI Content Strategy
AI Content planning
AI Marketing Tools
AI SEO
AI personalization
AI writer
ALwrity Copi-lot
Alwrity web search
Anthropic
DeepSeek
Gemini AI
Integration
LLM
OnBoarding
OnBoarding
RAG knowledgebase Memory
bug
documentation
enhancement
good first issue
help wanted
invalid
openai
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ALwrity#678
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/AJaySi/ALwrity/pull/372
Author: @AJaySi
Created: 3/4/2026
Status: ✅ Merged
Merged: 3/5/2026
Merged by: @AJaySi
Base:
main← Head:codex/update-user-access-verification-for-routes📝 Commits (1)
261c224Harden user-scoped subscription route access checks📊 Changes
4 files changed (+108 additions, -7 deletions)
View changed files
📝
backend/api/subscription/routes/alerts.py(+15 -4)📝
backend/api/subscription/routes/dashboard.py(+6 -1)➕
backend/api/subscription/routes/route_access_audit.py(+82 -0)📝
backend/api/subscription/routes/usage.py(+5 -2)📄 Description
Motivation
Description
Depends(get_current_user)and a call toverify_user_access(user_id, current_user)toGET /dashboard/{user_id}inbackend/api/subscription/routes/dashboard.pyto enforce user-scoped access before queries.Depends(get_current_user)andverify_user_access(...)toGET /alerts/{user_id}inbackend/api/subscription/routes/alerts.pyso alert listings require authentication and authorization.POST /alerts/{alert_id}/mark-readinbackend/api/subscription/routes/alerts.pyto checkalert.user_idagainstcurrent_user.idand return403on ownership mismatch while preserving existingHTTPExceptionbehavior.Depends(get_current_user)andverify_user_access(...)toGET /usage/{user_id}/trendsinbackend/api/subscription/routes/usage.py(the main/usage/{user_id}route already verified access).backend/api/subscription/routes/route_access_audit.pythat scans route handlers for"{user_id}"in paths and flags handlers missingget_current_useror averify_user_accesscall.Testing
python backend/api/subscription/routes/route_access_audit.pyand it returnedPASS: all user-scoped routes include get_current_user and verify_user_access.python -m py_compile backend/api/subscription/routes/dashboard.py backend/api/subscription/routes/alerts.py backend/api/subscription/routes/usage.py backend/api/subscription/routes/route_access_audit.py, which completed without errors.Codex Task
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.