@mitre/hdf-utilities 3.7.2 → 3.8.0-next.42533588944.1

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.
@@ -1,6 +1,5 @@
1
1
  import { findValuesByKey } from "../object/index.js";
2
2
  import { X2jOptions, XmlBuilderOptions } from "fast-xml-parser";
3
- //#region src/xml/index.d.ts
4
3
  /**
5
4
  * Parse XML string to JavaScript object
6
5
  *
@@ -95,6 +94,59 @@ export declare function parseXmlWithArrays(xml: string, arrayTags: string[], opt
95
94
  * ```
96
95
  */
97
96
  export declare function extractTextFromXml(xml: string): string;
98
- //#endregion
97
+ /**
98
+ * Walks the XML prologue — everything before the root element, the only region where a
99
+ * DOCTYPE may legally appear — and reports which declarations it holds.
100
+ *
101
+ * It reports rather than returning the text to search, because the text would still
102
+ * contain commented-out declarations: `<!-- <!DOCTYPE x> -->` is not a declaration, and
103
+ * grepping a region that includes it cannot tell the difference.
104
+ *
105
+ * A fixed byte window cannot bound this region: the prologue may carry any amount of
106
+ * comment and processing-instruction text, so a declaration can be pushed past any
107
+ * constant. Walking to the root element has no such hole, and it is also what stops
108
+ * declaration-shaped CONTENT from false-positiving — once the root is reached, nothing
109
+ * after it is a declaration.
110
+ *
111
+ * An unterminated construct yields no root element, and so no prologue: there is nothing
112
+ * a document that never opens an element can be said to have declared.
113
+ *
114
+ * Kept in parity with Go's scanXMLPrologue by testdata/xml-doctype-cases.json, which
115
+ * both suites read.
116
+ */
117
+ export interface XmlPrologueDeclarations {
118
+ /** A DOCTYPE of any kind. A subset of only ELEMENT/ATTLIST/NOTATION is inert. */
119
+ hasDoctype: boolean;
120
+ /** An inline `<!ENTITY>` — the entity-expansion (billion-laughs) vector. */
121
+ hasEntityDecl: boolean;
122
+ /** An external DTD reference (SYSTEM/PUBLIC) — the XXE and SSRF vector. */
123
+ hasExternalId: boolean;
124
+ /**
125
+ * Set when the prologue could not be parsed to a root element, so the other fields are
126
+ * a lower bound rather than a complete answer. A boundary that treats absence of
127
+ * findings as "safe" must refuse this instead.
128
+ */
129
+ malformed: boolean;
130
+ }
131
+ /**
132
+ * Reports whether the input declares a DOCTYPE before its root element. A DOCTYPE is
133
+ * rejected outright rather than only its inline entities: an external DTD reference needs
134
+ * no `<!ENTITY>` of its own to be an XXE or entity-expansion vector.
135
+ */
136
+ export declare function containsXmlDoctype(input: string): boolean;
137
+ /**
138
+ * Reports what the input's prologue declares. The three facts are separate because they
139
+ * are three different attack surfaces, and which of them a given boundary refuses is a
140
+ * policy decision belonging to that boundary, not here. A document with no root element
141
+ * has no prologue to trust, and reports nothing.
142
+ *
143
+ * Kept in parity with Go's InspectXMLPrologue by testdata/xml-doctype-cases.json.
144
+ */
145
+ export declare function inspectXmlPrologue(input: string): XmlPrologueDeclarations;
146
+ /**
147
+ * Reports whether the input declares an entity before its root element — the
148
+ * billion-laughs shape.
149
+ */
150
+ export declare function containsXmlEntityDeclarations(input: string): boolean;
99
151
  export { findValuesByKey as findXmlValues };
100
152
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/xml/index.ts"],"mappings":";;;;;;;;;;;;;;;;;wBAuDgB,SACd,aACA,UAAU,QAAQ;EAAgB;IACjC;;;;;;;;;;;;;;;;;wBAsCa,SACd,KAAK,qCACL,UAAU,QAAQ;;;;;;;;;;;;;;;;;;;wBA6BJ,UAAU;;;;;;;wBAkBV,YAAY;wBAMZ,WAAW;;;;;;;;;;;;;;;;;wBAgCX,mBACd,aACA,qBACA,UAAU,QAAQ;EAAgB;IACjC;;;;;;;;;;;;;;wBAoCa,mBAAmB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/xml/index.ts"],"mappings":";;;;;;;;;;;;;;;;wBAuDgB,SACd,aACA,UAAU,QAAQ;EAAgB;IACjC;;;;;;;;;;;;;;;;;wBAsCa,SACd,KAAK,qCACL,UAAU,QAAQ;;;;;;;;;;;;;;;;;;;wBA6BJ,UAAU;;;;;;;wBAkBV,YAAY;wBAMZ,WAAW;;;;;;;;;;;;;;;;;wBAgCX,mBACd,aACA,qBACA,UAAU,QAAQ;EAAgB;IACjC;;;;;;;;;;;;;;wBAoCa,mBAAmB;;;;;;;;;;;;;;;;;;;;;iBA2DlB;;EAEf;;EAEA;;EAEA;;;;;;EAMA;;;;;;;wBA6Hc,mBAAmB;;;;;;;;;wBAYnB,mBAAmB,gBAAgB;;;;;wBAWnC,8BAA8B"}
package/dist/xml/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { findValuesByKey } from "../object/index.js";
2
2
  import { XMLBuilder, XMLParser, XMLValidator } from "fast-xml-parser";
