fix(console): check the owner-to-PM edge on every intake control, refuse request URLs without SSO, bound the browser waits (#1839)
Review r1 of lifecycle Task 3. C1: the four owner controls (answer, attach, mode, cancel) inserted and routed a human-to-PM message without the messaging policy check message.send makes. The shared writer now reads the current human-to-PM edge inside the control's transaction, before it inserts or routes anything, and refuses with message-sender-refused. The refusal rolls back the journal row, the human.input event, the message and a withdrawn selection decision. The cancel withdrawal checks the same edge. Regression tests close the edge after the question and cover all four controls, then reopen it and prove the same call lands once. I1: serve.mjs read sso.publicOrigin for a request URL when the Console ran without --sso (or in preview mode), which ended the process on an unauthenticated GET /api/requests/r1. A request route now answers through requestHTTP with no transports and no SSO fields: unavailable on a read, read-only on a write, 405 for the wrong method. Listener tests cover GET and POST without SSO and in preview mode, named and loopback, and the process keeps serving. M1: the browser test waiter allowed about 3 s and reload() could run out its loop without failing. Waits are now deadline-bound at 15 s and name the expression, and reload() waits for the new document's own ready flag and the mounted chat, and throws if it never gets there. The no-repost and stored-answer assertions of the lost-answer case are unchanged. Migration 3p-3q is unchanged.
This commit is contained in:
1 parent
eb551b1f89
commit
4e79eaace1
5 files changed
+135
-6
No files matched your search
@@ -719,7 +719,7 @@ export class Broker {
|
||||
// A message into a session being cleared or retired is cancelled at arrival, and a control that cannot reach the PM
|
||||
// fails closed here, which rolls back the journal row that called this.
|
||||
#intakeInput(s, state, body, text) {
|
||||
if (!s.console || s.human !== state.owner || s.human !== this.#business(s.business).human) fail('human-required');
|
||||
this.#intakeEdge(s, state);
|
||||
const mid = randomUUID();
|
||||
this.#store.run(
|
||||
'INSERT INTO messages(id,at,business,from_role,from_run,to_role,class,body) VALUES(?,?,?,?,?,?,?,?)',
|
||||
@@ -728,9 +728,16 @@ export class Broker {
|
||||
if (cancelled) fail(cancelled);
|
||||
return this.#event(s, 'human.input', { ...body, via: 'console', subject: s.console, message: mid }, mid);
|
||||
}
|
||||
// The owner's controls obey the same messaging policy as an ordinary message.send. The edge is read from the business
|
||||
// document as it is now, inside the control's transaction, so a policy reloaded after the PM asked its question
|
||||
// refuses with the code message.send gives and rolls back whatever the control had written.
|
||||
#intakeEdge(s, state) {
|
||||
if (!s.console || s.human !== state.owner || s.human !== this.#business(s.business).human) fail('human-required');
|
||||
this.#checkMessaging(s.business, 'human', state.pm);
|
||||
}
|
||||
// The cancel of a request whose selection decision is still open closes that decision as withdrawn by the owner.
|
||||
#withdrawIntake(s, state, decision) {
|
||||
if (!s.console || s.human !== state.owner) fail('human-required');
|
||||
this.#intakeEdge(s, state);
|
||||
const d = this.#decision(s, decision);
|
||||
if (d.action !== 'project.bootstrap' || d.route_to !== 'human' || d.raised_by_role !== state.pm) fail('request-selection-refused');
|
||||
if (this.#closed(d.id)) fail('decision-closed');
|
||||
|
||||
Reference in new issue
Block a user