Skip to content

PayloadMasker leaks values in five input shapes #320

Done

Description

@easyhooon

Summary

PayloadMasker (dari/src/main/kotlin/com/easyhooon/dari/masking/PayloadMasker.kt) leaves sensitive values visible in five input shapes. Found while adding edge-case tests in #318 / #319.

Problem

# Input Output today What leaks
1 [{"name":"Authorization","value":"xyz"}] unchanged Header value in name/value pair arrays (HAR-style headers)
2 Cookie: a=1; sid=2 Cookie: ***; sid=2 Every cookie pair after the first
3 password: my secret pass password: *** secret pass Rest of an unquoted multi-word value in plain text
4 {"비밀번호":"x","토큰":"y"} unchanged Non-English key names
5 {"X-Auth":"k","credential":"k","private_key":"k"} unchanged Keys outside SENSITIVE_KEY_PARTS / SENSITIVE_KEYS

Masking is opt-in and meant to keep credentials off shared screens and exports, so each of these defeats it for apps that use that shape.

Proposed Approach

Each fix trades leaks for false positives, so decide per case:

  1. Name/value pairs: when an object has a name/key field whose value is a sensitive key, mask its sibling value. Low false-positive risk.
  2. Cookie header: when the key is cookie / set-cookie, mask to end of line instead of the first ;.
  3. Unquoted plain text: mask to end of line for key: value lines. Risks hiding non-sensitive text on the same line.
  4. Non-English keys: add a small list (비밀번호, 토큰, 인증?) or leave to setPayloadRedactor on iOS / a future Android hook.
  5. More keys: candidates auth, credential, privatekey, signature. auth alone would also match author, so it needs an exact match like the short keys.

Add a failing test per accepted case to PayloadMaskerTest before changing the matcher.

Activity

  1. easyhooon commented on Nov 23, 2026

    @easyhooon
    OwnerAuthor

    Two more header shapes still leak after fixing #1 (name/value objects); only Bearer/Basic values are caught in them:

    • Tuple arrays, e.g. fetch Array.from(headers.entries()): [["authorization","x"],["x-api-key","k"]]
    • Flat name/value arrays, e.g. Node rawHeaders ["Authorization","x"] or OkHttp Headers serialized by Gson: {"namesAndValues":["Cookie","sid=1"]}

    Masking the element after a sensitive string in an array would cover both, at the cost of false positives in plain string lists.

  2. easyhooon commented on Dec 5, 2026

    @easyhooon
    OwnerAuthor

    Scope decision: dari inspects bridge payloads, which are app-defined JSON, not raw HTTP traffic.

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