-
Notifications
You must be signed in to change notification settings - Fork 15
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
Conversation
601b330
to
ad37a73
Compare
default = "chainguard/octo-sts:latest" | ||
type = object({ | ||
app = optional(string, "chainguard/octo-sts:latest") | ||
webhook = optional(string, "chainguard/octo-sts-webhook:latest") |
There was a problem hiding this comment.
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!
cc @wlynch |
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.
ad37a73
to
fc6d457
Compare
@@ -0,0 +1,57 @@ | |||
// Generate a random webhook secret | |||
resource "random_password" "webhook-secret" { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool!
lgtm
Credit to @wlynch I just made some tweaks :) |
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