Skip to content
Closed
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
24 changes: 4 additions & 20 deletions src/constants/cyberRiskInstruction.ts
Original file line number Diff line number Diff line change
@@ -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.`
Comment thread
Flo5k5 marked this conversation as resolved.
15 changes: 2 additions & 13 deletions src/tools/FileReadTool/FileReadTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -727,15 +724,7 @@ function formatFileLines(file: { content: string; startLine: number }): string {
}

export const CYBER_RISK_MITIGATION_REMINDER =
'\n\n<system-reminder>\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</system-reminder>\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<system-reminder>\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</system-reminder>\n'
Comment thread
Flo5k5 marked this conversation as resolved.

/**
* Side-channel from call() to mapToolResultToToolResultBlockParam: mtime
Expand Down
Loading