@patrickdk77/office-defuse 0.1.0 → 0.2.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.
Files changed (88) hide show
  1. package/README.md +278 -36
  2. package/dist/biff.d.ts +62 -0
  3. package/dist/biff.js +95 -0
  4. package/dist/cfb-writer.d.ts +25 -0
  5. package/dist/cfb-writer.js +314 -0
  6. package/dist/cfb.d.ts +58 -0
  7. package/dist/cfb.js +456 -0
  8. package/dist/cli.d.ts +2 -0
  9. package/dist/cli.js +357 -0
  10. package/dist/contained.d.ts +46 -0
  11. package/dist/contained.js +152 -0
  12. package/dist/context.d.ts +140 -17
  13. package/dist/context.js +135 -37
  14. package/dist/crc32.d.ts +8 -2
  15. package/dist/crc32.js +44 -4
  16. package/dist/engine.d.ts +12 -1
  17. package/dist/engine.js +336 -42
  18. package/dist/errors.d.ts +17 -0
  19. package/dist/errors.js +27 -1
  20. package/dist/fields.d.ts +36 -0
  21. package/dist/fields.js +139 -0
  22. package/dist/findings.d.ts +2 -1
  23. package/dist/findings.js +44 -9
  24. package/dist/flat.d.ts +33 -0
  25. package/dist/flat.js +486 -0
  26. package/dist/formats.d.ts +7 -0
  27. package/dist/formats.js +5 -1
  28. package/dist/formulas.d.ts +27 -0
  29. package/dist/formulas.js +157 -1
  30. package/dist/index.d.ts +3 -2
  31. package/dist/index.js +8 -1
  32. package/dist/index.mjs +1 -1
  33. package/dist/io.d.ts +62 -1
  34. package/dist/io.js +245 -1
  35. package/dist/links.d.ts +27 -0
  36. package/dist/links.js +106 -1
  37. package/dist/msg.d.ts +8 -0
  38. package/dist/msg.js +251 -0
  39. package/dist/objects.d.ts +45 -0
  40. package/dist/objects.js +204 -0
  41. package/dist/odf.d.ts +66 -2
  42. package/dist/odf.js +181 -64
  43. package/dist/offcrypto.d.ts +54 -0
  44. package/dist/offcrypto.js +647 -0
  45. package/dist/ole.d.ts +12 -0
  46. package/dist/ole.js +139 -0
  47. package/dist/oleobj.d.ts +85 -0
  48. package/dist/oleobj.js +215 -0
  49. package/dist/ooxml.d.ts +83 -2
  50. package/dist/ooxml.js +358 -145
  51. package/dist/package.d.ts +3 -0
  52. package/dist/package.js +21 -0
  53. package/dist/plan.d.ts +104 -0
  54. package/dist/plan.js +73 -0
  55. package/dist/plugins.d.ts +8 -0
  56. package/dist/plugins.js +60 -0
  57. package/dist/ppt.d.ts +8 -0
  58. package/dist/ppt.js +281 -0
  59. package/dist/rewrite-cfb.d.ts +14 -0
  60. package/dist/rewrite-cfb.js +52 -0
  61. package/dist/rewrite-rtf.d.ts +9 -0
  62. package/dist/rewrite-rtf.js +45 -0
  63. package/dist/rewrite-xml.d.ts +36 -0
  64. package/dist/rewrite-xml.js +341 -0
  65. package/dist/rewrite-zip.d.ts +8 -0
  66. package/dist/rewrite-zip.js +498 -0
  67. package/dist/rtf.d.ts +8 -0
  68. package/dist/rtf.js +712 -0
  69. package/dist/rtfcomp.d.ts +7 -0
  70. package/dist/rtfcomp.js +80 -0
  71. package/dist/score.js +1 -1
  72. package/dist/sniff.d.ts +5 -0
  73. package/dist/sniff.js +38 -0
  74. package/dist/types.d.ts +66 -2
  75. package/dist/types.js +33 -0
  76. package/dist/vsd.d.ts +13 -0
  77. package/dist/vsd.js +689 -0
  78. package/dist/word.d.ts +9 -0
  79. package/dist/word.js +194 -0
  80. package/dist/xls.d.ts +27 -0
  81. package/dist/xls.js +208 -0
  82. package/dist/xml.d.ts +30 -0
  83. package/dist/xml.js +45 -23
  84. package/dist/zip-writer.d.ts +4 -0
  85. package/dist/zip-writer.js +20 -7
  86. package/dist/zip.d.ts +9 -2
  87. package/dist/zip.js +61 -4
  88. package/package.json +6 -3
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Decompresses an Outlook message's PidTagRtfCompressed (MS-OXRTFCP 2.1.3.1). Returns undefined for input the
3
+ * specification calls corrupt: cut short, of an unknown type, with a CRC that does not match, or longer than `limit`.
4
+ */
5
+ export declare function decompressRtf(b: Uint8Array, limit: number): Uint8Array | undefined;
6
+ /** RTF stored as a PidTagRtfCompressed value of type UNCOMPRESSED, whose CRC is 0 (MS-OXRTFCP 2.1.3.1.1). */
7
+ export declare function storeRtf(rtf: Uint8Array): Uint8Array;
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.decompressRtf = decompressRtf;
4
+ exports.storeRtf = storeRtf;
5
+ const crc32_1 = require("./crc32");
6
+ /** The dictionary MS-OXRTFCP 2.1.3.1.2 starts from: 207 bytes of RTF that most bodies begin with. */
7
+ const PRESET = Buffer.from('{\\rtf1\\ansi\\mac\\deff0\\deftab720{\\fonttbl;}{\\f0\\fnil \\froman \\fswiss \\fmodern \\fscript \\fdecor MS Sans SerifSymbolArialTimes New RomanCourier{\\colortbl\\red0\\green0\\blue0\r\n\\par \\pard\\plain\\f0\\fs20\\b\\i\\u\\tab\\tx', 'latin1');
8
+ /** COMPTYPE: LZFu for compressed, MELA for stored. */
9
+ const COMPRESSED = 0x75465a4c;
10
+ const UNCOMPRESSED = 0x414c454d;
11
+ /**
12
+ * The CRC of MS-OXRTFCP 2.1.3.2: CRC-32's table, started at 0 and never inverted. zlib's CRC-32 inverts the value it
13
+ * starts from and the value it ends with, so starting it from all ones and inverting its result gives this one.
14
+ */
15
+ const rtfCrc = (b) => ~(0, crc32_1.crc32)(b, 0xffffffff) >>> 0;
16
+ /**
17
+ * Decompresses an Outlook message's PidTagRtfCompressed (MS-OXRTFCP 2.1.3.1). Returns undefined for input the
18
+ * specification calls corrupt: cut short, of an unknown type, with a CRC that does not match, or longer than `limit`.
19
+ */
20
+ function decompressRtf(b, limit) {
21
+ if (b.length < 16)
22
+ return undefined;
23
+ const view = Buffer.from(b.buffer, b.byteOffset, b.byteLength);
24
+ const compSize = view.readUInt32LE(0);
25
+ const rawSize = view.readUInt32LE(4);
26
+ const type = view.readUInt32LE(8);
27
+ const crc = view.readUInt32LE(12);
28
+ if (compSize < 12 || compSize + 4 > b.length || rawSize > limit)
29
+ return undefined;
30
+ const contents = view.subarray(16, 4 + compSize);
31
+ if (type === UNCOMPRESSED)
32
+ return contents.subarray(0, rawSize);
33
+ if (type !== COMPRESSED || rtfCrc(contents) !== crc)
34
+ return undefined;
35
+ const dict = Buffer.alloc(4096);
36
+ PRESET.copy(dict);
37
+ let write = PRESET.length;
38
+ const out = Buffer.alloc(rawSize);
39
+ let n = 0;
40
+ let at = 0;
41
+ while (at < contents.length) {
42
+ const control = contents[at++];
43
+ for (let bit = 0; bit < 8; bit++) {
44
+ if ((control & (1 << bit)) === 0) {
45
+ if (at >= contents.length)
46
+ return undefined;
47
+ const c = contents[at++];
48
+ if (n < rawSize)
49
+ out[n++] = c;
50
+ dict[write] = c;
51
+ write = (write + 1) & 4095;
52
+ continue;
53
+ }
54
+ if (at + 2 > contents.length)
55
+ return undefined;
56
+ const ref = (contents[at] << 8) | contents[at + 1];
57
+ at += 2;
58
+ let read = ref >> 4;
59
+ if (read === write)
60
+ return out.subarray(0, n);
61
+ for (let k = (ref & 0x0f) + 2; k > 0; k--) {
62
+ const c = dict[read];
63
+ read = (read + 1) & 4095;
64
+ if (n < rawSize)
65
+ out[n++] = c;
66
+ dict[write] = c;
67
+ write = (write + 1) & 4095;
68
+ }
69
+ }
70
+ }
71
+ return undefined;
72
+ }
73
+ /** RTF stored as a PidTagRtfCompressed value of type UNCOMPRESSED, whose CRC is 0 (MS-OXRTFCP 2.1.3.1.1). */
74
+ function storeRtf(rtf) {
75
+ const head = Buffer.alloc(16);
76
+ head.writeUInt32LE(rtf.length + 12, 0);
77
+ head.writeUInt32LE(rtf.length, 4);
78
+ head.writeUInt32LE(UNCOMPRESSED, 8);
79
+ return Buffer.concat([head, rtf]);
80
+ }
package/dist/score.js CHANGED
@@ -19,7 +19,7 @@ exports.COMBINATIONS = [
19
19
  {
20
20
  name: 'code with data hidden in the archive',
21
21
  weight: 10,
22
- test: has => runsCode(has) && (has(types_1.OfficeCategory.Container, types_1.OfficeDetail.LeadingBytes) || has(types_1.OfficeCategory.Container, types_1.OfficeDetail.HiddenData) || has(types_1.OfficeCategory.Container, types_1.OfficeDetail.TrailingBytes)),
22
+ test: has => runsCode(has) && (has(types_1.OfficeCategory.Container, types_1.OfficeDetail.LeadingBytes) || has(types_1.OfficeCategory.Container, types_1.OfficeDetail.HiddenData) || has(types_1.OfficeCategory.Container, types_1.OfficeDetail.HiddenEntry) || has(types_1.OfficeCategory.Container, types_1.OfficeDetail.TrailingBytes)),
23
23
  },
24
24
  ];
