Skip to content

fix: support console clipboard copy fallback and unredacted auth tokens by default - #41

Merged
maksudur03 merged 2 commits into
mainfrom
fix/console-copy-and-auth-token-access
Sep 6, 2026
Merged

maksudur03 merged 2 commits into
mainfrom
fix/console-copy-and-auth-token-access

Conversation

@nur-shuvo

Copy link
Copy Markdown
Collaborator

Summary

Fixes #40

This PR addresses two issues reported in #40:

  1. Clipboard copy in web console on plain HTTP / LAN: navigator.clipboard requires a secure context (window.isSecureContext — HTTPS or localhost). When accessing the DevConsole dashboard over LAN HTTP (e.g., http://192.168.x.x:8080), calling navigator.clipboard.writeText threw an error and toasted "Clipboard access was denied.".
  2. Authorization tokens unredacted / accessible by default: RedactionPolicy.buildDefault() included authorization, proxy-authorization, www-authenticate, and authentication in sensitiveFieldNames as well as a regex pattern for Bearer <token> in textPatterns. This caused Authorization headers and tokens to be masked with <redacted> by default, preventing developers from inspecting and copying authorization tokens during debugging.

Key Changes

  • Web Console (dashboard.js):
    • Implemented document.execCommand('copy') fallback in copyToClipboard() when navigator.clipboard or window.isSecureContext is unavailable.
    • Refactored copyStateJson() and copyTableCsv() to use copyToClipboard().
  • SDK Security (RedactionEngine.kt):
    • Excluded authorization headers and Bearer pattern from default redaction policy so authorization headers are visible and copyable by default.
    • Preserved redaction for passwords, secrets, cookies, API keys, session IDs, etc.
  • Documentation:
    • Updated docs/SECURITY_AND_REDACTION.md and docs/THREAT_MODEL.md to reflect the updated default policy.
  • Tests & Verification:
    • Added regression test copyToClipboard provides document execCommand copy fallback for insecure contexts in DashboardAssetsTest.kt.
    • Updated unit test assertions across SDK test suites.
    • Verified ./gradlew test, ./gradlew detekt ktlintCheck, and ./gradlew check.

… default

- Add fallback using document.execCommand('copy') when navigator.clipboard or window.isSecureContext is unavailable (e.g. over plain HTTP on LAN)
- Route copyStateJson and copyTableCsv through copyToClipboard with user toast feedback
- Remove authorization headers and Bearer regex pattern from default redaction policy to allow inspecting and copying authorization tokens by default during debugging
- Update documentation in SECURITY_AND_REDACTION.md and THREAT_MODEL.md
- Update unit tests across SDK modules and add regression tests for clipboard copy fallback

Fixes #40
Both list surfaces rendered only the captured path, so two calls to the
same endpoint -- /orders?status=open and /orders?status=all -- were two
identical rows and had to be opened one by one to be told apart. The
query was captured and redacted all along; it just never reached the row.

- Add NetworkUrl.queryString (the redacted `a=1&b=2` form display already
  built inline) and emit it as "query" beside "path" in the network list
  summary JSON, mirrored byte-for-byte in the evidence snapshot
- Web: rowHtml gains an optional mainSub, and Network rows pass the query
  into it -- dimmed after the path, with a title carrying both in full,
  so the endpoint stays the part that survives the row's ellipsis
- Device: pathWithQuery() reads the query back off the transaction url
  and titles the traffic row with it; traffic search matches the query,
  and the two url.ifBlank fallbacks no longer drop it

path itself stays bare everywhere: mock-rule prefill escapes it into a
regex, and the path= filter and path facets group on the endpoint alone.
InspectorTransactionUi deliberately gains no field for the same reason --
widening that data class would break its constructor and copy signatures
for every compiled caller, and url already carries the query.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NPxRnPJNgsb3y455VCrDGU
@maksudur03
maksudur03 merged commit 08544dc into main Sep 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some issues

2 participants