Skip to content

Commit 710cfa9

Browse files
TMHSDigitalclaude
andcommitted
Install the action's own release by default, not the newest (#462)
The version input defaulted to latest, so an action pinned to a tag or a commit SHA still downloaded whatever release was newest and ran an action.yml against a binary it was never tested with. An empty version (the new default) now installs the tag in the action ref, or for a SHA or branch pin ACTION_RELEASE, the release this action.yml ships with. A test keeps ACTION_RELEASE on CITATION.cff's version, which the release job already checks against the tag. version: latest still installs the newest release. Fixes #462 Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent a6f3411 commit 710cfa9

4 files changed

Lines changed: 51 additions & 3 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
- The GitHub Action installs the release that matches it by default: the tag it is pinned to (`uses: TMHSDigital/[email protected]`), or for a commit SHA or branch the release its `action.yml` shipped with, instead of the newest release, so a pinned action no longer runs against a binary it was never tested with. `version: latest` still installs the newest release when set (#462).
12+
1013
### Fixed
1114
- A bare-IP `-dns-server` (`1.1.1.1`, from the flag, the config file or `SUBENUM_DNS_SERVER`) now works for `-axfr`, `-nsec-walk` and the `-dry-run` preflight too; they failed with "missing port in address" while the scan itself worked. The value is normalized to `host:53` once, when the flags are parsed (#459).
1215
- `-max-duration` is kept under a low `-rate`: workers waiting for a rate slot when the budget ran out still sent their queries afterwards, so a 2 s budget at `-rate 5` ran about 43 s. No slot is handed out past the deadline now, a name's queries are sent all together or not at all, and names that never got a slot are counted as skipped and stay resumable (#460).

‎action.yml‎

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,15 @@ inputs:
6161
required: false
6262
default: unreliable
6363
version:
64-
description: subenum release to install ("latest", or a tag such as v0.9.0), or "source" to build the action's own checkout (needs Go).
64+
description: >-
65+
subenum release to install. Empty (the default) installs the release that
66+
matches the action: the tag it is pinned to (uses: [email protected]), else the
67+
release this action.yml shipped with, so a commit-SHA pin also gets the
68+
binary it was tested with. "latest" installs the newest release, a tag
69+
such as v0.9.0 that release, and "source" builds the action's own
70+
checkout (needs Go).
6571
required: false
66-
default: latest
72+
default: ""
6773
token:
6874
description: Token for downloading the release and the baseline artifact.
6975
required: false
@@ -115,10 +121,23 @@ runs:
115121
env:
116122
GH_TOKEN: ${{ inputs.token }}
117123
VERSION: ${{ inputs.version }}
124+
ACTION_REF: ${{ github.action_ref }}
125+
# The release this action.yml ships with: what an empty version
126+
# installs when the action is pinned to a commit SHA or a branch
127+
# (#462). A test keeps it on CITATION.cff's version, which the release
128+
# job checks against the tag.
129+
ACTION_RELEASE: v0.12.0
118130
run: |
119131
set -euo pipefail
120132
bin="$RUNNER_TEMP/subenum-bin"
121133
mkdir -p "$bin"
134+
if [ -z "$VERSION" ]; then
135+
# A pinned action installs its own release, not the newest (#462).
136+
case "$ACTION_REF" in
137+
v[0-9]*) VERSION="$ACTION_REF" ;;
138+
*) VERSION="$ACTION_RELEASE" ;;
139+
esac
140+
fi
122141
if [ "$VERSION" = source ]; then
123142
(cd "$GITHUB_ACTION_PATH" && go build -trimpath -o "$bin/" .)
124143
else

‎docs/monitoring.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ jobs:
124124
| `sarif` | | Write takeover candidates as SARIF |
125125
| `max-duration`{% include unreleased.html action="max-duration" %} | | Time budget, e.g. `20m` (`-max-duration`). Keep it under the job's `timeout-minutes`: a job killed by its timeout leaves no report, while a scan that reaches its budget stops testing new names and still writes results and a `degraded` report. The CLI also saves a resume state then (`subenum-resume.json`, or the `-state` path), and `subenum -resume <file>` tests the names the budget left. With `baseline-artifact`, the action keeps that state in the artifact, next to the previous results it still diffs against, and the next run resumes the scan instead of starting over, so a scheduled job works through a large wordlist over several runs; the baseline is replaced once a run completes. A change to the inputs or to the wordlist file discards the state with a notice and starts a new scan |
126126
| `fail-on` | `unreliable` | Fail on this verdict or worse: `unreliable`, `degraded` or `never`. With `never`, a failed scan (verdict `unreliable`) still passes the step; a usage error or a run with no report always fails |
127-
| `version` | `latest` | Release to install, or `source` to build the action's checkout |
127+
| `version` | the action's release | Release to install. Empty installs the one matching the action: the tag in `uses:` (`@v0.12.0`), or for a commit SHA or branch the release that `action.yml` shipped with, so a pinned action never picks up a newer binary. `latest` installs the newest release, a tag such as `v0.11.0` that one, and `source` builds the action's checkout |
128128
| `token` | `github.token` | Token for downloading the release and the baseline artifact |
129129

130130
Outputs: `verdict`, `resumed`{% include unreleased.html action="resumed" %} (`true` when the run continued a stopped scan), `found` (including `-permute` hits), `added`, `removed`, `changed`{% include unreleased.html action="changed" %} (with `-diff-records`),

‎internal/cli/docs_test.go‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,32 @@ func TestDockerLicenseLabelMatchesCitation(t *testing.T) {
329329
}
330330
}
331331

332+
// TestActionReleaseMatchesCitation keeps the release a SHA-pinned action
333+
// installs (ACTION_RELEASE in action.yml) on CITATION.cff's version, which the
334+
// release job checks against the tag, so each release's action.yml installs
335+
// that release (#462).
336+
func TestActionReleaseMatchesCitation(t *testing.T) {
337+
field := func(path, prefix string) string {
338+
t.Helper()
339+
contents, err := os.ReadFile(path) //nolint:gosec // a repo file
340+
if err != nil {
341+
t.Fatal(err)
342+
}
343+
for _, line := range strings.Split(strings.ReplaceAll(string(contents), "\r\n", "\n"), "\n") {
344+
if value, ok := strings.CutPrefix(strings.TrimSpace(line), prefix); ok {
345+
return strings.TrimSpace(value)
346+
}
347+
}
348+
t.Fatalf("%s has no %q", path, prefix)
349+
return ""
350+
}
351+
citation := field("CITATION.cff", "version:")
352+
stamped := field("action.yml", "ACTION_RELEASE:")
353+
if stamped != "v"+citation {
354+
t.Errorf("action.yml's ACTION_RELEASE is %q, CITATION.cff says version %s: set it to v%s in the release commit", stamped, citation, citation)
355+
}
356+
}
357+
332358
// TestREADMEFlagTableCoversCLI keeps the hand-written README table complete
333359
// when a CLI flag is added. The website table is generated, but the README is
334360
// maintained separately for quick reference (#137).

0 commit comments

Comments
 (0)