Repository navigation
fix(learning): redact credentials in captured bodies and URLs - #7587
Conversation
…E-506) Passwords and unambiguous credentials must never leave the browser, while everything else stays at full resolution. - Add a shared credential-key matcher and a per-session redactor. - Redact credential keys in JSON (any depth), urlencoded, and FormData request and response bodies before the 4 KiB cap applies; fall back to a pair regex for truncated or invalid text and report an unavailable body if redaction fails. - Remember values typed into password-like fields (last 20, min length 4, per session) and replace them in bodies and URLs, raw and encoded. - Treat fields as password-like when they are type=password, were seen as password-like earlier (show-password toggles), have a credential name, or use a password/one-time-code autocomplete token. - Strip URL userinfo and redact credential query and hash values in network, navigation, page, click, and input URLs. - Extend the credential header list.
…PE-506) - Track password fields for the whole session with a MutationObserver on `type`, a scan at start, and a remember listener that runs even when input capture is off. - Redact bodies with a linear scanner instead of parse and stringify, so unchanged text, big numbers, booleans, and null stay exact. Recurse into string values holding JSON, forms, GraphQL, or URLs, and handle `key: value` pairs. - Read up to 16 KiB, redact, then cut to the 4 KiB snapshot, so a redaction cannot pull an unredacted value into the window. - Decode declared text bodies lossily instead of sending raw base64, and treat application/graphql as text. - Match credential keys on word boundaries and skip metadata keys such as passwordExpiresAt, so invalidToken and secretary stay raw. - Match remembered all-digit values only as whole numbers. - Redact clicked element attributes and headers named like credentials. - Document the remaining limits.
…ion (refs PE-506) Credential redaction adds about 1.6 KiB gzip; the bundle is now 7373 bytes.
…fs PE-506) The watcher scanned password inputs and observed type changes with no guard, so a partial DOM made start() throw. Both parts are now optional; isPassword still catches fields on first sight.
…(refs PE-506) - Strip `scheme://user:pass@` anywhere in body text, string values, and attributes. - Treat authorization, cookie, jwt, bearer token, and csrf/xsrf token as credential keys when they end the key, and subscription keys anywhere. - Redact header values with the key matcher only, plus x-amz-security-token, private-token, and x-token. - Redact attributes whose name is a credential key, such as data-api-key. - Keep an auth scheme with its value (`Authorization: Bearer x`). - Recurse four levels into nested string values instead of two. - Drop the stray backslash after a value cut mid-escape. - Bound the userinfo scheme length so long words scan in linear time.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: CopilotKit/CopilotKit/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Production Digest-Pinning AuditAll 42 services digest-pinned. Run 2026-10-02 07:22:58 PDT — 0 finding(s). |
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/channels
@copilotkit/channels-core
@copilotkit/channels-discord
@copilotkit/channels-intelligence
@copilotkit/channels-slack
@copilotkit/channels-teams
@copilotkit/channels-telegram
@copilotkit/channels-ui
@copilotkit/channels-whatsapp
@copilotkit/core
@copilotkit/intelligence-langgraph
@copilotkit/intelligence-mastra
@copilotkit/learning
@copilotkit/mcp-apps-renderer
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/react-textarea
@copilotkit/react-ui
@copilotkit/runtime
@copilotkit/runtime-client-gql
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-components
@copilotkit/web-inspector
commit: |
|
Size Change: 0 B Total Size: 1.76 MB ℹ️ View Unchanged
|
4f9ec56
into
alem/pe-471-pair-on-browser-interaction-capture-experiments
What does this PR do?
Stacked on #7556. Makes the one privacy rule of the raw-capture scope true: passwords and credentials never leave the browser. Everything else is still captured at full resolution.
Before this, only password inputs and five headers were redacted. A login request still sent
{"password":"…"}in its body, and token responses, query tokens, URL userinfo and "show password" toggles leaked too.Redacted now
FormDatafields, and a fallback for text that doesn't parse. Keys likepassword,secret,api_key,access_token,authorization,cookie,jwt,csrfToken; metadata keys likepasswordExpiresAtorhasPassword: truestay raw.data-api-key), and header names that match the same rules (x-hasura-admin-secret,x-csrftoken,ocp-apim-subscription-key, …).start()throw.Known limits (documented in Captured data and the README): binary or untyped non-UTF-8 bodies, hand-built multipart text, XML, single-quoted JS objects, values percent-encoded inside a query value, passwords under 4 characters, OAuth
code=and tokens in URL paths.The package grows from 5.8 to 7.4 KB gzip, so the size budget moves from 6 to 8 KiB in a separate commit.
Related PRs and Issues
Testing
pnpm nx run-many -t test,check-types --projects=@copilotkit/learning,@copilotkit/core,@copilotkit/react-core,@copilotkit/runtime --skip-nx-cache: learning 172, core 1140, react-core 1786, runtime 2803 passed.data-api-key, show-password toggle): all 14 secrets leak on the base commit and none here, while emails, names, big numbers and plain query params stay intact.Checklist