hunter-harness 0.2.1 → 0.2.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/bin.js +20 -2
- package/package.json +2 -2
package/dist/bin.js
CHANGED
|
@@ -2993,13 +2993,27 @@ function shannonEntropy(value) {
|
|
|
2993
2993
|
}
|
|
2994
2994
|
return entropy;
|
|
2995
2995
|
}
|
|
2996
|
+
var HEX_DIGEST = /^(?:[a-fA-F0-9]{32}|[a-fA-F0-9]{40}|[a-fA-F0-9]{64})$/;
|
|
2997
|
+
var STRUCTURED_LOWERCASE_ID = /^[a-z0-9]+(?:[.-][a-z0-9]+)+$/;
|
|
2998
|
+
function isBenignHighEntropyLookalike(value) {
|
|
2999
|
+
if (HEX_DIGEST.test(value)) {
|
|
3000
|
+
return true;
|
|
3001
|
+
}
|
|
3002
|
+
if (value.includes("/")) {
|
|
3003
|
+
return true;
|
|
3004
|
+
}
|
|
3005
|
+
if (STRUCTURED_LOWERCASE_ID.test(value) && (value.match(/\./g) ?? []).length >= 2) {
|
|
3006
|
+
return true;
|
|
3007
|
+
}
|
|
3008
|
+
return false;
|
|
3009
|
+
}
|
|
2996
3010
|
function highEntropyCandidates(content) {
|
|
2997
|
-
const matches = content.matchAll(/\b[A-Za-z0-9_
|
|
3011
|
+
const matches = content.matchAll(/\b[A-Za-z0-9_+.=\-]{24,}\b/g);
|
|
2998
3012
|
return [...matches].map((match) => ({
|
|
2999
3013
|
value: match[0],
|
|
3000
3014
|
offset: match.index,
|
|
3001
3015
|
entropy: shannonEntropy(match[0])
|
|
3002
|
-
})).filter((item2) => item2.entropy >= 4.5);
|
|
3016
|
+
})).filter((item2) => item2.entropy >= 4.5 && !isBenignHighEntropyLookalike(item2.value));
|
|
3003
3017
|
}
|
|
3004
3018
|
|
|
3005
3019
|
// ../core/dist/security/scanner.js
|
|
@@ -3084,7 +3098,11 @@ function scanSensitiveFiles(files, options = {}) {
|
|
|
3084
3098
|
for (const [inputPath, content] of Object.entries(files).sort(([a], [b]) => a.localeCompare(b))) {
|
|
3085
3099
|
const path = normalizeManagedPath(inputPath);
|
|
3086
3100
|
const ignores = parseInlineIgnores(content);
|
|
3101
|
+
const knowledgeMetadata = path === ".harness/knowledge" || path.startsWith(".harness/knowledge/");
|
|
3087
3102
|
for (const raw of rawFindings(content)) {
|
|
3103
|
+
if (knowledgeMetadata && raw.ruleId === "HH_WINDOWS_ABSOLUTE_PATH") {
|
|
3104
|
+
continue;
|
|
3105
|
+
}
|
|
3088
3106
|
const position = location(content, raw.offset);
|
|
3089
3107
|
const fingerprint = sha256Bytes([
|
|
3090
3108
|
SENSITIVE_SCANNER_VERSION,
|
package/package.json
CHANGED