egress: require opt-in for HTTPS git fetch
test / unit (pull_request) Successful in 42s
test / integration (pull_request) Successful in 27s
lint / lint (push) Successful in 1m53s
test / unit (push) Successful in 41s
test / integration (push) Successful in 23s
Update Quality Badges / update-badges (push) Successful in 1m35s

This commit was merged in pull request #227.
This commit is contained in:
2026-06-10 07:00:01 +00:00
parent acb9cd67c6
commit 3f04567290
8 changed files with 240 additions and 7 deletions
+28 -1
View File
@@ -2,7 +2,8 @@
The route shape uses Gateway API HTTPRoute match vocabulary:
`host` (required), optional `matches` (paths/methods/headers),
optional nested `auth: { scheme, token_ref }`, optional `dlp`.
optional nested `auth: { scheme, token_ref }`, optional `dlp`,
optional `git: { fetch: true }`.
Validation rules per PRD 0017/0053: empty `auth: {}` is an error,
partial `auth` is an error, auth omission means unauthenticated."""
@@ -302,6 +303,32 @@ class TestDlp(unittest.TestCase):
}}])
class TestGitPolicy(unittest.TestCase):
def test_omitted_means_https_git_fetch_disabled(self):
b = _bottle([{"host": "github.com"}])
self.assertFalse(b.egress.routes[0].GitFetch)
def test_fetch_true_allowed(self):
b = _bottle([{"host": "github.com", "git": {"fetch": True}}])
self.assertTrue(b.egress.routes[0].GitFetch)
def test_fetch_false_allowed(self):
b = _bottle([{"host": "github.com", "git": {"fetch": False}}])
self.assertFalse(b.egress.routes[0].GitFetch)
def test_git_must_be_object(self):
with self.assertRaises(ManifestError):
_bottle([{"host": "github.com", "git": True}])
def test_fetch_must_be_boolean(self):
with self.assertRaises(ManifestError):
_bottle([{"host": "github.com", "git": {"fetch": "yes"}}])
def test_unknown_git_key_rejected(self):
with self.assertRaises(ManifestError):
_bottle([{"host": "github.com", "git": {"push": True}}])
class TestAuth(unittest.TestCase):
def test_omitted_means_no_auth(self):
b = _bottle([{"host": "github.com"}])