Skip to content

Commit 330ff05

Browse files
TMHSDigitalclaude
andcommitted
Read the baseline an earlier use in the job saved (#352)
A second use of the action in the same job looked its baseline artifact up through the artifacts list API one second after the first use uploaded it. The list can lag an upload, so on windows-latest the lookup found nothing ("No baseline artifact ... yet") and the resumed scan started over, failing the CI resume check. The action now keeps a copy of what it uploads under RUNNER_TEMP and a later use in the same job reads that copy instead of the API. Refs #352 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent c103efc commit 330ff05

3 files changed

Lines changed: 25 additions & 2 deletions

File tree

‎.github/workflows/go.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,9 @@ jobs:
281281
282282
# A time-boxed scan carries its resume state in the baseline artifact,
283283
# and the next use continues it rather than starting over (#352). -rate
284-
# 5 makes the 31-name wordlist outlast the first use's 2s budget.
284+
# 5 makes the 31-name wordlist outlast the first use's 2s budget. The
285+
# later uses read the copy the action kept in this job, not the artifact
286+
# list, which can lag the upload by seconds.
285287
- name: Stop a scan at its time budget
286288
id: stopped
287289
uses: ./

‎CHANGELOG.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7070
- 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).
7171

7272
### Fixed
73-
- The GitHub Action carries a time-boxed scan across runs. With `max-duration` and `baseline-artifact`, a run the budget stops saves its resume state in the baseline artifact, next to the previous results it still diffs against, and the next run continues that scan with `-resume` instead of starting from the first name again, so a large wordlist is worked through over several scheduled runs and the baseline is replaced once a run completes. The state is saved even when `fail-on` fails the step. A change to the action's inputs discards the state with a notice, as does subenum refusing to resume (for example a changed wordlist file), and a new scan starts. A new `resumed` output says whether the run continued a stopped scan (#352).
73+
- The GitHub Action carries a time-boxed scan across runs. With `max-duration` and `baseline-artifact`, a run the budget stops saves its resume state in the baseline artifact, next to the previous results it still diffs against, and the next run continues that scan with `-resume` instead of starting from the first name again, so a large wordlist is worked through over several scheduled runs and the baseline is replaced once a run completes. The state is saved even when `fail-on` fails the step. A change to the action's inputs discards the state with a notice, as does subenum refusing to resume (for example a changed wordlist file), and a new scan starts. A new `resumed` output says whether the run continued a stopped scan. A later use of the action in the same job with the same `baseline-artifact` reads the copy the earlier use saved instead of the artifact list, which can lag an upload by seconds and made the later use start over or miss the baseline (#352).
7474
- The config file and `SUBENUM_W`/`SUBENUM_O` can set several `-w` wordlists or `-o` files, as the command line can. The config file takes a JSON array for `w` and `o`, one file per entry (`"o": ["names.txt", "jsonl:results.jsonl"]`), and for `sources`, as it already did for `exclude` and `type`; a string for `w` or `o` there or in the environment is a comma-separated list, as it is for the other list settings, where it used to become one path with commas in it. `-print-config` shows `w` and `o` as a JSON array, so one file whose name has a comma is told apart from two (#353).
7575
- A name whose lookup of one requested type timed out, was refused or failed while another type answered is no longer a plain found result with the records that came back. The whole lookup is tried again up to `-attempts`, and when the failed type never answers the result is marked partial: a `partial` field in JSON and JSONL, `PARTIAL` in text with `-show-records`, a `partial answers` line in the breakdown, and `Stats.Partial` in the library. Partial answers lower the run's verdict as failed lookups do (degraded at 1%), and `-diff-records` does not report a partial name as changed, since its missing records may only be a lookup that failed (#357).
7676
- Resuming a scan stopped in its `-permute` pass (Ctrl+C or `-max-duration`) no longer scans the finished main pass again. Under `-recursive` that repeated every lookup below the saved names, and a name the repeat found anew changed the permutation candidate list, so the resumed pass started at the wrong place in a different list, skipping some candidates and testing others twice. The resume state now records that the main pass finished, and the resumed run goes straight to the permutation pass with the saved names as its seeds (#358).

‎action.yml‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,14 @@ runs:
163163
# A second use in the same job must not resume or diff the first's.
164164
rm -rf "$dir"
165165
mkdir -p "$dir"
166+
# An earlier use in this job kept a copy of what it saved: the
167+
# artifact list can lag an upload by seconds, so it may not show yet.
168+
saved="$RUNNER_TEMP/subenum-saved/${NAME//[^A-Za-z0-9._-]/_}"
169+
if [ -d "$saved" ]; then
170+
cp -R "$saved/." "$dir/"
171+
echo "Using the baseline an earlier step in this job saved."
172+
exit 0
173+
fi
166174
run=$(gh api "repos/$GITHUB_REPOSITORY/actions/artifacts?name=$NAME&per_page=1" \
167175
--jq '.artifacts[0] | select(.expired == false) | .workflow_run.id // empty')
168176
if [ -n "$run" ]; then
@@ -303,6 +311,7 @@ runs:
303311
esac
304312
305313
- name: Save the baseline
314+
id: save
306315
# A stopped run whose verdict fails the step under fail-on still saves
307316
# its state.
308317
if: ${{ (success() && steps.scan.outputs.upload == 'true') || (!cancelled() && steps.scan.outputs.carry-state == 'true') }}
@@ -312,3 +321,15 @@ runs:
312321
path: ${{ runner.temp }}/subenum-carry/
313322
retention-days: 90
314323
overwrite: true
324+
325+
- name: Keep the baseline for later uses in this job
326+
if: ${{ !cancelled() && steps.save.outcome == 'success' }}
327+
shell: bash
328+
env:
329+
NAME: ${{ inputs.baseline-artifact }}
330+
run: |
331+
set -euo pipefail
332+
saved="$RUNNER_TEMP/subenum-saved/${NAME//[^A-Za-z0-9._-]/_}"
333+
rm -rf "$saved"
334+
mkdir -p "$saved"
335+
cp -R "$RUNNER_TEMP/subenum-carry/." "$saved/"

0 commit comments

Comments
 (0)