25
25
  /** The caller's weights first, then the built-in table. A kind from another package scores at the weight it carries. */
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Identifies a file type from its first bytes, with the MIME types pdf-defuse gives, so plugins of the family see one
3
+ * name for each type. Returns a MIME type or undefined.
4
+ */
5
+ export declare function sniffType(head: Uint8Array): string | undefined;
package/dist/sniff.js ADDED
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sniffType = sniffType;
4
+ /**
5
+ * Identifies a file type from its first bytes, with the MIME types pdf-defuse gives, so plugins of the family see one
6
+ * name for each type. Returns a MIME type or undefined.
7
+ */
8
+ function sniffType(head) {
9
+ const b = Buffer.from(head.buffer, head.byteOffset, head.byteLength);
10
+ // PDF readers accept the header anywhere in the first 1024 bytes.
11
+ const s = b.subarray(0, 1024).toString('latin1');
12
+ if (s.includes('%PDF-'))
13
+ return 'application/pdf';
14
+ if (b[0] === 0x50 && b[1] === 0x4b && (b[2] === 0x03 || b[2] === 0x05 || b[2] === 0x07))
15
+ return 'application/zip';
16
+ if (b[0] === 0x89 && s.startsWith('\x89PNG'))
17
+ return 'image/png';
18
+ if (b[0] === 0xff && b[1] === 0xd8 && b[2] === 0xff)
19
+ return 'image/jpeg';
20
+ if (s.startsWith('GIF87a') || s.startsWith('GIF89a'))
21
+ return 'image/gif';
22
+ if (b[0] === 0xd0 && b[1] === 0xcf && b[2] === 0x11 && b[3] === 0xe0)
23
+ return 'application/x-ole-storage';
24
+ if (s.startsWith('{\\rt'))
25
+ return 'application/rtf';
26
+ if (s.startsWith('MZ'))
27
+ return 'application/x-msdownload';
28
+ if (s.startsWith('\x7fELF'))
29
+ return 'application/x-executable';
30
+ const text = s.replace(/^\xef\xbb\xbf/, '').trimStart();
31
+ if (/^<svg[\s>/]/i.test(text) || (/^<\?xml/i.test(text) && /<svg[\s>/]/i.test(s)))
32
+ return 'image/svg+xml';
33
+ if (/^<\?xml/i.test(text))
34
+ return 'application/xml';
35
+ if (/^<!doctype html|^<html[\s>]/i.test(text))
36
+ return 'text/html';
37
+ return undefined;
38
+ }
package/dist/types.d.ts CHANGED
@@ -13,7 +13,8 @@ export declare enum OfficeCategory {
13
13
  External = "EXTERNAL",
14
14
  Link = "LINK",
15
15
  Embedded = "EMBEDDED",
16
- Control = "CONTROL"
16
+ Control = "CONTROL",
17
+ Processing = "PROCESSING"
17
18
  }
