File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -173,11 +173,8 @@ def _guard_transitive_insecure_dependencies(
173173 f"--allow-insecure-host { host } " for host in blocked_hosts
174174 )
175175 message = (
176- "Transitive HTTP (insecure) dependencies were found on unapproved host(s): "
177- f"{ ', ' .join (blocked_hosts )} . "
178- "--allow-insecure only covers direct HTTP dependencies and transitive "
179- "HTTP dependencies on the same host. "
180- f"Re-run with { suggested_flags } to allow these transitive hosts."
176+ f"Re-run with { suggested_flags } to allow transitive HTTP dependencies "
177+ f"from unapproved host(s): { ', ' .join (blocked_hosts )} ."
181178 )
182179 logger .error (message )
183180 raise InsecureDependencyPolicyError (message )
Original file line number Diff line number Diff line change @@ -1421,7 +1421,11 @@ def test_transitive_guard_blocks_unapproved_host(self):
14211421 allow_insecure_hosts = (),
14221422 )
14231423
1424- assert "mirror.example.com" in str (exc_info .value )
1424+ message = str (exc_info .value )
1425+ assert message .startswith (
1426+ "Re-run with --allow-insecure-host mirror.example.com"
1427+ )
1428+ assert "unapproved host(s): mirror.example.com" in message
14251429
14261430 def test_transitive_guard_allows_same_host_as_direct_insecure_dependency (self ):
14271431 """A direct insecure dependency host also permits transitive deps on that host."""
@@ -1498,4 +1502,8 @@ def test_transitive_guard_blocks_different_host_without_explicit_allowance(self)
14981502 allow_insecure_hosts = (),
14991503 )
15001504
1501- assert "mirror.example.com" in str (exc_info .value )
1505+ message = str (exc_info .value )
1506+ assert message .startswith (
1507+ "Re-run with --allow-insecure-host mirror.example.com"
1508+ )
1509+ assert "unapproved host(s): mirror.example.com" in message
You can’t perform that action at this time.
0 commit comments