Skip to content

fix(signing): guard repeated bsign passes in v2.74.2 - #340

Merged
alexey-igrychev merged 1 commit into
2.74.2-dkfrom
fix/v2.74.2/bsign-guards
Sep 22, 2026
Merged

alexey-igrychev merged 1 commit into
2.74.2-dkfrom
fix/v2.74.2/bsign-guards

Conversation

@alexey-igrychev

Copy link
Copy Markdown
Collaborator

Backport only the bsign protections from #336 to v2.74.2-dk. This line uses the older objcopy-based in-house signer, whose repeated signing is already byte-stable, so no SDK or elfedit update is included.

  • skip bsign when the current hash is sound and the signer matches
  • verify the ELF hash after bsign writes the file

Validation:

  • go mod verify
  • go test -count=1 -tags="dfrunsecurity dfrunnetwork dfrunmount dfssh containers_image_openpgp" ./pkg/build/signing/
  • go vet -tags="dfrunsecurity dfrunnetwork dfrunmount dfssh containers_image_openpgp" ./pkg/build/signing/

Prepared for review; do not merge automatically.

…336)

`signELFFile` only checked bsign's signing exit code. Astra bsign 1.4.2
can return 0 after rewriting a file that immediately fails its own hash
check, so a corrupt ELF shipped silently.

After `bsign -N -s`, delivery-kit now runs `bsign -cE` and fails the
build when the ELF-section hash does not pass. `-E` is required: without
it bsign also probes absent xattr/detached stores and returns 64 even
for a good ELF hash.

Measured on the incident binaries:
```
pause_2: bsign -cE -> good hash, rc=0
pause:   bsign -cE -> invalid hash, rc=66
```

Exit 73 (non-zero unused signature-section bytes) now has a descriptive
error instead of `unknown exit code`. That condition is intentionally
build-fatal; bsign also cannot verify those files.

Stub tests assert the exact ordered argv sequence and same path for
signing/checking, plus failures 66 and 73. Package unit/vet pass.
Related root-cause protections: deckhouse/delivery-kit-sdk#109 and
deckhouse/elfedit#4.

---------

Signed-off-by: Aleksei Igrychev <aleksei.igrychev@palark.com>
(cherry picked from commit 5515529)
@alexey-igrychev
alexey-igrychev merged commit 364cf91 into 2.74.2-dk Sep 22, 2026
12 of 13 checks passed
@alexey-igrychev
alexey-igrychev deleted the fix/v2.74.2/bsign-guards branch September 22, 2026 11:58
alexey-igrychev pushed a commit that referenced this pull request Sep 22, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.74.3-dk](v2.74.2-dk...v2.74.3-dk)
(2026-09-22)


### Bug Fixes

* **signing:** guard repeated bsign passes in v2.74.2
([#340](#340))
([364cf91](364cf91))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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