Skip to content

Commit 7ed761f

Browse files
committed
Stop the heredoc check writing its own exemption
The failure advice printed a ready-to-paste annotation with the scan's verdict already filled in, so the shortest way past the check was to copy back what it had just concluded. That is worst exactly where the scan is weakest: a path it cannot follow through a variable reads as an ordinary value, and the annotation it offers for that case is paths=none. Print the annotation with the path list left blank and say why the author has to fill it in. The scan's own reading stays in the report above it, so nothing diagnostic is lost.
1 parent 80e7c25 commit 7ed761f

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎test/shell.d/privileged-heredoc-test.sh‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,11 @@ scan_file() {
613613
1. quote the delimiter (<<'$delim') so nothing expands at install time;
614614
2. hardcode an absolute root-owned path instead of expanding one;
615615
3. if the expansion is genuinely required, declare it above the heredoc:
616-
# omarchy:heredoc-expands paths=$shown_paths -- <why this is safe>")
616+
# omarchy:heredoc-expands paths=<expansions used as paths, or none> -- <why this is safe>
617+
Decide that list yourself. The scan's own reading of it is above, and
618+
where the scan is most likely wrong is exactly here -- a path it could
619+
not follow reads as an ordinary value -- so pasting its verdict back
620+
signs off on the case worth checking by hand.")
617621
continue
618622
fi
619623

@@ -623,9 +627,9 @@ scan_file() {
623627
Every expansion used as a path outside a root-owned prefix has to be named,
624628
so adding one to an already-annotated heredoc trips this check again instead
625629
of inheriting the old exemption.
626-
Fix: drop the path expansion (hardcode an absolute root-owned path), or
627-
correct the declaration:
628-
# omarchy:heredoc-expands paths=$shown_paths -- <why root using this path is safe>")
630+
Fix: drop the path expansion (hardcode an absolute root-owned path), or name
631+
every path-shaped expansion in the declaration and say why root using it is
632+
safe.")
629633
fi
630634
done
631635
done

0 commit comments

Comments
 (0)