Skip to content

fix(resolve-latest): silently swallow 404 JSON leakage - #4

Merged
nerdalytics merged 1 commit into
trunkfrom
fix/resolve-latest-silent-404
Apr 20, 2026
Merged

nerdalytics merged 1 commit into
trunkfrom
fix/resolve-latest-silent-404

Conversation

@nerdalytics

Copy link
Copy Markdown
Owner

When an action has no published GitHub Releases (common for actions that ship only tags), gh api repos/X/releases/latest --jq .tag_name 2>/dev/null returns a 404 and leaks the raw JSON error body to stdout rather than returning empty. That body lands in $latest_tag and triggers the "not strict semver" warning with the error JSON embedded in the message — confusing to read in CI logs, looks like a bug.

Example from a beacon run where the action resolves itself:

Resolving nerdalytics/check-action-versions...
  Warning: latest release tag '{"message":"Not Found","documentation_url":"https://docs.github.com/rest/releases/releases#get-the-latest-release","status":"404"}' is not strict semver, trying tags API
  v1.0.0 (3c70250)

The tags-API fallback (next block) correctly handles this case; only the warning message was noisy.

Fix: detect the JSON-shaped leakage (brace present in value) and silently empty the variable before the semver check. The warning still fires for legitimate non-semver release tags (latest, v1, release-1) — those are worth telling the user about.

After merge: force-move v1.0.0 and v1 to include this fix.

When an action has no published GitHub Releases (common for actions
that only ship tags), 'gh api repos/X/releases/latest' returns a 404
and leaks the error-response JSON body to stdout — which then lands
in $latest_tag and triggers the 'not strict semver' warning with a
raw error object embedded in the message.

The tags-API fallback already handles this case correctly; the only
visible effect was the confusing warning. Detect the JSON-shaped
leakage (contains a brace) and empty the variable before the semver
check, falling through silently.

The warning still fires for legitimate non-semver release tags like
'latest', 'v1' without patch, or 'release-1' — those are real things
worth telling the user about.
@nerdalytics
nerdalytics merged commit 800cc33 into trunk Apr 20, 2026
3 checks passed
@nerdalytics
nerdalytics deleted the fix/resolve-latest-silent-404 branch April 20, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant