Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a webhook to validate trust policies #285

Merged
merged 1 commit into from
May 20, 2024

Conversation

mattmoor
Copy link
Member

This is based on Billy's PR, but I've rebased it on #284 and expanded it a bunch based on some experimentation in my dev environment.

Draft until we land the base PR.

Fixes: #247
Fixes: #46

@mattmoor mattmoor force-pushed the validate-webook2 branch from 601b330 to ad37a73 Compare May 18, 2024 22:15
default = "chainguard/octo-sts:latest"
type = object({
app = optional(string, "chainguard/octo-sts:latest")
webhook = optional(string, "chainguard/octo-sts-webhook:latest")
Copy link
Member Author

Choose a reason for hiding this comment

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

This doesn't exist yet (obviously), but we'll need to create it once we cut the next release!

@mattmoor
Copy link
Member Author

cc @wlynch

@mattmoor mattmoor marked this pull request as draft May 18, 2024 22:19
Since we don't give any information at request time about why a STS
policy is valid or not so that we don't leak details about the policy,
this webhook will validate on the repo at pull request / push so the
repo authors get feedback on potential config issues.
@mattmoor mattmoor force-pushed the validate-webook2 branch from ad37a73 to fc6d457 Compare May 18, 2024 23:07
@mattmoor mattmoor marked this pull request as ready for review May 18, 2024 23:10
@mattmoor mattmoor requested review from tcnghia, imjasonh and cpanato May 18, 2024 23:15
@@ -0,0 +1,57 @@
// Generate a random webhook secret
resource "random_password" "webhook-secret" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is something supposed to pass this secret to GitHub somehow? Or is this supposed to be an input instead of a randomly generated internal thing? I don't understand how app installation webhooks are secured.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, basically we need to access the secret and feed it into github when we register the webhook portion of things.

Since the webhook reads this at startup I went this route mostly for bootstrapping purposes. I really wish github would switch to a model more like ours.

Copy link
Collaborator

@cpanato cpanato left a comment

Choose a reason for hiding this comment

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

cool!
lgtm

@mattmoor
Copy link
Member Author

Credit to @wlynch I just made some tweaks :)

@mattmoor mattmoor merged commit 8f1603b into octo-sts:main May 20, 2024
12 checks passed
@mattmoor mattmoor deleted the validate-webook2 branch May 20, 2024 16:30
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.

Add a webhook to Octo STS that validates .github/chainguard/foo.sts.yaml are well formed
5 participants