Gate insecure capabilities behind footgun feature

This commit is contained in:
Brandon Vandegrift 2025-05-08 21:05:28 -04:00
parent 29eeebd9c1
commit 7a2a8ae4cb
15 changed files with 143 additions and 77 deletions

View file

@ -448,11 +448,11 @@ async def test_watch_many_dht_values():
# make routing contexts
# unsafe version for debugging
rc0 = await (await api0.new_routing_context()).with_safety(SafetySelection.unsafe())
rc1 = await (await api1.new_routing_context()).with_safety(SafetySelection.unsafe())
# rc0 = await (await api0.new_routing_context()).with_safety(SafetySelection.unsafe())
# rc1 = await (await api1.new_routing_context()).with_safety(SafetySelection.unsafe())
# safe default version
# rc0 = await api0.new_routing_context()
# rc1 = await api1.new_routing_context()
rc0 = await api0.new_routing_context()
rc1 = await api1.new_routing_context()
async with rc0, rc1:

View file

@ -34,9 +34,15 @@ async def test_routing_contexts(api_connection: veilid.VeilidAPI):
)
await rc.release()
rc = await (await api_connection.new_routing_context()).with_safety(
veilid.SafetySelection.unsafe(veilid.Sequencing.PREFER_ORDERED)
)
# Test that creating an Unsafe routing context throws an error
# as mentioned in the CHANGELOG (footgun feature disabled by default)
rc = await api_connection.new_routing_context()
with pytest.raises(Exception):
rc = await rc.with_safety(
veilid.SafetySelection.unsafe(veilid.Sequencing.PREFER_ORDERED)
)
await rc.release()