feat(llm-security): wire TRG scanner into orchestrator and policy

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V3s6WnubSSrFjAQTLQdVbG
This commit is contained in:
Kjell Tore Guttormsen 2026-06-20 09:24:23 +02:00
commit 75aeeeee68
4 changed files with 83 additions and 1 deletions

View file

@ -65,6 +65,24 @@ const DEFAULT_POLICY = Object.freeze({
// Substring matches against relative path — plain contains, no glob.
suppress_paths: [],
},
// TRG — trigger/activation-abuse scanner. Lists mirror the scanner defaults
// in scanners/trigger-scanner.mjs; override any of them via policy.json.
trg: {
mode: 'warn',
baiting_phrases: [
'anything', 'everything', 'always', 'whenever', 'no matter what',
'any request', 'any task', 'any file', 'every time',
'all files', 'all messages', 'all requests',
],
builtin_names: [
'read', 'write', 'edit', 'bash', 'glob', 'grep', 'task',
'webfetch', 'websearch', 'notebookedit', 'todowrite',
'ls', 'cat', 'agent', 'search', 'fetch',
],
broad_single_words: [
'run', 'do', 'go', 'help', 'fix', 'use', 'get', 'set', 'all', 'any', 'it', 'this', 'that',
],
},
});
// Cache loaded policy per project root

View file

@ -143,6 +143,7 @@ export const OWASP_MAP = Object.freeze({
SCR: ['LLM03'],
PST: ['LLM01', 'LLM06'],
WFL: ['LLM02', 'LLM06'],
TRG: ['LLM06'],
});
/**
@ -162,6 +163,7 @@ export const OWASP_AGENTIC_MAP = Object.freeze({
SCR: ['ASI04'],
PST: ['ASI02', 'ASI03', 'ASI04', 'ASI05'],
WFL: ['ASI04'],
TRG: [],
});
/**
@ -181,6 +183,7 @@ export const OWASP_SKILLS_MAP = Object.freeze({
SCR: ['AST06'],
PST: ['AST01', 'AST03'],
WFL: [],
TRG: ['AST04'],
});
/**
@ -200,6 +203,7 @@ export const OWASP_MCP_MAP = Object.freeze({
SCR: ['MCP04'],
PST: ['MCP02', 'MCP07'],
WFL: [],
TRG: [],
});
/**

View file

@ -109,6 +109,7 @@ import { scan as memoryScan } from './memory-poisoning-scanner.mjs';
import { scan as supplyChainScan } from './supply-chain-recheck.mjs';
import { scan as workflowScan } from './workflow-scanner.mjs';
import { scan as tfaScan } from './toxic-flow-analyzer.mjs';
import { scan as trgScan } from './trigger-scanner.mjs';
const SCANNERS = [
{ name: 'unicode', fn: unicodeScan },
@ -121,6 +122,7 @@ const SCANNERS = [
{ name: 'memory', fn: memoryScan },
{ name: 'supply-chain', fn: supplyChainScan },
{ name: 'workflow', fn: workflowScan },
{ name: 'trg', fn: trgScan },
{ name: 'toxic-flow', fn: tfaScan, requiresPriorResults: true },
];