- Notifications
You must be signed in to change notification settings - Fork28
BB2-4250: Make v3_endpoints waffle switch app specific#1429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Conversation
…er waffle_flag. Working for read/search v3 calls, v3 auth/token flows (still need to add to some other auth views)
… flag is not enabled for that app
…s in the flag. Add 403 handling for userinfo v3
…Token and Authorization views
| returnjson_response_from_oauth2_error(error) | ||
| exceptPermissionDeniedase: | ||
| returnJsonResponse( | ||
| {'status_code':403,'message':str(e)}, |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
Stack trace information
Uh oh!
There was an error while loading.Please reload this page.
Show autofix suggestionHide autofix suggestion
Copilot Autofix
AI 4 days ago
To mitigate information exposure through exception messages, the best approach is to return a generic error message to the user, rather than the actual exception string. For logging and debugging, you can log the detailed exception message and stack trace on the server side. Specifically, inTokenView.post, the block handlingPermissionDenied exceptions (lines 484-488) should be modified: instead of returning the string representation ofe to the client (line 486), return a generic message such as "You do not have permission to perform this action." Meanwhile, log the exception (with stack trace) to the server log via e.g.log.exception. All changes should be made in theTokenView.post method inapps/dot_ext/views/authorization.py. No external libraries are necessary beyond those already imported.
| @@ -482,8 +482,9 @@ | ||
| except (InvalidClientError,InvalidGrantError,InvalidRequestError)aserror: | ||
| returnjson_response_from_oauth2_error(error) | ||
| exceptPermissionDeniedase: | ||
| log.exception("Permission denied during token endpoint processing.") | ||
| returnJsonResponse( | ||
| {'status_code':403,'message':str(e)}, | ||
| {'status_code':403,'message':'You do not have permission to perform this action.'}, | ||
| status=403, | ||
| ) | ||
JIRA Ticket:
BB2-4250
What Does This PR Do?
This PR ensures that once we enable the v3_endpoints waffle switch, we are able to control access to v3 endpoints on an app by app basis.
What Should Reviewers Watch For?
If you're reviewing this PR, please check for these things in particular:
Validation
UPDATE dot_ext_application SET user_id = {{user_id added in django admin to flag}} WHERE id = 1;UPDATE dot_ext_application SET user_id = {{any user_id besides the one added to the flag in django admin}} WHERE id = 1;What Security Implications Does This PR Have?
Please indicate if this PR does any of the following:
security engineer's approval.
Any Migrations?
We are not adding data to the database, but we will have to create a waffle flag as we roll this out. We will then add specific user_ids to that flag to enable v3 endpoint access.
etc)