quelda
Version:
PDF & Illustrator security scanner (WebAssembly): files + policy in, verdict out
40 lines (39 loc) • 1.44 kB
JavaScript
// Public types of the JSON contract (schemas/*.schema.json at the repo root).
// test/schema.test.ts checks these against the schemas field by field.
/** Preset names (`policy.schema.json` `preset`). */
export const PRESETS = ['strict', 'balanced', 'permissive'];
/** Category keys (design §5.6), in engine order. */
export const CATEGORIES = [
'filetype',
'postscript',
'active_content',
'embedded',
'external',
'forms',
'xml',
'structure',
'encryption',
'codecs',
'resource',
];
/** What a policy can set for a category or rule. */
export const ACTIONS = ['block', 'warn', 'off'];
export const SEVERITIES = ['critical', 'high', 'medium', 'low', 'info'];
export const STAGES = ['preview', 'stable'];
export const STATUSES = ['PASS', 'REJECT', 'ERROR'];
/**
* Error codes of `ERROR` verdicts made by this package (not by the engine):
* - `LIMIT.TIMEOUT`: the scan ran longer than `timeoutMs`; the worker was killed.
* - `ENGINE.ABORTED`: the `AbortSignal` fired or `terminate()` was called.
* - `ENGINE.WORKER`: the worker or the WASM engine failed (crash, trap, load
* error, malformed reply).
* - `ENGINE.INPUT`: the input or the scan options could not be used.
* - `POLICY.INVALID`: the policy object could not be serialized to JSON.
*/
export const SCANNER_ERROR_CODES = [
'LIMIT.TIMEOUT',
'ENGINE.ABORTED',
'ENGINE.WORKER',
'ENGINE.INPUT',
'POLICY.INVALID',
];