You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(iast): weak hash error if vulnerability is outside the context [backport 3.17] (#15038)
Backport 8940186 from #15029 to 3.17.
## Description
This PR addresses an issue where using weak hashing or cipher algorithms
outside of a request context (e.g., during application startup) could
raise an unhandled exception. The fix ensures proper error handling when
IAST operations are performed without an active request context.
### Root Cause
The issue occurred in the
[has_quota](cci:1://file:///home/alberto.vara/projects/dd-python/dd-trace-py/ddtrace/appsec/_iast/taint_sinks/_base.py:7:4-12:20)
method of the vulnerability base class, which was not properly handling
cases where there was no active request context. When IAST operations
were performed outside of a request (e.g., during application startup or
in unsupported frameworks), the code would attempt to access the
vulnerability budget from a non-existent context, leading to an
unhandled exception.
### Changes
1. Added null check for IAST context in
[has_quota](cci:1://file:///home/alberto.vara/projects/dd-python/dd-trace-py/ddtrace/appsec/_iast/taint_sinks/_base.py:7:4-12:20)
method to safely handle cases with no active request
2. Return `False` when no context is available, preventing further
processing of vulnerabilities
3. Added test cases to verify the fix works in various scenarios
4. Updated the release notes to document the fix
Co-authored-by: Alberto Vara <alberto.vara@datadoghq.com>
0 commit comments