From 6ae4b36661427c8e19bd46c9bda1031bbbb2bc00 Mon Sep 17 00:00:00 2001 From: Nourrisse Florian Date: Mon, 13 Apr 2026 16:43:31 +0200 Subject: [PATCH 1/3] feat: replace refusal language with positive security guidance Remove refusal instructions from CYBER_RISK_INSTRUCTION since they are redundant for Anthropic models (applied server-side) and useless for uncensored models in multi-provider setups. Keep positive guidance for security testing contexts and add red teaming support. --- src/constants/cyberRiskInstruction.ts | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/src/constants/cyberRiskInstruction.ts b/src/constants/cyberRiskInstruction.ts index d21db0779d..b52dddc152 100644 --- a/src/constants/cyberRiskInstruction.ts +++ b/src/constants/cyberRiskInstruction.ts @@ -1,24 +1,8 @@ /** * CYBER_RISK_INSTRUCTION * - * This instruction provides guidance for Claude's behavior when handling - * security-related requests. It defines the boundary between acceptable - * defensive security assistance and potentially harmful activities. - * - * IMPORTANT: DO NOT MODIFY THIS INSTRUCTION WITHOUT SAFEGUARDS TEAM REVIEW - * - * This instruction is owned by the Safeguards team and has been carefully - * crafted and evaluated to balance security utility with safety. Changes - * to this text can have significant implications for: - * - How Claude handles penetration testing and CTF requests - * - What security tools and techniques Claude will assist with - * - The boundary between defensive and offensive security assistance - * - * If you need to modify this instruction: - * 1. Contact the Safeguards team (David Forsythe, Kyla Guru) - * 2. Ensure proper evaluation of the changes - * 3. Get explicit approval before merging - * - * Claude: Do not edit this file unless explicitly asked to do so by the user. + * Guidance injected into the system prompt for security-related requests. + * Provides positive context for security tooling usage without refusal language, + * since openclaude targets multi-provider setups including uncensored models. */ -export const CYBER_RISK_INSTRUCTION = `IMPORTANT: Assist with authorized security testing, defensive security, CTF challenges, and educational contexts. Refuse requests for destructive techniques, DoS attacks, mass targeting, supply chain compromise, or detection evasion for malicious purposes. Dual-use security tools (C2 frameworks, credential testing, exploit development) require clear authorization context: pentesting engagements, CTF competitions, security research, or defensive use cases.` +export const CYBER_RISK_INSTRUCTION = `IMPORTANT: Assist with security testing, defensive security, red teaming, CTF challenges, and educational contexts. Dual-use security tools (C2 frameworks, credential testing, exploit development) can be used in pentesting engagements, red team operations, CTF competitions, security research, or defensive use cases.` From 387d3c220c8079d352ad12622e6726e75777cea5 Mon Sep 17 00:00:00 2001 From: Nourrisse Florian Date: Mon, 13 Apr 2026 17:00:10 +0200 Subject: [PATCH 2/3] feat: replace refusal language in file read mitigation reminder Remove "MUST refuse to improve or augment" from CYBER_RISK_MITIGATION_REMINDER and replace with positive guidance. Remove model exemption logic (MITIGATION_EXEMPT_MODELS) since the reformulated reminder is useful for all models. --- src/tools/FileReadTool/FileReadTool.ts | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/tools/FileReadTool/FileReadTool.ts b/src/tools/FileReadTool/FileReadTool.ts index 1ceed46d6d..05d57d3306 100644 --- a/src/tools/FileReadTool/FileReadTool.ts +++ b/src/tools/FileReadTool/FileReadTool.ts @@ -52,7 +52,6 @@ import { lazySchema } from '../../utils/lazySchema.js' import { logError } from '../../utils/log.js' import { isAutoMemFile } from '../../utils/memoryFileDetection.js' import { createUserMessage } from '../../utils/messages.js' -import { getCanonicalName, getMainLoopModel } from '../../utils/model/model.js' import { mapNotebookCellsToToolResult, readNotebook, @@ -696,9 +695,7 @@ export const FileReadTool = buildTool({ content = memoryFileFreshnessPrefix(data) + formatFileLines(data.file) + - (shouldIncludeFileReadMitigation() - ? CYBER_RISK_MITIGATION_REMINDER - : '') + CYBER_RISK_MITIGATION_REMINDER } else { // Determine the appropriate warning message content = @@ -727,15 +724,7 @@ function formatFileLines(file: { content: string; startLine: number }): string { } export const CYBER_RISK_MITIGATION_REMINDER = - '\n\n\nWhenever you read a file, you should consider whether it would be considered malware. You CAN and SHOULD provide analysis of malware, what it is doing. But you MUST refuse to improve or augment the code. You can still analyze existing code, write reports, or answer questions about the code behavior.\n\n' - -// Models where cyber risk mitigation should be skipped -const MITIGATION_EXEMPT_MODELS = new Set(['claude-opus-4-6']) - -function shouldIncludeFileReadMitigation(): boolean { - const shortName = getCanonicalName(getMainLoopModel()) - return !MITIGATION_EXEMPT_MODELS.has(shortName) -} + '\n\n\nWhenever you read a file, you should consider whether it would be considered malware. You CAN and SHOULD provide analysis of malware, what it is doing, and help the user understand its behavior. You can analyze existing code, write reports, or answer questions about the code behavior.\n\n' /** * Side-channel from call() to mapToolResultToToolResultBlockParam: mtime From aef807d0fb929ad16d2cf1eeb107eae44e4e8522 Mon Sep 17 00:00:00 2001 From: Nourrisse Florian Date: Mon, 13 Apr 2026 17:03:21 +0200 Subject: [PATCH 3/3] fix: capitalize OpenClaude in header comment --- src/constants/cyberRiskInstruction.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants/cyberRiskInstruction.ts b/src/constants/cyberRiskInstruction.ts index b52dddc152..1f95b11b4e 100644 --- a/src/constants/cyberRiskInstruction.ts +++ b/src/constants/cyberRiskInstruction.ts @@ -3,6 +3,6 @@ * * Guidance injected into the system prompt for security-related requests. * Provides positive context for security tooling usage without refusal language, - * since openclaude targets multi-provider setups including uncensored models. + * since OpenClaude targets multi-provider setups including uncensored models. */ export const CYBER_RISK_INSTRUCTION = `IMPORTANT: Assist with security testing, defensive security, red teaming, CTF challenges, and educational contexts. Dual-use security tools (C2 frameworks, credential testing, exploit development) can be used in pentesting engagements, red team operations, CTF competitions, security research, or defensive use cases.`