/** * Static security rules (src/modules/doctor/rules/securityCode.ts): each pattern found and not found, the * accept marker, the config checks, the doctor wiring — and the GATE: the plugin's own code and the reference site * hold no place that matches a rule unless test/security-patterns.allow.json judges it. */ import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs' import { tmpdir } from 'node:os' import path from 'node:path' import { afterAll, describe, expect, test } from 'vitest' import { listCodeFiles, scanCode, scanConfigs } from '../src/modules/doctor/rules/securityCode.js' import { runDoctor } from '../src/modules/doctor/run.js' const root = path.resolve(import.meta.dirname, '..') const rules = (file: string, code: string) => scanCode(file, code).map((h) => h.rule) describe('static security rules — each pattern', () => { test('HTML and JSON printed into the page', () => { expect(rules('src/a.tsx', '
')).toEqual(['code-inner-html']) expect(rules('src/a.tsx', '