3
- //#region src/xml/index.ts
3
+ // src/xml/index.ts
4
4
  /**
5
5
  * XML parsing utilities for HDF converters
6
6
  * Provides XML parsing with sensible defaults for security tool output
@@ -177,7 +177,133 @@ function extractTextRecursive(obj) {
177
177
  if (typeof obj === "object" && obj !== null) return Object.values(obj).map(extractTextRecursive).filter((text) => text.length > 0).join(" ");
178
178
  return "";
179
179
  }
180
- //#endregion
181
- export { buildXml, extractTextFromXml, findValuesByKey as findXmlValues, isValidXml, isXmlChar, parseXml, parseXmlWithArrays, xmlSafeText };
180
+ const isDtdNameChar = (c) => /[A-Za-z]/.test(c);
181
+ const isSpace = (c) => c === " " || c === " " || c === "\n" || c === "\r";
182
+ function scanInternalSubset(s) {
183
+ let hasEntity = false;
184
+ let hasExternalId = false;
185
+ let i = 0;
186
+ const fail = () => ({
187
+ end: 0,
188
+ hasEntity,
189
+ hasExternalId,
190
+ ok: false
191
+ });
192
+ while (i < s.length) {
193
+ const c = s[i];
194
+ if (c === "'" || c === "\"") {
195
+ i++;
196
+ while (i < s.length && s[i] !== c) i++;
197
+ if (i >= s.length) return fail();
198
+ i++;
199
+ } else if (s.startsWith("<!--", i)) {
200
+ const closeAt = s.indexOf("-->", i);
201
+ if (closeAt === -1) return fail();
202
+ i = closeAt + 3;
203
+ } else if (s.startsWith("<!", i)) {
204
+ let j = i + 2;
205
+ while (j < s.length && isDtdNameChar(s[j])) j++;
206
+ if (s.slice(i + 2, j).toUpperCase() === "ENTITY") hasEntity = true;
207
+ i = j;
208
+ } else if (c === "]") {
209
+ let j = i + 1;
210
+ while (j < s.length && isSpace(s[j])) j++;
211
+ if (j < s.length && s[j] === ">") return {
212
+ end: j + 1,
213
+ hasEntity,
214
+ hasExternalId,
215
+ ok: true
216
+ };
217
+ i++;
218
+ } else if (s.startsWith("SYSTEM", i) || s.startsWith("PUBLIC", i)) {
219
+ hasExternalId = true;
220
+ i += 6;
221
+ } else i++;
222
+ }
223
+ return fail();
224
+ }
225
+ function scanXmlPrologue(input) {
226
+ let hasDoctype = false;
227
+ let hasEntityDecl = false;
228
+ let hasExternalId = false;
229
+ const out = (foundRoot) => ({
230
+ hasDoctype,
231
+ hasEntityDecl,
232
+ hasExternalId,
233
+ malformed: false,
234
+ foundRoot
235
+ });
236
+ let i = 0;
237
+ for (;;) {
238
+ while (i < input.length && isSpace(input[i])) i++;
239
+ if (i >= input.length) return out(false);
240
+ const rest = input.slice(i);
241
+ if (rest.startsWith("<?")) {
242
+ const closeAt = rest.indexOf("?>");
243
+ if (closeAt === -1) return out(false);
244
+ i += closeAt + 2;
245
+ } else if (rest.startsWith("<!--")) {
246
+ const closeAt = rest.indexOf("-->");
247
+ if (closeAt === -1) return out(false);
248
+ i += closeAt + 3;
249
+ } else if (rest.slice(0, 9).toUpperCase() === "<!DOCTYPE") {
250
+ hasDoctype = true;
251
+ const open = rest.indexOf("[");
252
+ const gt = rest.indexOf(">");
253
+ if (gt === -1 && open === -1) return out(false);
254
+ if (open !== -1 && (gt === -1 || open < gt)) {
255
+ const head = rest.slice(0, open).toUpperCase();
256
+ if (head.includes("SYSTEM") || head.includes("PUBLIC")) hasExternalId = true;
257
+ const sub = scanInternalSubset(rest.slice(open + 1));
258
+ hasEntityDecl = hasEntityDecl || sub.hasEntity;
259
+ hasExternalId = hasExternalId || sub.hasExternalId;
260
+ if (!sub.ok) return out(false);
261
+ i += open + 1 + sub.end;
262
+ } else {
263
+ const head = rest.slice(0, gt).toUpperCase();
264
+ if (head.includes("SYSTEM") || head.includes("PUBLIC")) hasExternalId = true;
265
+ i += gt + 1;
266
+ }
267
+ } else if (rest.startsWith("<!")) {
268
+ const closeAt = rest.indexOf(">");
269
+ if (closeAt === -1) return out(false);
270
+ i += closeAt + 1;
271
+ } else if (rest.startsWith("<")) return out(true);
272
+ else return out(false);
273
+ }
274
+ }
275
+ /**
276
+ * Reports whether the input declares a DOCTYPE before its root element. A DOCTYPE is
277
+ * rejected outright rather than only its inline entities: an external DTD reference needs
278
+ * no `<!ENTITY>` of its own to be an XXE or entity-expansion vector.
279
+ */
280
+ function containsXmlDoctype(input) {
281
+ return inspectXmlPrologue(input).hasDoctype;
282
+ }
283
+ /**
284
+ * Reports what the input's prologue declares. The three facts are separate because they
285
+ * are three different attack surfaces, and which of them a given boundary refuses is a
286
+ * policy decision belonging to that boundary, not here. A document with no root element
287
+ * has no prologue to trust, and reports nothing.
288
+ *
289
+ * Kept in parity with Go's InspectXMLPrologue by testdata/xml-doctype-cases.json.
290
+ */
291
+ function inspectXmlPrologue(input) {
292
+ const { hasDoctype, hasEntityDecl, hasExternalId, foundRoot } = scanXmlPrologue(input);
293
+ return {
294
+ hasDoctype,
295
+ hasEntityDecl,
296
+ hasExternalId,
297
+ malformed: !foundRoot
298
+ };
299
+ }
300
+ /**
301
+ * Reports whether the input declares an entity before its root element — the
302
+ * billion-laughs shape.
303
+ */
304
+ function containsXmlEntityDeclarations(input) {
305
+ return inspectXmlPrologue(input).hasEntityDecl;
306
+ }
307
+ export { buildXml, containsXmlDoctype, containsXmlEntityDeclarations, extractTextFromXml, findValuesByKey as findXmlValues, inspectXmlPrologue, isValidXml, isXmlChar, parseXml, parseXmlWithArrays, xmlSafeText };
182
308
 
