Release 1.162.2 - #3822
Conversation
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 35028761 | Triggered | Generic High Entropy Secret | 0b76b0b | ecommerce/fixtures.py | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
OpenAPI ChangesShow/hide changes |
| order_reference_number, | ||
| ) | ||
|
|
||
| order = Order.objects.filter(reference_number=order_reference_number).get() |
There was a problem hiding this comment.
Bug: The Stripe webhook handlers use .get() to find an Order without handling the DoesNotExist exception, which will crash the handler if no matching order is found.
Severity: HIGH
Suggested Fix
Wrap the Order.objects.filter(reference_number=order_reference_number).get() calls in a try...except Order.DoesNotExist block. Inside the except block, log an error that the order was not found but return a successful HTTP response to prevent Stripe from retrying an unprocessable event.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: ecommerce/api.py#L1347
Potential issue: The Stripe webhook handlers `process_stripe_checkout_completed` and
`process_stripe_checkout_expired` use `Order.objects.filter(...).get()` to retrieve an
order without handling the `Order.DoesNotExist` exception. This exception occurs if
Stripe sends a webhook event where the `client_reference_id` is `None` or does not
correspond to an existing order. An unhandled exception will crash the webhook handler,
preventing the event from being processed and potentially causing data inconsistencies
between the application and Stripe.
Also affects:
ecommerce/api.py:1311~1311
Did we get this right? 👍 / 👎 to inform future reviews.
Alex H
Dan Subak
James Kachel
Chris Chudzicki
annagav