fix(release): reject zero-time release timestamps, not just Go's spelling #42
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/reject-zero-timestamps"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found while verifying rc.29. Independent of the OCI-annotation work — this is a live defect on
development.What happened
rc.29 shipped with
org.opencontainers.image.created=1970-01-01T00:00:00Z— the exact label theStamp image creation timestampstep exists to protect, reached by a route it did not guard.Forgejo returns a zero time rather than an empty string for a release published through the API, which is how semantic-release cuts every rc. The guard rejected Go's zero value and nothing else:
The epoch is ISO-8601 shaped, so it cleared the format assertion and was baked into the image. The downstream label gate then verified it as correct, because that gate compares the image against this value — a wrong value here is confirmed, not caught.
Worth noting this is probably the real root cause of the rc.21 incident the step's own comment describes as "root cause unconfirmed". That was diagnosed as a build-arg failing to reach BuildKit; it may simply have been this.
The fix
Enumerating sentinels is a losing game, so the test is plausibility: nothing this project publishes was created before the project existed, so anything earlier is a sentinel whatever it spells itself. One predicate serves both the candidate choice and the final assertion — a value good enough to pick is exactly a value good enough to ship.
Two deliberate behaviour changes
published_atandcreated_atare each tested, so an unusablepublished_atnow falls through to a usablecreated_at. The old code consultedcreated_atonly whenpublished_atwas empty.Verified
Eight inputs, each exercised against the real step body: dispatch, real
published_at, Go zero, Unix epoch, epoch-with-real-created_at, both-sentinels, garbage, and a pre-2020 year.