eyre: prevent binding in reserved namespaces

Disallows registering bindings (through %connect and %serve) that would capture
traffic on paths starting with /~ (Eyre's) or /~_~ (runtime's, as of cc389c5).

Note that we don't touch +insert-binding, which is used by Eyre internally to
set up bindings in its own namespace.
This commit is contained in:
fang 2020-10-06 16:50:49 +02:00 committed by GitHub
parent a208387a72
commit a1e43e02a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1772,6 +1772,12 @@
|= [=binding =action]
^- [(list move) server-state]
=^ success bindings.state
:: prevent binding in reserved namespaces
::
?: ?| ?=([%'~' *] path.binding) :: eyre
?=([%'~_~' *] path.binding) :: runtime
==
[| bindings.state]
(insert-binding [binding duct action] bindings.state)
:_ state
[duct %give %bound success binding]~