Skip to content

fix: the blocking findings of the main audit - #37

Merged
alexey-igrychev merged 6 commits into
mainfrom
fix/audit-blocking-findings
Sep 18, 2026
Merged

alexey-igrychev merged 6 commits into
mainfrom
fix/audit-blocking-findings

Conversation

@alexey-igrychev

Copy link
Copy Markdown
Member

The five blocking findings of the audit of main @ b32caf4, plus the CI pinning, one commit each.

Behaviour changes for operators

  • onQuorumFailure and onCommandSkipped run in the directory trx was started in, not in the clone. A hook written as ./notify.sh expecting a repository-relative path stops resolving — that is the vulnerability being fixed.
  • ~/.trx/<name> and ~/.trx/storage/<name> become <name>-<url hash>. The clone is moved when its origin matches; the state file is copied and the old directory left in place, so a same-named repository does not lose its last processed tag.
  • A tag that failed is not retried on its own anymore.

Tests cover each fixed property and were checked against the previous code where that is possible: the long-line test hangs the old executor, and the no-checkout test observes the worktree that the old resolve path would have moved.

Closes #14, closes #15, closes #16, closes #17, closes #22, closes #28.

Workflows passed Vault credentials, the release-please token and the
notification webhook to actions referenced by mutable refs (@main,
@master, @werf, @v4), so any commit pushed to those branches would run
in this repository's context with those secrets.

Every pin resolves to the current tip of the ref previously used, so
behaviour is unchanged. Adds a dependabot config to bump the pins.

Signed-off-by: Aleksei Igrychev <aleksei.igrychev@palark.com>
A quorum counted key entries, so the same public key listed twice (inline
and via gpgKeyPaths, for example) satisfied minNumberOfKeys: 2 with two
signatures from one key holder: the verifier drops one trusted key per
matching signature, and both entries matched.

Keys are now parsed before the count, a repeated primary fingerprint is a
config error naming both entries, and minNumberOfKeys is compared against
the number of distinct keys.

Signed-off-by: Aleksei Igrychev <aleksei.igrychev@palark.com>
A stdout line longer than the 64 KiB bufio.Scanner token limit ended the
reading goroutine without draining the pipe, so the child blocked on a
full pipe, the stderr io.Copy never saw EOF and cmd.Wait was never
reached: the run hung forever holding the execution lock.

os/exec now owns the copying: both streams are written to the log as they
are produced, through one mutex, and a bounded tail of stderr is repeated
on failure. This also streams stderr live instead of hiding it until the
command ends, and no longer races cmd.Wait for the tail of stdout.

Signed-off-by: Aleksei Igrychev <aleksei.igrychev@palark.com>
Both were keyed by the URL basename, so org-a/infra.git and org-b/infra.git
shared one clone and one last processed tag: the second config fetched into
the first one's clone, verified its tag and ran its own commands in that
worktree.

The directory is now <name>-<url hash>, an existing clone whose origin is
not the configured URL is refused instead of reused, and state and clones
written by earlier versions are moved over when they belong to the URL.

Signed-off-by: Aleksei Igrychev <aleksei.igrychev@palark.com>
The tag was checked out while resolving it, before CheckQuorums, and the
executor's working directory was the clone. So onQuorumFailure and
onCommandSkipped ran shell commands inside the content of a tag that had
not passed verification, on the very path meant to report an attack.

GetTargetGitObject now only resolves the tag, the checkout happens after
the quorum passes, and the executor starts in the directory trx was
started in and moves to the clone only then. Hooks that run before
verification therefore no longer see repository content.

Signed-off-by: Aleksei Igrychev <aleksei.igrychev@palark.com>
Nothing recorded an attempt, so a tag whose quorum or commands failed was
retried identically on every poll, firing onQuorumFailure or
onCommandFailure every time, and an unsigned newest tag blocked every
later tag for good. Deleting it upstream did not help either: the fetch
never pruned, so the local ref kept winning.

The failed tag is now stored next to the last processed one and skipped
with an explicit error until a newer tag arrives or --force is given, and
the fetch is forced and pruning.

Signed-off-by: Aleksei Igrychev <aleksei.igrychev@palark.com>
@alexey-igrychev
alexey-igrychev force-pushed the fix/audit-blocking-findings branch from fb4763f to 617a5d2 Compare September 18, 2026 12:32
@alexey-igrychev
alexey-igrychev merged commit c8c3cd9 into main Sep 18, 2026
2 checks passed
@alexey-igrychev
alexey-igrychev deleted the fix/audit-blocking-findings branch September 18, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment