fix(git-gate): reject AGit review refs
test / integration-macos (pull_request) Has been skipped
test / integration-docker (pull_request) Successful in 33s
test / unit (pull_request) Successful in 54s
lint / lint (push) Successful in 1m0s
tracker-policy-pr / check-pr (pull_request) Successful in 8s
test / integration-firecracker (pull_request) Successful in 3m59s
test / coverage (pull_request) Successful in 16s
test / publish-infra (pull_request) Has been skipped
test / integration-macos (pull_request) Has been skipped
test / integration-docker (pull_request) Successful in 33s
test / unit (pull_request) Successful in 54s
lint / lint (push) Successful in 1m0s
tracker-policy-pr / check-pr (pull_request) Successful in 8s
test / integration-firecracker (pull_request) Successful in 3m59s
test / coverage (pull_request) Successful in 16s
test / publish-infra (pull_request) Has been skipped
This commit is contained in:
@@ -181,6 +181,21 @@ class TestHookRender(unittest.TestCase):
|
||||
self.assertNotIn('log_opts="$new"', hook)
|
||||
self.assertNotIn('log_opts="$old..$new"', hook)
|
||||
|
||||
def test_agit_review_refs_are_rejected_before_scanning(self):
|
||||
hook = git_gate_render_hook()
|
||||
guard = "refs/for/*|refs/draft/*|refs/for-review/*"
|
||||
self.assertIn(guard, hook)
|
||||
self.assertIn(
|
||||
"AGit review refs are disabled; push to refs/heads/<branch>",
|
||||
hook,
|
||||
)
|
||||
self.assertLess(hook.index(guard), hook.index("# Phase 1: gitleaks"))
|
||||
# Ref deletion must remain possible for cleanup.
|
||||
self.assertLess(
|
||||
hook.index('[ "$new" = "$zero" ] && continue'),
|
||||
hook.index(guard),
|
||||
)
|
||||
|
||||
def test_forward_ssh_is_non_interactive_and_bounded(self):
|
||||
# No prompt (BatchMode) and a connect timeout, so an unreachable
|
||||
# upstream fails fast instead of hanging the receive-pack.
|
||||
|
||||
Reference in New Issue
Block a user