← Back to Pull requests

test(iast): validate cryptography.x509.base and unpin cryptography-latest #22393

Open
unknown opened this pull request with 199 lines diff across 2 files
View on GitHub
unknown unknown commented on Dec 04, 2026 10:57 UTC
Author

Description

Update PackageForTesting("cryptography", ...) in tests/appsec/iast_packages/test_packages.py to validate cryptography.x509.base instead of cryptography.fernet, and remove the temporary latest_version="50.0.2" pin (and latest_version workaround) introduced in #22388.

cryptography>=51.0.0 moved Fernet and MultiFernet into Rust (cryptography.hazmat.bindings._rust.fernet), shrinking cryptography/fernet.py from 240 lines of Python to a 15-line re-export stub. Because cryptography.fernet no longer contains AST-patchable Python constructs, astpatch_module returned None and test_packages_patched[cryptography] failed on latest with AssertionError: Module cryptography.fernet was not patched.

cryptography.x509.base remains pure Python in both the pinned (42.0.7) and latest (51.0.1) releases and is AST-patched cleanly on both, unlocking unpinned testing of cryptography>=51.

Customer impact

None. Test-only change.

Existing ddtrace instrumentation for cryptography (Cipher.encryptor weak-cipher sink and SCA x509/pkcs12 targets) remains pure Python in cryptography 51.0.1.

Testing

  • scripts/run-tests --venv 416f48c3e602 -- -k cryptography -vv (Python 3.12): passed (1 passed, 1 xfailed — both 42.0.7 and live 51.0.1 patched-import checks passed).

  • scripts/lint fmt -- tests/appsec/iast_packages/test_packages.py and scripts/lint checks: passed.
  • Risks

    Low. Test-only change scoped to cryptography in appsec_iast_packages.

    Additional Notes

    Replaces the temporary 50.0.2 pin from #22388.

    Diff: 199 lines (+149 / -50) across 2 files Reviewer: christophe-papazian Review duration: 1752m
    All Vouch review confidence checks passed
    Residual risk 0.32 = Change Risk (0.59) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.59 · 199 lines diff across 2 files
    0.59
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.317
    Sensitive Paths sensitive_paths
    0.059
    Real PR Conversation Timeline
    1 comments
    "Review active on #22393"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 59.3% (MEDIUM) · Higher = larger blast radius
    59.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 31.6% · Safe to merge
    31.6%