ccsniff 1.1.14 → 1.1.15
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/package.json +1 -1
- package/src/cli.js +8 -4
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -400,11 +400,15 @@ if (opts['search-discipline']) {
|
|
|
400
400
|
}
|
|
401
401
|
} else if (name === 'Bash') {
|
|
402
402
|
const cmd = ev.block?.input?.command || '';
|
|
403
|
-
|
|
403
|
+
// A search tool fed by a pipe (`<cmd> | grep ...`) is filtering another command's stdout,
|
|
404
|
+
// not searching the codebase tree — codesearch has no equivalent for that and it is not the
|
|
405
|
+
// bypass the rule targets. Flag only a search tool that STARTS a pipeline segment (reads the
|
|
406
|
+
// tree directly), never one immediately downstream of a pipe.
|
|
407
|
+
const isTreeSearchLine = (line) => BASH_SEARCH.test(line.split('|')[0]);
|
|
408
|
+
const hitLine = cmd.split('\n').find(isTreeSearchLine);
|
|
409
|
+
if (hitLine) {
|
|
404
410
|
kind = 'native-search-bash';
|
|
405
|
-
|
|
406
|
-
const hit = cmd.split('\n').find(l => BASH_SEARCH.test(l)) || cmd;
|
|
407
|
-
detail = hit.trim().slice(0, 120);
|
|
411
|
+
detail = (hitLine.split('|')[0]).trim().slice(0, 120);
|
|
408
412
|
}
|
|
409
413
|
}
|
|
410
414
|
if (kind) violations.push({ ts, sid, project, kind, detail });
|