update first - 84
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
version: 1.0
|
||||
description: CASAN H4 output filtering and data leakage prevention policy
|
||||
|
||||
default_action: allow
|
||||
|
||||
filters:
|
||||
- id: OUT-SECRET-001
|
||||
name: Secret material must never leave the harness
|
||||
match:
|
||||
regex: "(API[_-]?KEY|ACCESS[_-]?TOKEN|REFRESH[_-]?TOKEN|PASSWORD|JWT[_-]?SECRET|SECRET)\\s*[:=]\\s*\\S+"
|
||||
action: redact
|
||||
replacement: "[REDACTED_SECRET]"
|
||||
severity: high
|
||||
|
||||
- id: OUT-PII-EMAIL
|
||||
name: Email masking
|
||||
match:
|
||||
regex: "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"
|
||||
action: mask
|
||||
replacement: "***MASKED_EMAIL***"
|
||||
severity: medium
|
||||
|
||||
- id: OUT-PII-PHONE
|
||||
name: Phone masking
|
||||
match:
|
||||
regex: "(\\+?[0-9][0-9 .-]{8,}[0-9])"
|
||||
action: mask
|
||||
replacement: "***MASKED_PHONE***"
|
||||
severity: medium
|
||||
|
||||
- id: OUT-HALLUCINATION-RISK
|
||||
name: Uncertainty language marker
|
||||
match:
|
||||
regex: "(maybe|might be incorrect|i am not sure|uncertain)"
|
||||
action: flag
|
||||
severity: low
|
||||
|
||||
evidence:
|
||||
trace_dir: ".specify/logs/trace"
|
||||
audit_log: ".specify/logs/audit/security.jsonl"
|
||||
|
||||
level4_gate:
|
||||
required: true
|
||||
fail_on:
|
||||
- unredacted_secret
|
||||
- credit_card_output
|
||||
- blocked_prompt_injection
|
||||
report_in: "docs/output/casan/casan-level4-assessment.md"
|
||||
@@ -0,0 +1,43 @@
|
||||
version: 1.0
|
||||
description: PII Detection & Masking Rules
|
||||
|
||||
pii_patterns:
|
||||
|
||||
- id: PII-EMAIL
|
||||
type: email
|
||||
regex: "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}"
|
||||
action: mask
|
||||
|
||||
- id: PII-PHONE
|
||||
type: phone
|
||||
regex: "\\+?[0-9]{9,15}"
|
||||
action: mask
|
||||
|
||||
- id: PII-ID
|
||||
type: personal_id
|
||||
regex: "[0-9]{9,12}"
|
||||
action: mask
|
||||
|
||||
- id: PII-CREDITCARD
|
||||
type: credit_card
|
||||
regex: "\\b(?:[0-9]{4}[- ]?){3}[0-9]{4}\\b"
|
||||
action: block
|
||||
|
||||
- id: PII-ADDRESS
|
||||
type: address
|
||||
regex: "(street|road|district|city)"
|
||||
action: mask
|
||||
|
||||
default_action: allow
|
||||
|
||||
actions:
|
||||
mask:
|
||||
replacement: "***MASKED***"
|
||||
block:
|
||||
message: "Sensitive data detected. Request blocked."
|
||||
log:
|
||||
message: "PII detected and logged."
|
||||
|
||||
logging:
|
||||
enabled: true
|
||||
log_level: medium
|
||||
@@ -0,0 +1,101 @@
|
||||
version: 1.0
|
||||
description: Prompt Injection & Input Validation Rules
|
||||
|
||||
rules:
|
||||
|
||||
- id: PI-001
|
||||
name: Prompt Injection - Override System
|
||||
pattern: "(ignore previous instruction|bypass system|override policy)"
|
||||
severity: high
|
||||
action: block
|
||||
|
||||
- id: PI-002
|
||||
name: Prompt Injection - Role Hijack
|
||||
pattern: "(you are now|act as admin|pretend to be system)"
|
||||
severity: high
|
||||
action: block
|
||||
|
||||
- id: PI-003
|
||||
name: Data Exfiltration Attempt
|
||||
pattern: "(show all data|dump database|export secrets)"
|
||||
severity: high
|
||||
action: alert
|
||||
|
||||
- id: PI-004
|
||||
name: Unsafe Command
|
||||
pattern: "(delete .*|drop table|shutdown system)"
|
||||
severity: high
|
||||
action: require_approval
|
||||
|
||||
- id: PI-005
|
||||
name: Suspicious Instruction
|
||||
pattern: "(hidden instruction|internal prompt|system message)"
|
||||
severity: medium
|
||||
action: log
|
||||
|
||||
jailbreak_patterns:
|
||||
- id: JB-001
|
||||
name: Role Jailbreak
|
||||
pattern: "act as a? ?(different|evil|unconstrained|unrestricted|unfiltered)"
|
||||
severity: high
|
||||
action: block
|
||||
- id: JB-002
|
||||
name: Identity Jailbreak
|
||||
pattern: "pretend (you are|you're) (not|no longer) (an AI|Claude|an assistant)"
|
||||
severity: high
|
||||
action: block
|
||||
- id: JB-003
|
||||
name: Mode Jailbreak
|
||||
pattern: "(developer mode|DAN mode|jailbreak mode|unrestricted mode)"
|
||||
severity: high
|
||||
action: block
|
||||
- id: JB-004
|
||||
name: Override Injection
|
||||
pattern: "ignore (all )?(previous|prior|above) (instructions|guidelines|rules)"
|
||||
severity: high
|
||||
action: block
|
||||
- id: JB-005
|
||||
name: Hidden Instruction Reveal
|
||||
pattern: "your (real|true|actual) instructions are"
|
||||
severity: high
|
||||
action: block
|
||||
- id: JB-006
|
||||
name: System Prompt Probe
|
||||
pattern: "what (are|were) your (system |original )?instructions"
|
||||
severity: medium
|
||||
action: log
|
||||
|
||||
credential_patterns:
|
||||
- id: CRED-001
|
||||
name: AWS Access Key
|
||||
pattern: "AKIA[0-9A-Z]{16}"
|
||||
severity: high
|
||||
action: block
|
||||
- id: CRED-002
|
||||
name: Generic Secret Assignment
|
||||
pattern: "(API[_-]?KEY|ACCESS[_-]?TOKEN|REFRESH[_-]?TOKEN|PASSWORD|JWT[_-]?SECRET|SECRET)\\s*[:=]\\s*\\S+"
|
||||
severity: high
|
||||
action: block
|
||||
note: "Env var refs like $env:API_KEY or process.env.API_KEY are allowed"
|
||||
- id: CRED-003
|
||||
name: Database Connection String
|
||||
pattern: "(postgres|mysql|mongodb)://[^@]+@"
|
||||
severity: high
|
||||
action: block
|
||||
- id: CRED-004
|
||||
name: Private Key Header
|
||||
pattern: "-----BEGIN (RSA |EC )?PRIVATE KEY-----"
|
||||
severity: high
|
||||
action: block
|
||||
|
||||
default_action: allow
|
||||
|
||||
actions:
|
||||
block:
|
||||
message: "Request blocked due to security policy."
|
||||
alert:
|
||||
message: "Suspicious activity detected."
|
||||
require_approval:
|
||||
message: "Approval required before execution."
|
||||
log:
|
||||
message: "Logged for audit."
|
||||
Reference in New Issue
Block a user