@profullstack/threatcrush 0.6.0 → 0.6.2

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/dist/index.js CHANGED
@@ -11256,7 +11256,15 @@ function meetsFailThreshold(findings, threshold) {
11256
11256
  }
11257
11257
 
11258
11258
  // src/scan/sarif.ts
11259
+ var import_node_crypto = require("crypto");
11259
11260
  var import_node_path4 = require("path");
11261
+ var FINGERPRINT_KEY = "threatcrush/contentHash/v1";
11262
+ function fingerprintOf(finding) {
11263
+ const content = finding.excerpt.replace(/\s+/g, " ").trim();
11264
+ return (0, import_node_crypto.createHash)("sha256").update(`${finding.ruleId}
11265
+ ${finding.file}
11266
+ ${content}`).digest("hex").slice(0, 32);
11267
+ }
11260
11268
  var SARIF_VERSION = "2.1.0";
11261
11269
  var SARIF_SCHEMA = "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json";
11262
11270
  function sarifLevel(severity) {
@@ -11349,7 +11357,7 @@ ${finding.consequence}` : `**${finding.title}**`
11349
11357
  }
11350
11358
  ],
11351
11359
  partialFingerprints: {
11352
- primaryLocationLineHash: `${finding.ruleId}:${finding.file}:${Math.max(1, finding.line)}`
11360
+ [FINGERPRINT_KEY]: fingerprintOf(finding)
11353
11361
  },
11354
11362
  properties: {
11355
11363
  severity: finding.severity,