agent-sanitizer 2.52.0 → 2.54.0
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/LICENSE-THIRD-PARTY +28 -0
- package/README.md +9 -0
- package/THREAT-MODEL.md +12 -0
- package/bin/sanitize-cli.mjs +2 -1
- package/package.json +12 -2
- package/src/gfm.mjs +54 -0
- package/src/html.mjs +36 -21
- package/src/index.mjs +12 -2
- package/src/output.mjs +7 -3
- package/src/vendor/gfm-autolink-literal.mjs +1015 -0
- package/types/gfm.d.mts +8 -0
- package/types/html.d.mts +14 -2
- package/types/index.d.mts +7 -1
- package/types/output.d.mts +2 -0
- package/types/vendor/gfm-autolink-literal.d.mts +10 -0
package/types/gfm.d.mts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A unified plugin adding GFM support: autolink literals, footnotes,
|
|
3
|
+
* strikethrough, tables and task lists — the same set, in the same order, as
|
|
4
|
+
* `remark-gfm`.
|
|
5
|
+
* @this {any} unified processor
|
|
6
|
+
* @returns {undefined}
|
|
7
|
+
*/
|
|
8
|
+
export default function remarkGfmFixed(this: any): undefined;
|
package/types/html.d.mts
CHANGED
|
@@ -111,10 +111,19 @@ export function sanitizeHtml(text: string): {
|
|
|
111
111
|
unparseable?: true;
|
|
112
112
|
} | null;
|
|
113
113
|
/**
|
|
114
|
+
* `flagDigestValues` drops the digest exemption: an exact-digest-length hex
|
|
115
|
+
* value under a generic parameter name is reported as payload rather than read
|
|
116
|
+
* as a fingerprint. Off by default because the exemption is what keeps a
|
|
117
|
+
* cache-buster, an ETag and a commit id quiet; on for a caller whose cost of a
|
|
118
|
+
* missed 16-to-64-byte channel beats its cost of those false positives. Like
|
|
119
|
+
* every option this module takes, it can only ADD detection.
|
|
114
120
|
* @param {string} url
|
|
121
|
+
* @param {{ flagDigestValues?: boolean }} [options]
|
|
115
122
|
* @returns {string | null}
|
|
116
123
|
*/
|
|
117
|
-
export function checkExfilUrl(url: string
|
|
124
|
+
export function checkExfilUrl(url: string, options?: {
|
|
125
|
+
flagDigestValues?: boolean;
|
|
126
|
+
}): string | null;
|
|
118
127
|
/**
|
|
119
128
|
* Host of a flagged URL — enough for the warning to name the destination
|
|
120
129
|
* without echoing the payload-bearing query/fragment.
|
|
@@ -133,9 +142,12 @@ export function urlHost(url: string): string;
|
|
|
133
142
|
* link somebody has to follow. Both are reported; the caller uses it to decide
|
|
134
143
|
* how loudly (see the exfil tier in ./output.mjs).
|
|
135
144
|
* @param {string} text
|
|
145
|
+
* @param {{ flagDigestValues?: boolean }} [options] see {@link checkExfilUrl}
|
|
136
146
|
* @returns {Array<{ isImage: boolean, autoFetched: boolean, reason: string, target: string }> | null}
|
|
137
147
|
*/
|
|
138
|
-
export function detectExfil(text: string
|
|
148
|
+
export function detectExfil(text: string, options?: {
|
|
149
|
+
flagDigestValues?: boolean;
|
|
150
|
+
}): Array<{
|
|
139
151
|
isImage: boolean;
|
|
140
152
|
autoFetched: boolean;
|
|
141
153
|
reason: string;
|
package/types/index.d.mts
CHANGED
|
@@ -35,13 +35,19 @@
|
|
|
35
35
|
* legitimate markup — matching the separate flags `sanitizeText` takes for the
|
|
36
36
|
* tool-output pipeline, which needs Layer 3's detection without Layer 2's
|
|
37
37
|
* splice.
|
|
38
|
+
*
|
|
39
|
+
* `flagDigestValues` widens Layer 3 only: it drops the digest exemption, so an
|
|
40
|
+
* exact-digest-length hex value under a generic parameter name is reported as
|
|
41
|
+
* payload rather than read as a cache-buster or an ETag. Off by default, and
|
|
42
|
+
* like `exfilScan` it can only ADD detection.
|
|
38
43
|
* @param {string} text
|
|
39
|
-
* @param {{ html?: boolean, exfilScan?: boolean } | null} [options]
|
|
44
|
+
* @param {{ html?: boolean, exfilScan?: boolean, flagDigestValues?: boolean } | null} [options]
|
|
40
45
|
* @returns {Promise<{ cleaned: string, found: string[], warnings: string[], notes: string[], splices?: Array<{ placeholder: string, original: string }> }>}
|
|
41
46
|
*/
|
|
42
47
|
export function sanitize(text: string, options?: {
|
|
43
48
|
html?: boolean;
|
|
44
49
|
exfilScan?: boolean;
|
|
50
|
+
flagDigestValues?: boolean;
|
|
45
51
|
} | null): Promise<{
|
|
46
52
|
cleaned: string;
|
|
47
53
|
found: string[];
|
package/types/output.d.mts
CHANGED
|
@@ -38,6 +38,7 @@ export function deleteVerbatimSpans(text: string, spans: string[]): {
|
|
|
38
38
|
* @typedef {{
|
|
39
39
|
* html?: boolean,
|
|
40
40
|
* exfilScan?: boolean,
|
|
41
|
+
* flagDigestValues?: boolean,
|
|
41
42
|
* redact?: (text: string) => Promise<RedactResult|null> | (RedactResult|null),
|
|
42
43
|
* filterInjection?: (text: string) => Promise<Layer5Result|null> | (Layer5Result|null),
|
|
43
44
|
* sgrCarveOut?: boolean,
|
|
@@ -268,6 +269,7 @@ export type PipelineState = {
|
|
|
268
269
|
export type SanitizeTextOptions = {
|
|
269
270
|
html?: boolean;
|
|
270
271
|
exfilScan?: boolean;
|
|
272
|
+
flagDigestValues?: boolean;
|
|
271
273
|
redact?: (text: string) => Promise<RedactResult | null> | (RedactResult | null);
|
|
272
274
|
filterInjection?: (text: string) => Promise<Layer5Result | null> | (Layer5Result | null);
|
|
273
275
|
sgrCarveOut?: boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create an extension for `micromark` to support GitHub autolink literal
|
|
3
|
+
* syntax.
|
|
4
|
+
*
|
|
5
|
+
* @returns {Extension}
|
|
6
|
+
* Extension for `micromark` that can be passed in `extensions` to enable GFM
|
|
7
|
+
* autolink literal syntax.
|
|
8
|
+
*/
|
|
9
|
+
export function gfmAutolinkLiteral(): Extension;
|
|
10
|
+
import type { Extension } from 'micromark-util-types';
|