183
309
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["record"],"sources":["../../src/xml/index.ts"],"sourcesContent":["/**\n * XML parsing utilities for HDF converters\n * Provides XML parsing with sensible defaults for security tool output\n */\n\nimport { XMLParser, XMLBuilder, XMLValidator } from 'fast-xml-parser';\nimport type { X2jOptions, XmlBuilderOptions } from 'fast-xml-parser';\n\nexport { findValuesByKey as findXmlValues } from '../object/index.js';\n\n/**\n * Default options for XML parsing optimized for security tool converters.\n *\n * **XXE Safety**: fast-xml-parser v5.x does not process DTD or external entities\n * by default. The `processEntities: false` option is set as defense-in-depth to\n * ensure entity expansion is disabled even if future versions change defaults.\n * See: https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v5/2.XMLparseOptions.md\n */\nconst DEFAULT_PARSE_OPTIONS: Partial<X2jOptions> = {\n attributeNamePrefix: '',\n textNodeName: '#text',\n ignoreAttributes: false,\n ignoreDeclaration: true,\n parseAttributeValue: false,\n parseTagValue: false,\n removeNSPrefix: true,\n processEntities: false,\n};\n\n/**\n * Default options for XML building\n */\nconst DEFAULT_BUILD_OPTIONS: Partial<XmlBuilderOptions> = {\n attributeNamePrefix: '',\n textNodeName: '#text',\n ignoreAttributes: false,\n format: true,\n indentBy: ' ',\n suppressEmptyNode: false,\n};\n\n/**\n * Parse XML string to JavaScript object\n *\n * @param xml - XML string to parse\n * @param options - Optional parser configuration (merged with defaults)\n * @returns Parsed JavaScript object\n *\n * @example\n * ```typescript\n * const xmlString = '<root><item id=\"1\">Test</item></root>';\n * const result = parseXml(xmlString);\n * // Returns: { root: { item: { id: '1', '#text': 'Test' } } }\n * ```\n */\nexport function parseXml(\n xml: string,\n options?: Partial<X2jOptions> & { maxSize?: number }\n): Record<string, unknown> {\n if (options?.maxSize !== undefined && xml.length > options.maxSize) {\n throw new Error(\n `Input exceeds maximum allowed size: ${xml.length} bytes exceeds limit of ${options.maxSize} bytes`\n );\n }\n\n // Validate XML first\n const validation = XMLValidator.validate(xml);\n if (validation !== true) {\n throw new Error(`Invalid XML: ${validation.err.msg}`);\n }\n\n const mergedOptions = {\n ...DEFAULT_PARSE_OPTIONS,\n ...options,\n };\n\n const parser = new XMLParser(mergedOptions);\n return parser.parse(xml) as Record<string, unknown>;\n}\n\n/**\n * Build XML string from JavaScript object\n *\n * @param obj - JavaScript object to convert to XML, or a preserveOrder node list.\n * An array is only meaningful with `preserveOrder: true`; without it the builder\n * indexes the array and emits elements named by its numeric keys.\n * @param options - Optional builder configuration (merged with defaults)\n * @returns XML string\n *\n * @example\n * ```typescript\n * const obj = { root: { item: { id: '1', '#text': 'Test' } } };\n * const xml = buildXml(obj);\n * // Returns formatted XML string\n * ```\n */\nexport function buildXml(\n obj: Record<string, unknown> | unknown[],\n options?: Partial<XmlBuilderOptions>\n): string {\n const mergedOptions = {\n ...DEFAULT_BUILD_OPTIONS,\n ...options,\n };\n\n const builder = new XMLBuilder(mergedOptions);\n return builder.build(obj) as string;\n}\n\n/**\n * Validate if a string is well-formed XML\n *\n * @param xml - String to validate\n * @returns True if valid XML, false otherwise\n *\n * @example\n * ```typescript\n * isValidXml('<root><item>Test</item></root>'); // true\n * isValidXml('<root><item>Test</root>'); // false (mismatched tags)\n * isValidXml('not xml'); // false\n * ```\n */\n/**\n * Whether a character is legal in an XML 1.0 document, per the Char production.\n * The one home for this rule: an emitter deciding what to replace and a\n * validator deciding what to reject must not answer it differently.\n */\nexport function isXmlChar(ch: string): boolean {\n const c = ch.codePointAt(0) as number;\n return (\n c === 0x9 ||\n c === 0xa ||\n c === 0xd ||\n (c >= 0x20 && c <= 0xd7ff) ||\n (c >= 0xe000 && c <= 0xfffd) ||\n c >= 0x10000\n );\n}\n\n/**\n * Replace every character XML 1.0 forbids with U+FFFD, which is what Go's\n * encoding/xml does. XML defines no escape for these — a numeric reference to a\n * C0 control is itself illegal — so the choice is a replacement character or a\n * document no conforming parser will read.\n */\nexport function xmlSafeText(value: string): string {\n let out = '';\n for (const ch of value) out += isXmlChar(ch) ? ch : '\\ufffd';\n return out;\n}\n\nexport function isValidXml(xml: string): boolean {\n if (!xml || xml.trim().length === 0) {\n return false;\n }\n\n // The structural validator does not enforce XML 1.0's Char production, so it\n // called a document well-formed that no conforming parser will read — which is\n // how a converter emitting a raw ESC passed its own well-formedness check.\n for (const ch of xml) {\n if (!isXmlChar(ch)) return false;\n }\n\n const result = XMLValidator.validate(xml);\n return result === true;\n}\n\n/**\n * Parse XML with array handling for repeated elements\n * Forces specified tag names to always be arrays, even if only one element exists\n *\n * @param xml - XML string to parse\n * @param arrayTags - Array of tag names that should always be parsed as arrays\n * @returns Parsed JavaScript object with forced arrays\n *\n * @example\n * ```typescript\n * const xml = '<root><item>Test</item></root>';\n * const result = parseXmlWithArrays(xml, ['item']);\n * // Returns: { root: { item: ['Test'] } }\n * // Without arrayTags, would return: { root: { item: 'Test' } }\n * ```\n */\nexport function parseXmlWithArrays(\n xml: string,\n arrayTags: string[],\n options?: Partial<X2jOptions> & { maxSize?: number }\n): Record<string, unknown> {\n if (options?.maxSize !== undefined && xml.length > options.maxSize) {\n throw new Error(\n `Input exceeds maximum allowed size: ${xml.length} bytes exceeds limit of ${options.maxSize} bytes`\n );\n }\n\n // Validate XML first (consistency with parseXml)\n const validation = XMLValidator.validate(xml);\n if (validation !== true) {\n throw new Error(`Invalid XML: ${validation.err.msg}`);\n }\n\n const mergedOptions: Partial<X2jOptions> = {\n ...DEFAULT_PARSE_OPTIONS,\n ...options,\n isArray: (tagName: string) => arrayTags.includes(tagName),\n };\n\n const parser = new XMLParser(mergedOptions);\n return parser.parse(xml) as Record<string, unknown>;\n}\n\n/**\n * Extract text content from XML, stripping all tags\n *\n * @param xml - XML string\n * @returns Plain text content with tags removed\n *\n * @example\n * ```typescript\n * const xml = '<root><b>Bold</b> and <i>italic</i></root>';\n * const text = extractTextFromXml(xml);\n * // Returns: 'Bold and italic'\n * ```\n */\nexport function extractTextFromXml(xml: string): string {\n if (!isValidXml(xml)) {\n return '';\n }\n\n try {\n const parsed = parseXml(xml, { ignoreAttributes: true });\n return extractTextRecursive(parsed).trim();\n } catch {\n return '';\n }\n}\n\n/**\n * Recursively extract text from parsed XML object\n * @private\n */\nfunction extractTextRecursive(obj: unknown): string {\n if (typeof obj === 'string' || typeof obj === 'number') {\n return String(obj);\n }\n\n if (Array.isArray(obj)) {\n return obj.map(extractTextRecursive).join(' ');\n }\n\n if (typeof obj === 'object' && obj !== null) {\n const record = obj as Record<string, unknown>;\n\n // Recursively extract text from all properties\n return Object.values(record)\n .map(extractTextRecursive)\n .filter(text => text.length > 0)\n .join(' ');\n }\n\n return '';\n}\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,MAAM,wBAA6C;CACjD,qBAAqB;CACrB,cAAc;CACd,kBAAkB;CAClB,mBAAmB;CACnB,qBAAqB;CACrB,eAAe;CACf,gBAAgB;CAChB,iBAAiB;AACnB;;;;AAKA,MAAM,wBAAoD;CACxD,qBAAqB;CACrB,cAAc;CACd,kBAAkB;CAClB,QAAQ;CACR,UAAU;CACV,mBAAmB;AACrB;;;;;;;;;;;;;;;AAgBA,SAAgB,SACd,KACA,SACyB;CACzB,IAAI,SAAS,YAAY,KAAA,KAAa,IAAI,SAAS,QAAQ,SACzD,MAAM,IAAI,MACR,uCAAuC,IAAI,OAAO,0BAA0B,QAAQ,QAAQ,OAC9F;CAIF,MAAM,aAAa,aAAa,SAAS,GAAG;CAC5C,IAAI,eAAe,MACjB,MAAM,IAAI,MAAM,gBAAgB,WAAW,IAAI,KAAK;CAGtD,MAAM,gBAAgB;EACpB,GAAG;EACH,GAAG;CACL;CAGA,OAAO,IADY,UAAU,aACjB,CAAC,CAAC,MAAM,GAAG;AACzB;;;;;;;;;;;;;;;;;AAkBA,SAAgB,SACd,KACA,SACQ;CACR,MAAM,gBAAgB;EACpB,GAAG;EACH,GAAG;CACL;CAGA,OAAO,IADa,WAAW,aAClB,CAAC,CAAC,MAAM,GAAG;AAC1B;;;;;;;;;;;;;;;;;;;AAoBA,SAAgB,UAAU,IAAqB;CAC7C,MAAM,IAAI,GAAG,YAAY,CAAC;CAC1B,OACE,MAAM,KACN,MA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,CAAC,KAAK,GAAG;CAG/C,IAAI,OAAO,QAAQ,YAAY,QAAQ,MAIrC,OAAO,OAAO,OAAOA,GAAM,CAAC,CACzB,IAAI,oBAAoB,CAAC,CACzB,QAAO,SAAQ,KAAK,SAAS,CAAC,CAAC,CAC/B,KAAK,GAAG;CAGb,OAAO;AACT"}
1
+ {"version":3,"file":"index.js","names":["record"],"sources":["../../src/xml/index.ts"],"sourcesContent":["/**\n * XML parsing utilities for HDF converters\n * Provides XML parsing with sensible defaults for security tool output\n */\n\nimport { XMLParser, XMLBuilder, XMLValidator } from 'fast-xml-parser';\nimport type { X2jOptions, XmlBuilderOptions } from 'fast-xml-parser';\n\nexport { findValuesByKey as findXmlValues } from '../object/index.js';\n\n/**\n * Default options for XML parsing optimized for security tool converters.\n *\n * **XXE Safety**: fast-xml-parser v5.x does not process DTD or external entities\n * by default. The `processEntities: false` option is set as defense-in-depth to\n * ensure entity expansion is disabled even if future versions change defaults.\n * See: https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v5/2.XMLparseOptions.md\n */\nconst DEFAULT_PARSE_OPTIONS: Partial<X2jOptions> = {\n attributeNamePrefix: '',\n textNodeName: '#text',\n ignoreAttributes: false,\n ignoreDeclaration: true,\n parseAttributeValue: false,\n parseTagValue: false,\n removeNSPrefix: true,\n processEntities: false,\n};\n\n/**\n * Default options for XML building\n */\nconst DEFAULT_BUILD_OPTIONS: Partial<XmlBuilderOptions> = {\n attributeNamePrefix: '',\n textNodeName: '#text',\n ignoreAttributes: false,\n format: true,\n indentBy: ' ',\n suppressEmptyNode: false,\n};\n\n/**\n * Parse XML string to JavaScript object\n *\n * @param xml - XML string to parse\n * @param options - Optional parser configuration (merged with defaults)\n * @returns Parsed JavaScript object\n *\n * @example\n * ```typescript\n * const xmlString = '<root><item id=\"1\">Test</item></root>';\n * const result = parseXml(xmlString);\n * // Returns: { root: { item: { id: '1', '#text': 'Test' } } }\n * ```\n */\nexport function parseXml(\n xml: string,\n options?: Partial<X2jOptions> & { maxSize?: number }\n): Record<string, unknown> {\n if (options?.maxSize !== undefined && xml.length > options.maxSize) {\n throw new Error(\n `Input exceeds maximum allowed size: ${xml.length} bytes exceeds limit of ${options.maxSize} bytes`\n );\n }\n\n // Validate XML first\n const validation = XMLValidator.validate(xml);\n if (validation !== true) {\n throw new Error(`Invalid XML: ${validation.err.msg}`);\n }\n\n const mergedOptions = {\n ...DEFAULT_PARSE_OPTIONS,\n ...options,\n };\n\n const parser = new XMLParser(mergedOptions);\n return parser.parse(xml) as Record<string, unknown>;\n}\n\n/**\n * Build XML string from JavaScript object\n *\n * @param obj - JavaScript object to convert to XML, or a preserveOrder node list.\n * An array is only meaningful with `preserveOrder: true`; without it the builder\n * indexes the array and emits elements named by its numeric keys.\n * @param options - Optional builder configuration (merged with defaults)\n * @returns XML string\n *\n * @example\n * ```typescript\n * const obj = { root: { item: { id: '1', '#text': 'Test' } } };\n * const xml = buildXml(obj);\n * // Returns formatted XML string\n * ```\n */\nexport function buildXml(\n obj: Record<string, unknown> | unknown[],\n options?: Partial<XmlBuilderOptions>\n): string {\n const mergedOptions = {\n ...DEFAULT_BUILD_OPTIONS,\n ...options,\n };\n\n const builder = new XMLBuilder(mergedOptions);\n return builder.build(obj) as string;\n}\n\n/**\n * Validate if a string is well-formed XML\n *\n * @param xml - String to validate\n * @returns True if valid XML, false otherwise\n *\n * @example\n * ```typescript\n * isValidXml('<root><item>Test</item></root>'); // true\n * isValidXml('<root><item>Test</root>'); // false (mismatched tags)\n * isValidXml('not xml'); // false\n * ```\n */\n/**\n * Whether a character is legal in an XML 1.0 document, per the Char production.\n * The one home for this rule: an emitter deciding what to replace and a\n * validator deciding what to reject must not answer it differently.\n */\nexport function isXmlChar(ch: string): boolean {\n const c = ch.codePointAt(0) as number;\n return (\n c === 0x9 ||\n c === 0xa ||\n c === 0xd ||\n (c >= 0x20 && c <= 0xd7ff) ||\n (c >= 0xe000 && c <= 0xfffd) ||\n c >= 0x10000\n );\n}\n\n/**\n * Replace every character XML 1.0 forbids with U+FFFD, which is what Go's\n * encoding/xml does. XML defines no escape for these — a numeric reference to a\n * C0 control is itself illegal — so the choice is a replacement character or a\n * document no conforming parser will read.\n */\nexport function xmlSafeText(value: string): string {\n let out = '';\n for (const ch of value) out += isXmlChar(ch) ? ch : '\\ufffd';\n return out;\n}\n\nexport function isValidXml(xml: string): boolean {\n if (!xml || xml.trim().length === 0) {\n return false;\n }\n\n // The structural validator does not enforce XML 1.0's Char production, so it\n // called a document well-formed that no conforming parser will read — which is\n // how a converter emitting a raw ESC passed its own well-formedness check.\n for (const ch of xml) {\n if (!isXmlChar(ch)) return false;\n }\n\n const result = XMLValidator.validate(xml);\n return result === true;\n}\n\n/**\n * Parse XML with array handling for repeated elements\n * Forces specified tag names to always be arrays, even if only one element exists\n *\n * @param xml - XML string to parse\n * @param arrayTags - Array of tag names that should always be parsed as arrays\n * @returns Parsed JavaScript object with forced arrays\n *\n * @example\n * ```typescript\n * const xml = '<root><item>Test</item></root>';\n * const result = parseXmlWithArrays(xml, ['item']);\n * // Returns: { root: { item: ['Test'] } }\n * // Without arrayTags, would return: { root: { item: 'Test' } }\n * ```\n */\nexport function parseXmlWithArrays(\n xml: string,\n arrayTags: string[],\n options?: Partial<X2jOptions> & { maxSize?: number }\n): Record<string, unknown> {\n if (options?.maxSize !== undefined && xml.length > options.maxSize) {\n throw new Error(\n `Input exceeds maximum allowed size: ${xml.length} bytes exceeds limit of ${options.maxSize} bytes`\n );\n }\n\n // Validate XML first (consistency with parseXml)\n const validation = XMLValidator.validate(xml);\n if (validation !== true) {\n throw new Error(`Invalid XML: ${validation.err.msg}`);\n }\n\n const mergedOptions: Partial<X2jOptions> = {\n ...DEFAULT_PARSE_OPTIONS,\n ...options,\n isArray: (tagName: string) => arrayTags.includes(tagName),\n };\n\n const parser = new XMLParser(mergedOptions);\n return parser.parse(xml) as Record<string, unknown>;\n}\n\n/**\n * Extract text content from XML, stripping all tags\n *\n * @param xml - XML string\n * @returns Plain text content with tags removed\n *\n * @example\n * ```typescript\n * const xml = '<root><b>Bold</b> and <i>italic</i></root>';\n * const text = extractTextFromXml(xml);\n * // Returns: 'Bold and italic'\n * ```\n */\nexport function extractTextFromXml(xml: string): string {\n if (!isValidXml(xml)) {\n return '';\n }\n\n try {\n const parsed = parseXml(xml, { ignoreAttributes: true });\n return extractTextRecursive(parsed).trim();\n } catch {\n return '';\n }\n}\n\n/**\n * Recursively extract text from parsed XML object\n * @private\n */\nfunction extractTextRecursive(obj: unknown): string {\n if (typeof obj === 'string' || typeof obj === 'number') {\n return String(obj);\n }\n\n if (Array.isArray(obj)) {\n return obj.map(extractTextRecursive).join(' ');\n }\n\n if (typeof obj === 'object' && obj !== null) {\n const record = obj as Record<string, unknown>;\n\n // Recursively extract text from all properties\n return Object.values(record)\n .map(extractTextRecursive)\n .filter(text => text.length > 0)\n .join(' ');\n }\n\n return '';\n}\n\n/**\n * Walks the XML prologue — everything before the root element, the only region where a\n * DOCTYPE may legally appear — and reports which declarations it holds.\n *\n * It reports rather than returning the text to search, because the text would still\n * contain commented-out declarations: `<!-- <!DOCTYPE x> -->` is not a declaration, and\n * grepping a region that includes it cannot tell the difference.\n *\n * A fixed byte window cannot bound this region: the prologue may carry any amount of\n * comment and processing-instruction text, so a declaration can be pushed past any\n * constant. Walking to the root element has no such hole, and it is also what stops\n * declaration-shaped CONTENT from false-positiving — once the root is reached, nothing\n * after it is a declaration.\n *\n * An unterminated construct yields no root element, and so no prologue: there is nothing\n * a document that never opens an element can be said to have declared.\n *\n * Kept in parity with Go's scanXMLPrologue by testdata/xml-doctype-cases.json, which\n * both suites read.\n */\nexport interface XmlPrologueDeclarations {\n /** A DOCTYPE of any kind. A subset of only ELEMENT/ATTLIST/NOTATION is inert. */\n hasDoctype: boolean;\n /** An inline `<!ENTITY>` — the entity-expansion (billion-laughs) vector. */\n hasEntityDecl: boolean;\n /** An external DTD reference (SYSTEM/PUBLIC) — the XXE and SSRF vector. */\n hasExternalId: boolean;\n /**\n * Set when the prologue could not be parsed to a root element, so the other fields are\n * a lower bound rather than a complete answer. A boundary that treats absence of\n * findings as \"safe\" must refuse this instead.\n */\n malformed: boolean;\n}\n\nconst isDtdNameChar = (c: string): boolean => /[A-Za-z]/.test(c);\nconst isSpace = (c: string): boolean => c === ' ' || c === '\\t' || c === '\\n' || c === '\\r';\n\n/**\n * Walks a DTD internal subset from the character after `[`, reporting what it declares\n * plus the offset just past its closing `]>`.\n *\n * A state machine rather than a substring search because the subset's own EXTENT depends\n * on quoting: `<!ATTLIST l v CDATA \"]>\">` contains a `]>` inside a literal, and a scanner\n * that searches for the first `]>` ends the subset there, loses its place, and reports a\n * document with a later `<!ENTITY>` as clean. Comments hide the same way. Measured: that\n * evasion defeated the substring version of this function.\n */\ninterface SubsetScan {\n end: number;\n hasEntity: boolean;\n hasExternalId: boolean;\n ok: boolean;\n}\n\nfunction scanInternalSubset(s: string): SubsetScan {\n let hasEntity = false;\n let hasExternalId = false;\n let i = 0;\n const fail = (): SubsetScan => ({ end: 0, hasEntity, hasExternalId, ok: false });\n while (i < s.length) {\n const c = s[i] as string;\n if (c === \"'\" || c === '\"') {\n i++;\n while (i < s.length && s[i] !== c) i++;\n if (i >= s.length) return fail(); // unterminated literal\n i++;\n } else if (s.startsWith('<!--', i)) {\n const closeAt = s.indexOf('-->', i);\n if (closeAt === -1) return fail();\n i = closeAt + 3;\n } else if (s.startsWith('<!', i)) {\n let j = i + 2;\n while (j < s.length && isDtdNameChar(s[j] as string)) j++;\n if (s.slice(i + 2, j).toUpperCase() === 'ENTITY') hasEntity = true;\n i = j;\n } else if (c === ']') {\n let j = i + 1;\n while (j < s.length && isSpace(s[j] as string)) j++;\n if (j < s.length && s[j] === '>') return { end: j + 1, hasEntity, hasExternalId, ok: true };\n i++;\n } else if (s.startsWith('SYSTEM', i) || s.startsWith('PUBLIC', i)) {\n // Only counts outside literals and comments, where it is a keyword rather than\n // text. Conservative: any external reference in the subset counts.\n hasExternalId = true;\n i += 6;\n } else {\n i++;\n }\n }\n return fail(); // subset never closed\n}\n\ntype PrologueScan = XmlPrologueDeclarations & { foundRoot: boolean };\n\nfunction scanXmlPrologue(input: string): PrologueScan {\n let hasDoctype = false;\n let hasEntityDecl = false;\n let hasExternalId = false;\n const out = (foundRoot: boolean): PrologueScan => ({\n hasDoctype,\n hasEntityDecl,\n hasExternalId,\n malformed: false,\n foundRoot,\n });\n let i = 0;\n for (;;) {\n while (i < input.length && isSpace(input[i] as string)) i++;\n if (i >= input.length) return out(false);\n const rest = input.slice(i);\n if (rest.startsWith('<?')) {\n const closeAt = rest.indexOf('?>');\n if (closeAt === -1) return out(false);\n i += closeAt + 2;\n } else if (rest.startsWith('<!--')) {\n const closeAt = rest.indexOf('-->');\n if (closeAt === -1) return out(false);\n i += closeAt + 3; // skipped as a unit: its contents declare nothing\n } else if (rest.slice(0, 9).toUpperCase() === '<!DOCTYPE') {\n // Recorded the moment the token is seen, so this fact is sound no matter what the\n // rest of the declaration does. Everything below only ADDS detail.\n hasDoctype = true;\n const open = rest.indexOf('[');\n const gt = rest.indexOf('>');\n if (gt === -1 && open === -1) return out(false);\n if (open !== -1 && (gt === -1 || open < gt)) {\n const head = rest.slice(0, open).toUpperCase();\n if (head.includes('SYSTEM') || head.includes('PUBLIC')) hasExternalId = true;\n const sub = scanInternalSubset(rest.slice(open + 1));\n hasEntityDecl = hasEntityDecl || sub.hasEntity;\n hasExternalId = hasExternalId || sub.hasExternalId;\n if (!sub.ok) return out(false);\n i += open + 1 + sub.end;\n } else {\n const head = rest.slice(0, gt).toUpperCase();\n if (head.includes('SYSTEM') || head.includes('PUBLIC')) hasExternalId = true;\n i += gt + 1;\n }\n } else if (rest.startsWith('<!')) {\n const closeAt = rest.indexOf('>');\n if (closeAt === -1) return out(false);\n i += closeAt + 1;\n } else if (rest.startsWith('<')) {\n return out(true); // the root element\n } else {\n // Character data before any element: not well-formed, nothing to trust.\n return out(false);\n }\n }\n}\n\n/**\n * Reports whether the input declares a DOCTYPE before its root element. A DOCTYPE is\n * rejected outright rather than only its inline entities: an external DTD reference needs\n * no `<!ENTITY>` of its own to be an XXE or entity-expansion vector.\n */\nexport function containsXmlDoctype(input: string): boolean {\n return inspectXmlPrologue(input).hasDoctype;\n}\n\n/**\n * Reports what the input's prologue declares. The three facts are separate because they\n * are three different attack surfaces, and which of them a given boundary refuses is a\n * policy decision belonging to that boundary, not here. A document with no root element\n * has no prologue to trust, and reports nothing.\n *\n * Kept in parity with Go's InspectXMLPrologue by testdata/xml-doctype-cases.json.\n */\nexport function inspectXmlPrologue(input: string): XmlPrologueDeclarations {\n const { hasDoctype, hasEntityDecl, hasExternalId, foundRoot } = scanXmlPrologue(input);\n // Could not reach a root element: report what was seen and set malformed, so a gate\n // can tell \"nothing declared\" apart from \"could not tell\" and refuse the second.\n return { hasDoctype, hasEntityDecl, hasExternalId, malformed: !foundRoot };\n}\n\n/**\n * Reports whether the input declares an entity before its root element — the\n * billion-laughs shape.\n */\nexport function containsXmlEntityDeclarations(input: string): boolean {\n return inspectXmlPrologue(input).hasEntityDecl;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,MAAM,wBAA6C;CACjD,qBAAqB;CACrB,cAAc;CACd,kBAAkB;CAClB,mBAAmB;CACnB,qBAAqB;CACrB,eAAe;CACf,gBAAgB;CAChB,iBAAiB;AACnB;;;;AAKA,MAAM,wBAAoD;CACxD,qBAAqB;CACrB,cAAc;CACd,kBAAkB;CAClB,QAAQ;CACR,UAAU;CACV,mBAAmB;AACrB;;;;;;;;;;;;;;;AAgBA,SAAgB,SACd,KACA,SACyB;CACzB,IAAI,SAAS,YAAY,KAAA,KAAa,IAAI,SAAS,QAAQ,SACzD,MAAM,IAAI,MACR,uCAAuC,IAAI,OAAO,0BAA0B,QAAQ,QAAQ,OAC9F;CAIF,MAAM,aAAa,aAAa,SAAS,GAAG;CAC5C,IAAI,eAAe,MACjB,MAAM,IAAI,MAAM,gBAAgB,WAAW,IAAI,KAAK;CAGtD,MAAM,gBAAgB;E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"@mitre/hdf-utilities",
3
- "version": "3.7.2",
3
+ "version": "3.8.0-next.42533588944.1",
4
4
  "description": "Utility functions for HDF libraries (JSON parsing, validation helpers)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-i4P63h9e.d.ts","names":[],"sources":["../src/json/canonical.ts","../src/json/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;iBAkIgB,cAAc;;iBAKR,kBAAkB,iBAAiB;;;;;;UCjIxC;;EAEf;;EAEA;;;;;;;;iBASc,UAAU,aAAa,gBAAgB;;;;;;;;iBAuBvC,cAAc,gBAAgB,UAAS;;;;;;iBAkBvC,YAAY;;;;;;;;;;;;;;;;;;;;iBAoCZ,iBAAiB"}