agent-sanitizer 2.34.6 → 2.34.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/claude-hooks/lib/invisible-alert.mjs +36 -10
- package/claude-hooks/scan-invisible-chars.mjs +64 -44
- package/package.json +1 -1
- package/src/html.mjs +108 -14
- package/src/invisible.mjs +548 -238
- package/types/claude-hooks/lib/invisible-alert.d.mts +4 -0
- package/types/claude-hooks/scan-invisible-chars.d.mts +8 -21
|
@@ -26,6 +26,10 @@ export function alertAcknowledged(): boolean;
|
|
|
26
26
|
*/
|
|
27
27
|
export function acknowledgeAlert(): void;
|
|
28
28
|
/**
|
|
29
|
+
* The blocking ask. The heading states only that the scan did not finish clean:
|
|
30
|
+
* the alert carries injection findings, unreadable targets, or a scanner fault,
|
|
31
|
+
* and each report names its own kind. A heading that asserted "injection
|
|
32
|
+
* detected" mislabelled the other two.
|
|
29
33
|
* @param {string} findings
|
|
30
34
|
* @returns {string}
|
|
31
35
|
*/
|
|
@@ -1,31 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Scan every instruction file under the project,
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* caller announces "clean"
|
|
8
|
-
* MISSING announcement is loud. A per-file failure swallowed into an empty
|
|
9
|
-
* findings list turns "we could not read this file" into "this file is fine",
|
|
10
|
-
* which is the one lie this hook must never tell. So a file that cannot be read
|
|
11
|
-
* is REPORTED as unscanned, not dropped.
|
|
12
|
-
*
|
|
13
|
-
* ANY errno is a skip; only a non-filesystem throw propagates. The split is
|
|
14
|
-
* between "this file could not be read" (report it and keep scanning) and "this
|
|
15
|
-
* code is broken" (a TypeError from an unloaded binding — nothing here can be
|
|
16
|
-
* trusted, so it goes to the caller's declared failure posture). Catching only
|
|
17
|
-
* ENOENT would invert the enforcement: one EACCES target would discard the
|
|
18
|
-
* result for EVERY other instruction file, leaving them unscanned and
|
|
19
|
-
* un-auto-cleaned, and under the shipped OPEN posture the hook fault arms
|
|
20
|
-
* nothing — so the SUSPICIOUS failure would get weaker enforcement than the
|
|
21
|
-
* benign glob race, which reaches `partial` and arms the gate. Same errno-vs-bug
|
|
22
|
-
* split {@link autoCleanFindings} uses.
|
|
2
|
+
* Scan every instruction file under the project, bucketing each unreadable
|
|
3
|
+
* target through {@link classifyReadFailure}. `scanned` is DERIVED from the two
|
|
4
|
+
* failure buckets, so the accounting invariant — every target is scanned,
|
|
5
|
+
* skipped or absent — holds by construction and needs no comment restating it.
|
|
6
|
+
* A target lost from that accounting is an instruction file that reaches the
|
|
7
|
+
* model while the caller announces "clean".
|
|
23
8
|
* @param {string} [dir] project root to scan (injectable for tests)
|
|
24
9
|
* @returns {{
|
|
25
10
|
* targets: string[],
|
|
26
11
|
* scanned: number,
|
|
27
12
|
* findings: Array<{file: string, findings: ReturnType<typeof scanFile>}>,
|
|
28
13
|
* skipped: Array<{file: string, reason: string}>,
|
|
14
|
+
* absent: string[],
|
|
29
15
|
* }}
|
|
30
16
|
*/
|
|
31
17
|
export function scanProject(dir?: string): {
|
|
@@ -39,6 +25,7 @@ export function scanProject(dir?: string): {
|
|
|
39
25
|
file: string;
|
|
40
26
|
reason: string;
|
|
41
27
|
}>;
|
|
28
|
+
absent: string[];
|
|
42
29
|
};
|
|
43
30
|
/**
|
|
44
31
|
* The report for targets the scan could not read. Rendered into the alert the
|