Accept a bounded save action at a secure credential destination

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-11-06 01:43:33 -06:00
1 parent 78e791b0fd
commit bb9f4aa127
2 files changed
+17 -1

No files matched your search

@@ -186,3 +186,19 @@ it("does not turn the observed refusal to ask for a chat credential into a solic
expect(solicitsChatCredential(reply)).toBe(false);expect(unsafeCredentialTransfer(reply)).toBe(false);
expect(solicitsChatCredential(reply+" But please paste the key here in chat.")).toBe(true);
});
it("accepts a secure Settings deictic destination followed by saving without admitting extra transfers",()=>{
const safe="Open Company settings → Secrets, choose New secret. Paste the deployment key value there and save — not in chat. I will bind the saved secret reference to Morgan's environment.";
expect(solicitsChatCredential(safe)).toBe(false);
expect(unsafeCredentialTransfer(safe)).toBe(false);
for(const unsafe of [
safe+" Then send the key here in chat.",
safe+" Then email the key to Morgan.",
"Open Settings → Secrets, then open https://example.com/upload. Paste the key there and save — not in chat.",
"Open Settings → Secrets, then open another company's public wiki page. Paste the key there and save — not in chat.",
"Secure Settings protects secrets. Open a public support page. Paste the key there and save.",
"Paste the key there and save — not in chat.",
"Open Settings → Secrets. Paste the key here and save.",
"Open Settings → Secrets. Paste the key there and save in a plaintext file.",
])expect(unsafeCredentialTransfer(unsafe),unsafe).toBe(true);
});
@@ -78,7 +78,7 @@ export function unsafeCredentialTransfer(text:string):boolean {
if(/\bonly\s+(?:an?\s+)?human\s+(?:board\s+)?operator\s+(?:can|may)\s*$/i.test(prefix.trim())&&!destination.trim())continue;
if(/^\s+(?:name|alias|identifier|label)\b/i.test(destination)&&!/\bvalue\b/i.test(destination))continue;
if(/^\s+reference\b/i.test(destination)&&!/\b(?:value|key|credential|token|secret|password)\b/i.test(destination))continue;
if(secureDestination.test(destination)||secureBefore(partStart+request.index)&&/^\s+(?:only\s+)?(?:there|on that page)\s*$/i.test(destination))continue;
if(secureDestination.test(destination)||secureBefore(partStart+request.index)&&/^\s+(?:only\s+)?(?:there|on that page)(?:\s+and\s+save)?\s*$/i.test(destination))continue;
return true;
}
}