Skip to content

Commit 6a4318e

Browse files
TMHSDigitalclaude
andcommitted
Action: let jq cut the summary lists, not head (#345)
The job-summary lists piped jq into head -50 in a step that runs with pipefail; with output larger than a pipe buffer, head closes the pipe, jq dies on SIGPIPE and the step can fail after the scan succeeded. Each list now uses jq -n with limit(50; inputs | ...), so no pipe is closed early. The action job's diff case now adds 3000 more removed names to the previous results (about 200 KB of changes, checked locally), so CI runs the summary on a list far longer than a pipe buffer. Fixes #345 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 194eaa2 commit 6a4318e

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

‎.github/workflows/go.yml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@ jobs:
198198
grep -q 'dangling-cname' takeovers.sarif
199199
cp "${{ steps.scan.outputs.results }}" previous.jsonl
200200
echo "gone.lab.example" >> previous.jsonl
201+
# Thousands of removed names make the job summary's list far longer
202+
# than a pipe buffer, which the action must cut to 50 without
203+
# failing its step (#345).
204+
for i in $(seq 1 3000); do echo "gone$i.lab.example"; done >> previous.jsonl
201205
202206
- name: Diff against it
203207
id: diff
@@ -212,7 +216,7 @@ jobs:
212216
shell: bash
213217
run: |
214218
test "${{ steps.diff.outputs.added }}" = 0
215-
test "${{ steps.diff.outputs.removed }}" = 1
219+
test "${{ steps.diff.outputs.removed }}" = 3001
216220
grep -q '"change":"removed"' "${{ steps.diff.outputs.changes }}"
217221
grep -q 'gone.lab.example' "${{ steps.diff.outputs.changes }}"
218222

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6767
- Less memory on large wordlists and busy scans: `-sources`, `-ct`, `-axfr` and `-permute` check their names against the wordlist without building a set as large as it (about 200 MB per feature and target on a 5M-line list), a `-simulate-zone` lab scan no longer keeps a count per queried name (about 170 MB on a 1M-line list), and a `CNAME` lookup reads a UDP answer into a buffer sized for the 1232-byte EDNS payload it advertises instead of 64 KB. Results are unchanged (#321).
6868

6969
### Fixed
70+
- The GitHub Action's job summary cuts its takeover and change lists to 50 entries in `jq` itself instead of piping into `head -50`, which under the step's `pipefail` could fail the step on a very long list after the scan had succeeded (#345).
7071
- The TUI's finished screen wraps its counters between counters to the terminal width and gives the extra lines to the layout, so with every counter set it still fits an 80×24 terminal instead of the terminal wrapping the line and pushing the screen one row down. ctrl+c during the permutation pass after a `-no-abort` reliability warning shows an abort, not a failure (#343).
7172
- A `-diff` baseline that is also an `-o` file is recognised however the two paths are spelled (`x` and `./x`, a relative and an absolute path, another case on Windows), so a stopped run leaves it unchanged for the resumed run, as it already did for identical spellings (#342).
7273
- A `CNAME` lookup of a name with an empty label or one over 63 bytes is reported as not found without a query, as a name over 255 bytes already was, instead of dialling, counting a query and reporting a failure that the reliability guard counts (#344).

‎action.yml‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,16 @@ runs:
218218
if [ "$takeovers" != 0 ]; then
219219
echo
220220
echo "**Takeover candidates:** $takeovers"
221-
jq -r 'select(.takeover_candidate) | "- `\(.subdomain)`: \(.takeover_candidate)"' "$out/results.jsonl" | head -50
221+
# jq stops at 50 itself: `| head -50` would close the pipe under
222+
# pipefail and fail the step on a long list.
223+
jq -rn 'limit(50; inputs | select(.takeover_candidate) | "- `\(.subdomain)`: \(.takeover_candidate)")' "$out/results.jsonl"
222224
fi
223225
if [ -n "$prev" ]; then
224226
echo
225227
echo "**Changes since the previous results:** $added added, $removed removed, $changed changed."
226-
jq -r 'select(.change == "added") | "- `+ \(.subdomain)`"' "$out/changes.jsonl" | head -50
227-
jq -r 'select(.change == "removed") | "- `- \(.subdomain)`"' "$out/changes.jsonl" | head -50
228-
jq -r 'select(.change == "changed") | "- `~ \(.subdomain)`: \([.previous_records[]? | "\(.type) \(.value)"] | join(", ")) -> \([.records[] | "\(.type) \(.value)"] | join(", "))"' "$out/changes.jsonl" | head -50
228+
jq -rn 'limit(50; inputs | select(.change == "added") | "- `+ \(.subdomain)`")' "$out/changes.jsonl"
229+
jq -rn 'limit(50; inputs | select(.change == "removed") | "- `- \(.subdomain)`")' "$out/changes.jsonl"
230+
jq -rn 'limit(50; inputs | select(.change == "changed") | "- `~ \(.subdomain)`: \([.previous_records[]? | "\(.type) \(.value)"] | join(", ")) -> \([.records[] | "\(.type) \(.value)"] | join(", "))")' "$out/changes.jsonl"
229231
fi
230232
} >> "$GITHUB_STEP_SUMMARY"
231233

0 commit comments

Comments
 (0)