Skip to content
This repository was archived by the owner on Nov 7, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/cors-credentials-header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@opencode-ai/browser-control": patch
---

Stop treating the `Access-Control-Allow-Credentials` response header as a credential
during network capture, so its `true` value no longer becomes a Secret Profile slot
or replaces `true` in execute output while a capture is active.
5 changes: 5 additions & 0 deletions src/network-redaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const secretHeaders = new Set([
"csrf-token",
"x-xsrf-token",
])
// Header names that match `secretNamePattern` but never carry a credential value.
const nonSecretHeaders = new Set([
"access-control-allow-credentials",
])

export class SecretCollector {
private readonly slotsByRef = new Map<string, MutableCredentialSlot>()
Expand Down Expand Up @@ -165,6 +169,7 @@ export class SecretCollector {
const match = /^(\S+)\s+(.+)$/.exec(value)
if (match) return `${match[1]} ${this.reference(match[2] ?? "", source)}`
}
if (nonSecretHeaders.has(lower)) return value
if (secretHeaders.has(lower) || secretNamePattern.test(lower)) {
return this.reference(value, source)
}
Expand Down
10 changes: 10 additions & 0 deletions test/network-redaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,16 @@ describe("SecretCollector", () => {
.toEqual([{ name: "Location", value: "/callback?code=${BC_SECRET_1}#done" }])
})

it("keeps the CORS credentials flag out of secret slots and output redaction", () => {
const collector = new SecretCollector()
expect(collector.protectHeaders([
{ name: "Access-Control-Allow-Credentials", value: "true" },
], "response")).toEqual([{ name: "Access-Control-Allow-Credentials", value: "true" }])
expect(collector.slots()).toEqual([])
expect(collector.redactValue({ visible: true })).toEqual({ visible: true })
expect(collector.redactText("checkbox checked: true")).toBe("checkbox checked: true")
})

it("preserves duplicate cookie names as independent references", () => {
const collector = new SecretCollector()
expect(collector.protectHeaders([{ name: "Cookie", value: "sid=first; sid=second" }], "request"))
Expand Down