← Back to Pull requests

feat: update libddwaf to v2.2.1 with large array and map support #241

Closed
unknown closed this pull request without merging on Nov 16, 2026 15:37 UTC
View on GitHub
unknown unknown commented on Nov 09, 2026 15:43 UTC
Author

Upgrade the embedded libddwaf from 2.0.1 to 2.2.1, the latest release. Since 2.1.0, libddwaf can build arrays and maps with more than 65,535 items ("large" containers, 0xA0 / 0xC0). go-libddwaf could neither read nor write them, so a result with such a container failed to decode, and a config with one was cut at 65,535 items without any error.

What changes

  • The embedded libraries and internal/log/ddwaf.h are the 2.2.1 release files (made with libddwaf-updater). 2.2.1 only restores support for glibc older than 2.16 in the Linux libraries (libddwaf#528); ddwaf.h is the same as in 2.2.0.

  • Decoding: new WAFLargeArrayType and WAFLargeMapType. IsArray, IsMap, ArrayValues, MapEntries, ArrayValue, MapValue and AnyValue accept both layouts. New Size() (uint32, error) returns the size of an array or a map in both layouts. ArraySize / MapSize keep their uint16 result (they are exported, and in v5.1.0): they return an error for a large container, and are now deprecated in favor of Size. SetArraySize / SetMapSize do nothing on a large container.

  • Encoding: SetArrayData / SetMapData and the Encoder builders write the large layout when the capacity is more than 65,535. The new limit is bindings.MaxLargeContainerSize (1<<28 - 1); above it, SetArrayData / SetMapData return an error. Objects with 65,535 items or fewer have the same bytes as before. The EncoderConfig limits (MaxContainerSize, MaxStringSize, MaxObjectDepth) and the default run limits (256 items, 4,096 bytes, depth 20) do not change.

  • Config rejection (libddwaf 2.2.0): a rejected config map is no longer kept in ConfigPaths, and a test now covers it.
  • Behavior change for users

    Configs and SetArrayData / SetMapData inputs with more than 65,535 items are no longer cut. For example, a remote-config list of blocked IP addresses is now loaded in full. Run data keeps its default limits. At 100,000 items, a config update takes about 5 ms, a handle build about 11 ms, and the process peak RSS is about 91 MB (the old cut saved about 1 ms, 1 ms and 7 MB of that).

    Linux library dependencies

    The Linux libraries now list libpthread.so.0, libdl.so.2 and libc.so.6 as NEEDED (none in 2.0.1). They still have no libm dependency and no symbol-version reference. TestVerifyHeader asserts the list.

    Validation not done by CI

  • Each embedded library has the same bytes as the file in the matching release asset, and the SHA-256 of each asset equals the digest shown by GitHub.

  • Load checks, each printing 2.2.1, on arm64 and amd64: a CGO_ENABLED=0 -tags appsec binary on gcr.io/distroless/base-debian12, and a CGO_ENABLED=1 binary built on golang:1.25-alpine and run on plain alpine:3.

  • dd-trace-go consumer check (temporary, not committed): a remote-config update with 70,000 blocked IPs blocks the first and the last IP (about 60 ms), and a rejected ASM_DD config restores the default ruleset.
  • Known limits, not caused by this PR

  • CGO_ENABLED=0 binaries need the glibc loader, so they do not start on plain Alpine. This is the same with 2.0.1.

  • A rules_data entry with an empty data list crashes libddwaf in ddwaf_builder_build_instance. This is the same with 2.0.1, and fixed upstream in libddwaf#530.
  • Diff: 428 lines (+321 / -107) across 5 files Reviewer: eliottness Review duration: 10073m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 428 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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
    Diff Size diff_size
    0.363
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #241"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    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: 45.1% (MEDIUM) · Higher = larger blast radius
    45.1%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 17.8% · Safe to merge
    17.8%