Archived
server: the guarded-route set is declared once, at registration
The front kept its own list of which routes answer the local operator
keyless -- guarded_route spelled out the same eight (method, path)
pairs Server::register_routes registers with a local_operator handler,
and its comment admitted the copy ("Kept in step with Server::register
routes"). A new guarded route meant editing the registration AND the
front's list AND the test that pins the list against drift; miss one and
the front wakes a parked model for a stranger who is then refused -- the
exact A-05 bug class -- silently.
Router::add now takes a `guarded` flag, set on the six registrations
that guard (and their DELETE siblings). Router::guarded(method, path)
asks the matcher -- the same split_path + :label match that reaches the
handler -- and the front copies the flag as it mirrors each model route,
so guarded_route is one line reading the front's own copied marks. One
declaration per guarded route, at its registration; the matcher that
decides the wake is the matcher that dispatches, so slash and :label
forms cannot disagree with the handler and the drift risk is gone.
front_test still pins every shape (guarded: slashes, /sessions/:label,
the trailing-slash collapse; not: GET /sessions, /stats, inference,
/sessions/a/b) and transport_test exercises real dispatch through them.
Behaviour unchanged -- the same eight routes wake nothing for a stranger.
This commit is contained in:
1 parent
0f011f27e1
commit
66b0dcf019
6 files changed
+70
-45
No files matched your search
+6
-1
@@ -168,7 +168,12 @@ public:
|
||||
* request that woke its model first churned the fleet for nothing -- wake, HF fetch,
|
||||
* eviction of residents -- and churn priced by a stranger is a DoS. Kept in step with
|
||||
* Server::register_routes. */
|
||||
static bool guarded_route(const HttpRequest& q);
|
||||
/* Whether the front's route for this request was registered guarded -- i.e. its handler
|
||||
* answers the local operator only keyless -- so a stranger's call does not wake a parked
|
||||
* model just to be refused. Derived from the router's own guarded marks (set at each route's
|
||||
* registration in Server::register_routes), so the front and the handler cannot drift: the
|
||||
* matcher that decides here is the one that reaches the handler. */
|
||||
bool guarded_route(const HttpRequest& q) const;
|
||||
/* Which requests speak for the machine's operator -- the fleet sets this to its admin
|
||||
* guard's predicate. Set, the guarded routes above bring a cold or parked model back only
|
||||
* for those callers; unset, they wake as any request does (no fleet, no guards to precede). */
|
||||
|
||||
Reference in new issue
Block a user