fix(#97): validate client_payload.host in dispatch workflow#168
Merged
Conversation
e3cc994 to
62230ac
Compare
Eliminate unvalidated forwarding of repository_dispatch client_payload.host to dispatch-apply.sh. Introduce RFC 1123 format check + allowlist enforcement in two layers (primary: workflow step; defense-in-depth: dispatch-apply.sh). Changes: - Add configs/allowed-hosts.txt: Myrmidons target host allowlist - Add scripts/validate-host.sh: Shared validation helper (format + allowlist) - Modify scripts/dispatch-apply.sh: Source validate-host.sh after HOST check - Add tests/dispatch-apply.test.sh: 5 integration test cases - Modify .github/workflows/cross-repo-dispatch.yml: Validate host before dispatch - Add docs/dispatch-contract.md: Specification of dispatch contract Closes #97 Signed-off-by: mvillmow <4211002+mvillmow@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Eliminate unvalidated forwarding of
repository_dispatchclient_payload.hosttodispatch-apply.sh. Introduce RFC 1123 format validation + allowlist enforcement in two layers:.github/workflows/cross-repo-dispatch.ymlvalidates the inbound payload before dispatchscripts/dispatch-apply.shre-validates the host (covers localjust dispatch-applycalls too)Both layers use a shared validation helper (
scripts/validate-host.sh) that checks:configs/allowed-hosts.txtTest Plan
bash tests/dispatch-apply.test.sh)hermes;id) rejected at format checkattacker-host) rejected at allowlist checkFollow-ups
One core follow-up item identified during implementation:
integration-testsjob. Added in follow-up commit6a851c5.Closes #97