-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add contract signing functionality #18
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| "status": record.status, | ||
| } | ||
|
|
||
| return JsonResponse(body, status=status) |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
Stack trace information
Stack trace information
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 9 days ago
The best fix is to avoid returning the direct message of WithdrawalError to the user. Instead, we should log the exception server-side (including the message and stack trace), and return a generic error message to the client, such as "Withdrawal request could not be processed.". This prevents any sensitive implementation or debugging details from leaking to a potential attacker.
Specifically:
- In the
except WithdrawalError as exc:block, replace the population ofbodyandstatuswith logging the exception and a more generic error response. - Add a logging call to record the exception (with stack trace) for internal troubleshooting.
- (Re-)use the logging instance
loggeralready present in the code. - Do not change the status code unless desired (can leave as 400 for client error).
All changes can be made in points/webhooks.py.
-
Copy modified line R59 -
Copy modified line R61
| @@ -56,8 +56,9 @@ | ||
| status = 404 | ||
| body = {"detail": "Signing record not found."} | ||
| except WithdrawalError as exc: | ||
| logger.exception("WithdrawalError processing FaDaDa webhook") | ||
| status = 400 | ||
| body = {"detail": str(exc)} | ||
| body = {"detail": "Withdrawal request could not be processed."} | ||
| except Exception: # pragma: no cover - defensive | ||
| logger.exception("Unhandled error processing FaDaDa webhook") | ||
| status = 500 |
|


Uh oh!
There was an error while loading. Please reload this page.