diff --git a/tests/runner-e2e/chat-catalog-domains/external-company-secret-question.test.ts b/tests/runner-e2e/chat-catalog-domains/external-company-secret-question.test.ts index c2ad28cd824..b6111ef569e 100644 --- a/tests/runner-e2e/chat-catalog-domains/external-company-secret-question.test.ts +++ b/tests/runner-e2e/chat-catalog-domains/external-company-secret-question.test.ts @@ -90,3 +90,7 @@ it("rejects a plaintext destination even when later guidance mentions Settings S const row=environmentQuestion();row.payload.questionSet!.questions[0]!.helpText="Enter the deployment key in a plaintext file before opening Settings Secrets."; expect(companySecretQuestionHandoff(row,binding)).toBeUndefined(); }); +it.each([["a plaintext file before opening Settings Secrets",false],["the secure Settings Secrets form",true]] as const)("retains the independent entry destination after a warning: %s",(destination,accepted)=>{ + 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); +}); diff --git a/tests/runner-e2e/chat-catalog-domains/external-company-secret.ts b/tests/runner-e2e/chat-catalog-domains/external-company-secret.ts index 1cf8efb2ca1..2e0db077913 100644 --- a/tests/runner-e2e/chat-catalog-domains/external-company-secret.ts +++ b/tests/runner-e2e/chat-catalog-domains/external-company-secret.ts @@ -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]*/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]!);