ccsniff 1.1.15 → 1.1.16
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 +4 -1
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -380,6 +380,9 @@ if (opts['git-discipline']) {
|
|
|
380
380
|
if (opts['search-discipline']) {
|
|
381
381
|
const includeSubagents = opts['include-subagents'];
|
|
382
382
|
const BASH_SEARCH = /(^|[|&;]|\s)(rg|grep|find|ag|ack|fd|fgrep|egrep)\s/;
|
|
383
|
+
// A search-tool token inside a quoted string (echo/printf/node -e payloads) is text, not a shell
|
|
384
|
+
// invocation; blank quoted bodies before matching, like git-discipline strips commit-message bodies.
|
|
385
|
+
const stripQuoted = (s) => s.replace(/"(?:\\.|[^"\\])*"/g, '""').replace(/'(?:\\.|[^'\\])*'/g, "''");
|
|
383
386
|
const violations = [];
|
|
384
387
|
for (const ev of all) {
|
|
385
388
|
if (!filter(ev)) continue;
|
|
@@ -404,7 +407,7 @@ if (opts['search-discipline']) {
|
|
|
404
407
|
// not searching the codebase tree — codesearch has no equivalent for that and it is not the
|
|
405
408
|
// bypass the rule targets. Flag only a search tool that STARTS a pipeline segment (reads the
|
|
406
409
|
// tree directly), never one immediately downstream of a pipe.
|
|
407
|
-
const isTreeSearchLine = (line) => BASH_SEARCH.test(line.split('|')[0]);
|
|
410
|
+
const isTreeSearchLine = (line) => BASH_SEARCH.test(stripQuoted(line).split('|')[0]);
|
|
408
411
|
const hitLine = cmd.split('\n').find(isTreeSearchLine);
|
|
409
412
|
if (hitLine) {
|
|
410
413
|
kind = 'native-search-bash';
|