Skip to content

Add a validation_hook option to each remote. - #190

Open
tomfitzhenry wants to merge 1 commit into
nlewo:mainfrom
tomfitzhenry:feat/validation-hook
Open

tomfitzhenry wants to merge 1 commit into
nlewo:mainfrom
tomfitzhenry:feat/validation-hook

Conversation

@tomfitzhenry

Copy link
Copy Markdown

When the remote provides the selected commit, comin executes the hook with the comin repository as the working directory, only if the commit signature passes verification.

If the hook exits non-zero, the deploy is halted.

Closes #119

When the remote provides the selected commit, comin executes the
hook with the comin repository as the working directory, only
if the commit signature passes verification. If the hook exits
non-zero, the deploy is halted.

Closes nlewo#119
cmd.Dir = repositoryPath
output, err := cmd.CombinedOutput()
if err != nil {
return fmt.Errorf("the validation hook '%s' failed: %s\n%s", hook, err, string(output))

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should avoid putting line breaks in the error message.

What would you think about printing the whole output with logrus.info (ideally line per line) and putting only the last output line in the error message?

Comment thread nix/module-options.nix
The path to an executable validation hook script. When the
remote provides the commit to evaluate, comin executes this
script with the comin Git repository (which is bare) as the
working directory, after commit signature verification. A

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this help message should be more explicit that the hook is executed after the signature verification, only when a signature is expected.

@nlewo

nlewo commented Sep 28, 2026

Copy link
Copy Markdown
Owner

@tomfitzhenry Thank you for this contribution!

@tomfitzhenry

Copy link
Copy Markdown
Author

I realised this doesn't work for gittuf, because gittuf relies on non-bare repos, but comin clones bare repos. I will investigate further.

@tomfitzhenry

Copy link
Copy Markdown
Author

I realised this doesn't work for gittuf, because gittuf relies on non-bare repos, but comin clones bare repos. I will investigate further.

Ah, gittuf now supports it: gittuf/gittuf#1462

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.

Support for gittuf, a "git security layer"

2 participants