Skip to content

Follow-ups from #615 review (combined CUJ demo redaction) #616

Backlog

Description

@caohy1988

Follow-ups from reviewing #615 at 8487062. None of these blocked the PR, but a few are worth fixing soon. Most important first:

  1. Second request cookie can survive scrubbing (looks important). When a request carries more than one Cookie field and the logged header joins them with a comma, only the first pair is masked; the cookie-pair continuation is only applied for Set-Cookie. The merge base masked the whole header. Realistic request logs hit this.

    _scrub_error_summary("Cookie: locale=en, sessionid=DemoSessionValue")
    # head: "Cookie: [REDACTED], sessionid=DemoSessionValue"

    A related variant: a diagnostic between cookie pairs (Cookie: sid=FirstCanary; CARD_EXPIRED; other=SecondCanary) ends cookie-context scanning, so SecondCanary stays visible. Keeping cookie context across the whole header value, while still preserving recognised diagnostics, should cover both.

  2. PEM private keys survive in line-oriented output (looks important). Once a decoded JSON container is marked scrubbed, it skips the PEM pattern, and in a stdout_lines-style array the BEGIN line, body and END line are separate strings, so nothing matches the whole envelope. The merge base removed the body.

    _scrub_error_summary(json.dumps({
        "stdout_lines": ["-----BEGIN PRIVATE KEY-----", "dGVzdHRlc3R0ZXN0", "-----END PRIVATE KEY-----"],
        "status": "CARD_EXPIRED"}))
    # head keeps the body line
  3. Large-payload fallback erases ordinary diagnostics. Past the 2,048 flat-decode budget or the 512 KiB byte budget, the fallback treats escaped quotes or a newline plus key=value text as unresolved nesting and replaces the value with a single [REDACTED]. It fails closed, so nothing leaks, but a big tool result or a long JSON-encoded log loses its error markers (for example a 9,000-line log loses its final ERROR: CARD_EXPIRED; 2,500 serialized records keep only 2,048 status markers). A bounded linear scan for single-layer text, keeping whole-value redaction for genuinely unresolved nesting, would fix it. The current budget tests only check secret absence and timing, so worth asserting diagnostic preservation too.

  4. Mock/offline runs now reject legal hyphenated table names. run_demo / run_demo_async validate identifiers before the mock branch, and the table check uses the dataset character set, so --offline with EVAL_TURNS_TABLE=eval-turns-2026 (or table_id="agent-events") now raises ValueError. BigQuery allows dashes (and spaces/Unicode) in table names. test_run_demo_mock_live_rejects_invalid_eval_turns_table currently pins bad-table as invalid and would need updating. The HTML drawer also strips spaces and Unicode from the displayed table name.

Smaller items:

  1. Duplicate or colliding JSON members. On a duplicate key or a post-redaction name collision the whole object goes back to the prose scanner; with an Authorization: Bearer ... string in it, the output can become invalid JSON or lose trailing members. Separately, two URL keys that scrub to the same text still collapse into one member in scrub_sensitive_text (pre-existing; scrub_sensitive_data already disambiguates).
  2. Collision suffix search is quadratic. Each collision restarts at #2; thousands of keys that scrub to the same name get slow (8,000 keys took about 3s). Tracking the next suffix per name fixes it.
  3. Two regression fixtures don't hit the intended branches. The padded-base64 fixture uses == padding and the depth fixtures wrap in a fresh object per step; the committed assertions pass on the merge base too. Adding single-= rows and direct repeated string encodings would make them real regressions.
  4. Folded Set-Cookie with an extension flag. A bare attribute outside the known list (e.g. Discard) ends the scan early, so a following cookie in a folded response stays visible.
  5. Null/boolean count policy differs between entry points. {"token_count": null} (and booleans) becomes a redaction marker through the text API but stays as-is through the data API. Worth picking one behaviour and testing both.
  6. Minor: a few new timing assertions still use a single elapsed sample with fixed ceilings; plenty of headroom today, but a median-of-three like the other helpers would be steadier on slow CI.

All values above are synthetic.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions