mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-10 12:37:55 +01:00
fix(evals): preserve coordinated negative credential alternatives
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
35e9d68869
commit
303e4beed3
2 files changed
+7
-1
No files matched your search
@@ -94,3 +94,9 @@ it.each([["a plaintext file before opening Settings Secrets",false],["the secure
|
||||
const row=environmentQuestion();row.payload.questionSet!.questions[0]!.helpText=`Don't enter the key in chat, and please enter the key in ${destination}.`;
|
||||
expect(!!companySecretQuestionHandoff(row,binding)).toBe(accepted);
|
||||
});
|
||||
it("keeps a coordinated negative alternative within the original prohibition",()=>{
|
||||
const row=environmentQuestion();row.payload.questionSet!.questions[0]!.helpText="Do not paste the key in chat, or enter the key in plaintext files.";
|
||||
expect(companySecretQuestionHandoff(row,binding)).toMatchObject({environmentName:"DEPLOYMENT_API_KEY"});
|
||||
const positive=environmentQuestion();positive.payload.questionSet!.questions[0]!.helpText="Enter the key in plaintext files.";
|
||||
expect(companySecretQuestionHandoff(positive,binding)).toBeUndefined();
|
||||
});
|
||||
@@ -48,7 +48,7 @@ export function companySecretQuestionHandoff(value:unknown,b:SecretQuestionBindi
|
||||
if(q.answerMode==="text"){
|
||||
const prompt=q.prompt.replace(/\(Do not include the key value\.\)/gi,"").trim();
|
||||
const guidance=[qs.title,qs.description,q.header,q.helpText,qs.submitLabel].filter(Boolean).join("\n");
|
||||
const instructions=guidance.replace(/\b(?:(?:do|should|must|can|could|will|would)\s+not|don.t|never)\s+(?:paste|send|share|provide|enter|include)[^.!?,;\n]*/gi,"");
|
||||
const instructions=guidance.replace(/\b(?:(?:do|should|must|can|could|will|would)\s+not|don.t|never)\s+(?:paste|send|share|provide|enter|include)[^.!?,;\n]*(?:,\s*or\s+(?:please\s+)?(?:paste|send|share|provide|enter|include)[^.!?,;\n]*)*/gi,"");
|
||||
const unsafeInstructions=instructions.split(/[.!;\n]+/).some(clause=>{
|
||||
const request=clause.match(/\b(?:paste|send|share|provide|enter|include|supply|type)\b.{0,70}?\b(?:key|credential|token)\b(.*)/i);
|
||||
return !!request&&!/^\s+(?:value\s+)?(?:only\s+)?(?:in|into|on|via|through)\s+(?:(?:the|your|a)\s+)?(?:(?:secure\s+)?Settings(?:\s*(?:→|>|\/)\s*|\s+)Secrets(?:\s+(?:form|page|field))?|(?:secure\s+)?Secrets\s+(?:form|page|field)|secure\s+(?:form|page|field))\b/i.test(request[1]!);
|
||||
|
||||
Reference in new issue
Block a user