18
19
  /** Exact variant of a finding. Some details appear under more than one category. */
19
20
  export declare enum OfficeDetail {
@@ -34,7 +35,13 @@ export declare enum OfficeDetail {
34
35
  DataError = "DATA_ERROR",
35
36
  LeadingBytes = "LEADING_BYTES",
36
37
  HiddenData = "HIDDEN_DATA",
38
+ HiddenEntry = "HIDDEN_ENTRY",
37
39
  TrailingBytes = "TRAILING_BYTES",
40
+ BadHeader = "BAD_HEADER",
41
+ BrokenChain = "BROKEN_CHAIN",
42
+ ChainLoop = "CHAIN_LOOP",
43
+ DirectoryLoop = "DIRECTORY_LOOP",
44
+ BadEntry = "BAD_ENTRY",
38
45
  Doctype = "DOCTYPE",
39
46
  InternalSubset = "INTERNAL_SUBSET",
40
47
  ExternalEntity = "EXTERNAL_ENTITY",
@@ -49,17 +56,31 @@ export declare enum OfficeDetail {
49
56
  XmlEntityDepth = "XML_ENTITY_DEPTH",
50
57
  XmlEntityExpansions = "XML_ENTITY_EXPANSIONS",
51
58
  XmlEntitySize = "XML_ENTITY_SIZE",
59
+ RtfDepth = "RTF_DEPTH",
60
+ NestingDepth = "NESTING_DEPTH",
52
61
  Time = "TIME",
53
62
  Unrecognized = "UNRECOGNIZED",
54
63
  AmbiguousFormat = "AMBIGUOUS_FORMAT",
55
64
  Unreadable = "UNREADABLE",
65
+ UnreadableBody = "UNREADABLE_BODY",
56
66
  DuplicateEntry = "DUPLICATE_ENTRY",
57
67
  UntypedPart = "UNTYPED_PART",
58
68
  UnreferencedPart = "UNREFERENCED_PART",
59
69
  OdfLayout = "ODF_LAYOUT",
60
70
  PasswordRequired = "PASSWORD_REQUIRED",
71
+ DefaultPassword = "DEFAULT_PASSWORD",
72
+ UserPassword = "USER_PASSWORD",
73
+ Rc4_40 = "RC4_40",
74
+ Rc4_128 = "RC4_128",
75
+ Rc4Other = "RC4_OTHER",
76
+ Aes128 = "AES_128",
77
+ Aes192 = "AES_192",
78
+ Aes256 = "AES_256",
79
+ UnsupportedAlgorithm = "UNSUPPORTED_ALGORITHM",
80
+ XorObfuscation = "XOR_OBFUSCATION",
61
81
  VbaProject = "VBA_PROJECT",
62
82
  XlmMacrosheet = "XLM_MACROSHEET",
83
+ WordBasic = "WORDBASIC",
63
84
  OdfBasic = "ODF_BASIC",
64
85
  OdfScripts = "ODF_SCRIPTS",
65
86
  OdfDialogs = "ODF_DIALOGS",
@@ -70,7 +91,9 @@ export declare enum OfficeDetail {
70
91
  Callback = "CALLBACK",
71
92
  OdfConfiguration = "ODF_CONFIGURATION",
72
93
  RunProgram = "RUN_PROGRAM",
94
+ SubmitForm = "SUBMIT_FORM",
73
95
  OleVerb = "OLE_VERB",
96
+ ObjectUpdate = "OBJECT_UPDATE",
74
97
  Field = "FIELD",
75
98
  Formula = "FORMULA",
76
99
  Macrobutton = "MACROBUTTON",
@@ -83,6 +106,7 @@ export declare enum OfficeDetail {
83
106
  Workbook = "WORKBOOK",
84
107
  Reload = "RELOAD",
85
108
  Other = "OTHER",
109
+ DataConnection = "DATA_CONNECTION",
86
110
  LocalFile = "LOCAL_FILE",
87
111
  Safe = "SAFE",
88
112
  FileUrl = "FILE_URL",
@@ -95,12 +119,20 @@ export declare enum OfficeDetail {
95
119
  LookalikeHost = "LOOKALIKE_HOST",
96
120
  EncodedHost = "ENCODED_HOST",
97
121
  Relative = "RELATIVE",
122
+ TextMismatch = "TEXT_MISMATCH",
98
123
  OleObject = "OLE_OBJECT",
99
124
  Package = "PACKAGE",
100
125
  OleFile = "OLE_FILE",
101
126
  Applet = "APPLET",
102
127
  Plugin = "PLUGIN",
103
- ActiveX = "ACTIVEX"
128
+ Equation = "EQUATION",
129
+ Attachment = "ATTACHMENT",
130
+ PluginPassed = "PLUGIN_PASSED",
131
+ PluginScrubbed = "PLUGIN_SCRUBBED",
132
+ PluginFailed = "PLUGIN_FAILED",
133
+ PluginRemoved = "PLUGIN_REMOVED",
134
+ ActiveX = "ACTIVEX",
135
+ VerificationFailed = "VERIFICATION_FAILED"
104
136
  }
105
137
  export type OfficeFindingAction = 'reject' | 'strip' | 'info';
106
138
  /**
@@ -151,6 +183,15 @@ export interface OfficeInspection {
151
183
  /** The MIME type of a file in that format. '' when not recognized. */
152
184
  mimeType: string;
153
185
  }
186
+ export interface OfficeDisarmResult {
187
+ status: 'clean' | 'defused' | 'rejected';
188
+ /** The uploaded file and its score. */
189
+ before: OfficeInspection;
190
+ /** The output and its remaining score. Absent when rejected. */
191
+ after?: OfficeInspection;
192
+ /** Findings whose content was removed. */
193
+ removed: DefuseFinding[];
194
+ }
154
195
  /** Random-access input. A buffer, a local file and an S3 ranged GetObject all fit. */
155
196
  export interface ByteSource {
156
197
  size(): Promise<number>;
@@ -183,6 +224,13 @@ export interface OfficeLimits {
183
224
  xmlEntityExpansions?: number;
184
225
  /** Characters of entity text expanded in the whole run. Default 16 Mi. */
185
226
  xmlEntitySize?: number;
227
+ /** Group nesting in an RTF file, and destinations open at once. Default 256. */
228
+ rtfDepth?: number;
229
+ /**
230
+ * The deepest a file may sit in the upload. The upload is at depth 0 and a file inside it at 1, and files of every
231
+ * format in between count. Not enforced unless set.
232
+ */
233
+ nestingDepth?: number;
186
234
  /** Milliseconds for the whole run. Not enforced unless set. */
187
235
  timeMs?: number;
188
236
  }
@@ -240,8 +288,24 @@ export interface OfficeScoreBands {
240
288
  critical: number;
241
289
  }
242
290
  export interface OfficeOptions {
291
+ /**
292
+ * One password or a list, tried in order on an encrypted file: an encrypted OOXML package, or an .xls workbook.
293
+ * VelvetSweatshop, the password Excel opens a workbook with by default, comes after them. Pass passwords in code,
294
+ * never on a command line, where other users can read them.
295
+ */
296
+ password?: string | string[];
243
297
  limits?: OfficeLimits;
244
298
  actionOverrides?: OfficeActionOverride[];
245
299
  scoreWeights?: OfficeScoreWeight[];
246
300
  scoreBands?: OfficeScoreBands;
301
+ /** Plugins that decide about the files inside the file: embedded objects and packages, OLE parts and attachments. */
302
+ filePlugins?: ContainedFilePlugin[];
303
+ /** Directory for temporary files. Defaults to os.tmpdir(). */
304
+ tempDir?: string;
305
+ /**
306
+ * Default 8 MiB. disarmOfficeSource keeps its copy of the upload and its output in memory up to this size and in a
307
+ * temporary file above it. Each file inside that goes to a plugin does the same, and the copies plugins return,
308
+ * which wait for the output to be written, share this much memory.
309
+ */
310
+ memoryThreshold?: number;
247
311
  }
package/dist/types.js CHANGED
@@ -18,6 +18,7 @@ var OfficeCategory;
18
18
  OfficeCategory["Link"] = "LINK";
19
19
  OfficeCategory["Embedded"] = "EMBEDDED";
20
20
  OfficeCategory["Control"] = "CONTROL";
21
+ OfficeCategory["Processing"] = "PROCESSING";
21
22
  })(OfficeCategory || (exports.OfficeCategory = OfficeCategory = {}));
22
23
  /** Exact variant of a finding. Some details appear under more than one category. */
23
24
  var OfficeDetail;
@@ -40,7 +41,13 @@ var OfficeDetail;
40
41
  OfficeDetail["DataError"] = "DATA_ERROR";
41
42
  OfficeDetail["LeadingBytes"] = "LEADING_BYTES";
42
43
  OfficeDetail["HiddenData"] = "HIDDEN_DATA";
44
+ OfficeDetail["HiddenEntry"] = "HIDDEN_ENTRY";
43
45
  OfficeDetail["TrailingBytes"] = "TRAILING_BYTES";
46
+ OfficeDetail["BadHeader"] = "BAD_HEADER";
47
+ OfficeDetail["BrokenChain"] = "BROKEN_CHAIN";
48
+ OfficeDetail["ChainLoop"] = "CHAIN_LOOP";
49
+ OfficeDetail["DirectoryLoop"] = "DIRECTORY_LOOP";
50
+ OfficeDetail["BadEntry"] = "BAD_ENTRY";
44
51
  // XML
45
52
  OfficeDetail["Doctype"] = "DOCTYPE";
46
53
  OfficeDetail["InternalSubset"] = "INTERNAL_SUBSET";
@@ -57,20 +64,34 @@ var OfficeDetail;
57
64
  OfficeDetail["XmlEntityDepth"] = "XML_ENTITY_DEPTH";
58
65
  OfficeDetail["XmlEntityExpansions"] = "XML_ENTITY_EXPANSIONS";
59
66
  OfficeDetail["XmlEntitySize"] = "XML_ENTITY_SIZE";
67
+ OfficeDetail["RtfDepth"] = "RTF_DEPTH";
68
+ OfficeDetail["NestingDepth"] = "NESTING_DEPTH";
60
69
  OfficeDetail["Time"] = "TIME";
61
70
  // PACKAGE
62
71
  OfficeDetail["Unrecognized"] = "UNRECOGNIZED";
63
72
  OfficeDetail["AmbiguousFormat"] = "AMBIGUOUS_FORMAT";
64
73
  OfficeDetail["Unreadable"] = "UNREADABLE";
74
+ OfficeDetail["UnreadableBody"] = "UNREADABLE_BODY";
65
75
  OfficeDetail["DuplicateEntry"] = "DUPLICATE_ENTRY";
66
76
  OfficeDetail["UntypedPart"] = "UNTYPED_PART";
67
77
  OfficeDetail["UnreferencedPart"] = "UNREFERENCED_PART";
68
78
  OfficeDetail["OdfLayout"] = "ODF_LAYOUT";
69
79
  // ENCRYPTED
70
80
  OfficeDetail["PasswordRequired"] = "PASSWORD_REQUIRED";
81
+ OfficeDetail["DefaultPassword"] = "DEFAULT_PASSWORD";
82
+ OfficeDetail["UserPassword"] = "USER_PASSWORD";
83
+ OfficeDetail["Rc4_40"] = "RC4_40";
84
+ OfficeDetail["Rc4_128"] = "RC4_128";
85
+ OfficeDetail["Rc4Other"] = "RC4_OTHER";
86
+ OfficeDetail["Aes128"] = "AES_128";
87
+ OfficeDetail["Aes192"] = "AES_192";
88
+ OfficeDetail["Aes256"] = "AES_256";
89
+ OfficeDetail["UnsupportedAlgorithm"] = "UNSUPPORTED_ALGORITHM";
90
+ OfficeDetail["XorObfuscation"] = "XOR_OBFUSCATION";
71
91
  // MACRO
72
92
  OfficeDetail["VbaProject"] = "VBA_PROJECT";
73
93
  OfficeDetail["XlmMacrosheet"] = "XLM_MACROSHEET";
94
+ OfficeDetail["WordBasic"] = "WORDBASIC";
74
95
  OfficeDetail["OdfBasic"] = "ODF_BASIC";
75
96
  OfficeDetail["OdfScripts"] = "ODF_SCRIPTS";
76
97
  OfficeDetail["OdfDialogs"] = "ODF_DIALOGS";
@@ -83,7 +104,9 @@ var OfficeDetail;
83
104
  OfficeDetail["OdfConfiguration"] = "ODF_CONFIGURATION";
84
105
  // ACTION
85
106
  OfficeDetail["RunProgram"] = "RUN_PROGRAM";
107
+ OfficeDetail["SubmitForm"] = "SUBMIT_FORM";
86
108
  OfficeDetail["OleVerb"] = "OLE_VERB";
109
+ OfficeDetail["ObjectUpdate"] = "OBJECT_UPDATE";
87
110
  // DDE
88
111
  OfficeDetail["Field"] = "FIELD";
89
112
  OfficeDetail["Formula"] = "FORMULA";
@@ -99,6 +122,7 @@ var OfficeDetail;
99
122
  OfficeDetail["Workbook"] = "WORKBOOK";
100
123
  OfficeDetail["Reload"] = "RELOAD";
101
124
  OfficeDetail["Other"] = "OTHER";
125
+ OfficeDetail["DataConnection"] = "DATA_CONNECTION";
102
126
  OfficeDetail["LocalFile"] = "LOCAL_FILE";
103
127
  // LINK
104
128
  OfficeDetail["Safe"] = "SAFE";
@@ -112,14 +136,23 @@ var OfficeDetail;
112
136
  OfficeDetail["LookalikeHost"] = "LOOKALIKE_HOST";
113
137
  OfficeDetail["EncodedHost"] = "ENCODED_HOST";
114
138
  OfficeDetail["Relative"] = "RELATIVE";
139
+ OfficeDetail["TextMismatch"] = "TEXT_MISMATCH";
115
140
  // EMBEDDED
116
141
  OfficeDetail["OleObject"] = "OLE_OBJECT";
117
142
  OfficeDetail["Package"] = "PACKAGE";
118
143
  OfficeDetail["OleFile"] = "OLE_FILE";
119
144
  OfficeDetail["Applet"] = "APPLET";
120
145
  OfficeDetail["Plugin"] = "PLUGIN";
146
+ OfficeDetail["Equation"] = "EQUATION";
147
+ OfficeDetail["Attachment"] = "ATTACHMENT";
148
+ OfficeDetail["PluginPassed"] = "PLUGIN_PASSED";
149
+ OfficeDetail["PluginScrubbed"] = "PLUGIN_SCRUBBED";
150
+ OfficeDetail["PluginFailed"] = "PLUGIN_FAILED";
151
+ OfficeDetail["PluginRemoved"] = "PLUGIN_REMOVED";
121
152
  // CONTROL
122
153
  OfficeDetail["ActiveX"] = "ACTIVEX";
154
+ // PROCESSING
155
+ OfficeDetail["VerificationFailed"] = "VERIFICATION_FAILED";
123
156
  })(OfficeDetail || (exports.OfficeDetail = OfficeDetail = {}));
124
157
  var OfficeRisk;
125
158
  (function (OfficeRisk) {
package/dist/vsd.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import type { CfbEntry, CompoundFile } from './cfb';
2
+ import { type RunContext } from './context';
3
+ /**
4
+ * Reads the ShapeSheet cells of a Visio 2000 to 2010 drawing for formulas that call RUNADDON, RUNADDONWARGS,
5
+ * CALLTHIS, RUNMACRO, OPENFILE or DOOLEVERB. Other versions of the stream go unread. A stream whose structure does
6
+ * not read stops the run as PACKAGE/UNREADABLE.
7
+ */
8
+ export declare function visioRules(ctx: RunContext, cfb: CompoundFile, stream: CfbEntry): Promise<void>;
9
+ /**
10
+ * The LZ77 compression of Visio streams (VSDInternalStream.cpp): a flag byte for each eight items, a set bit for a
11
+ * literal byte and a clear one for a 2-byte back reference into a 4,096-byte window. Output past `limit` stops the run.
12
+ */
13
+ export declare function inflate(src: Uint8Array, limit: number): Uint8Array;