@consiliency/agent-board-schema 1.83.0 → 1.84.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/fixtures/already-applied.json +4 -0
- package/migrations/20261203000200_agent_board_signed_seat_gates.sql +695 -0
- package/package.json +1 -1
- package/schema-manifest.json +12 -3
- package/src/tooling.test.mjs +4 -2
- package/tests/agent_board_954_signed_seat_gates.test.sql +472 -0
- package/tests/catalog/function_execute_privileges.json +36 -0
- package/tests/catalog/p_metadata_parameters.json +16 -0
- package/tests/mutations/954/MA1_resolver_ignores_signer.sql +15 -0
- package/tests/mutations/954/MA2_null_actor_resolves_to_signer.sql +22 -0
- package/tests/mutations/954/MB1_no_bind.sql +14 -0
- package/tests/mutations/954/MC1_context_any_role.sql +15 -0
- package/tests/mutations/954/MG1_has_board_access_service_bypass.sql +18 -0
- package/tests/mutations/954/MG2_can_send_to_board_service_bypass.sql +18 -0
- package/tests/mutations/954/MG3_can_access_thread_service_bypass.sql +18 -0
- package/tests/mutations/954/MG4_can_post_to_thread_service_bypass.sql +13 -0
- package/tests/mutations/954/MG5_can_access_task_service_bypass.sql +18 -0
- package/tests/mutations/954/MG6_can_mutate_task_service_bypass.sql +18 -0
- package/tests/mutations/954/MR1_post_board_message_no_release.sql +14 -0
- package/tests/mutations/954/MR2_send_direct_message_no_release.sql +14 -0
- package/tests/mutations/954/MR3_send_multicast_message_no_release.sql +14 -0
- package/tests/mutations/954/MR4_create_tasking_delivery_no_release.sql +14 -0
- package/tests/mutations/954/MR5_append_task_event_no_release.sql +14 -0
- package/tests/mutations/954/MR6_grant_board_role_no_release.sql +14 -0
- package/tests/mutations/954/MR7_set_board_authority_ceiling_no_release.sql +14 -0
- package/tests/mutations/954/MW1_post_board_message_unbound.sql +25 -0
- package/tests/mutations/954/MW2_send_direct_message_unbound.sql +25 -0
- package/tests/mutations/954/MW3_send_multicast_message_unbound.sql +25 -0
- package/tests/mutations/954/MW4_create_tasking_delivery_unbound.sql +25 -0
- package/tests/mutations/954/MW5_append_task_event_unbound.sql +25 -0
- package/tests/mutations/954/MW6_grant_board_role_unbound.sql +25 -0
- package/tests/mutations/954/MW7_set_board_authority_ceiling_unbound.sql +25 -0
- package/tests/mutations/954/MX1_bind_session_level.sql +13 -0
- package/tests/mutations/954/MX2_release_session_level.sql +13 -0
- package/tests/mutations/954/run.sh +93 -0
|
@@ -361,6 +361,10 @@
|
|
|
361
361
|
"signature": "_refuse_delegate_membership_target(p_agent_id uuid, p_operation text)",
|
|
362
362
|
"declares_p_metadata": false
|
|
363
363
|
},
|
|
364
|
+
{
|
|
365
|
+
"signature": "_release_signed_write_actor()",
|
|
366
|
+
"declares_p_metadata": false
|
|
367
|
+
},
|
|
364
368
|
{
|
|
365
369
|
"signature": "_require_human_step_up(p_operation text)",
|
|
366
370
|
"declares_p_metadata": false
|
|
@@ -393,6 +397,14 @@
|
|
|
393
397
|
"signature": "_role_rank(p_role text)",
|
|
394
398
|
"declares_p_metadata": false
|
|
395
399
|
},
|
|
400
|
+
{
|
|
401
|
+
"signature": "_seat_gate_agent_id()",
|
|
402
|
+
"declares_p_metadata": false
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
"signature": "_seat_gate_bypass()",
|
|
406
|
+
"declares_p_metadata": false
|
|
407
|
+
},
|
|
396
408
|
{
|
|
397
409
|
"signature": "_send_fleet_scope_mode(p_scope_key text)",
|
|
398
410
|
"declares_p_metadata": false
|
|
@@ -441,6 +453,10 @@
|
|
|
441
453
|
"signature": "_session_identity_revocation_actor(p_identity_agent_id uuid)",
|
|
442
454
|
"declares_p_metadata": false
|
|
443
455
|
},
|
|
456
|
+
{
|
|
457
|
+
"signature": "_signed_write_actor_context()",
|
|
458
|
+
"declares_p_metadata": false
|
|
459
|
+
},
|
|
444
460
|
{
|
|
445
461
|
"signature": "_signed_write_actor_id(p_payload jsonb, p_gateway_decision jsonb, p_actor_field text)",
|
|
446
462
|
"declares_p_metadata": false
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
-- MA1: _resolved_actor_agent_id ignores the bound signer (pre-#954 service_role rule)
|
|
2
|
+
do $m$
|
|
3
|
+
declare
|
|
4
|
+
d text := pg_get_functiondef('agent_board._resolved_actor_agent_id(uuid,text)'::regprocedure);
|
|
5
|
+
a text; r text; n int;
|
|
6
|
+
begin
|
|
7
|
+
a := $a$ v_signer := agent_board._signed_write_actor_context();
|
|
8
|
+
$a$;
|
|
9
|
+
r := $r$ v_signer := null;
|
|
10
|
+
$r$;
|
|
11
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
12
|
+
if a = '' or n <> 1 then raise exception 'MUTATION ANCHOR MISS (MA1_resolver_ignores_signer)'; end if;
|
|
13
|
+
d := replace(d, a, r);
|
|
14
|
+
execute d;
|
|
15
|
+
end $m$;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
-- MA2: under a bound signer a NULL actor resolves to the signer (lets a stale context author an unsigned call; #956 review finding 3)
|
|
2
|
+
do $m$
|
|
3
|
+
declare
|
|
4
|
+
d text := pg_get_functiondef('agent_board._resolved_actor_agent_id(uuid,text)'::regprocedure);
|
|
5
|
+
a text; r text; n int;
|
|
6
|
+
begin
|
|
7
|
+
a := $a$ if p_supplied_agent_id is null then
|
|
8
|
+
raise exception '% is required for service_role callers', p_param_name using errcode = '22023';
|
|
9
|
+
end if;
|
|
10
|
+
$a$;
|
|
11
|
+
r := $r$ if p_supplied_agent_id is null and agent_board._signed_write_actor_context() is not null then
|
|
12
|
+
return agent_board._signed_write_actor_context();
|
|
13
|
+
end if;
|
|
14
|
+
if p_supplied_agent_id is null then
|
|
15
|
+
raise exception '% is required for service_role callers', p_param_name using errcode = '22023';
|
|
16
|
+
end if;
|
|
17
|
+
$r$;
|
|
18
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
19
|
+
if a = '' or n <> 1 then raise exception 'MUTATION ANCHOR MISS (MA2_null_actor_resolves_to_signer)'; end if;
|
|
20
|
+
d := replace(d, a, r);
|
|
21
|
+
execute d;
|
|
22
|
+
end $m$;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
-- MB1: _signed_write_actor_id no longer binds the signer (every wrapper unbound)
|
|
2
|
+
do $m$
|
|
3
|
+
declare
|
|
4
|
+
d text := pg_get_functiondef('agent_board._signed_write_actor_id(jsonb,jsonb,text)'::regprocedure);
|
|
5
|
+
a text; r text; n int;
|
|
6
|
+
begin
|
|
7
|
+
a := $a$ perform pg_catalog.set_config('agent_board.signed_write_actor', v_actor::text, true);
|
|
8
|
+
$a$;
|
|
9
|
+
r := $r$$r$;
|
|
10
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
11
|
+
if a = '' or n <> 1 then raise exception 'MUTATION ANCHOR MISS (MB1_no_bind)'; end if;
|
|
12
|
+
d := replace(d, a, r);
|
|
13
|
+
execute d;
|
|
14
|
+
end $m$;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
-- MC1: _signed_write_actor_context honours the setting in any session, not only service_role
|
|
2
|
+
do $m$
|
|
3
|
+
declare
|
|
4
|
+
d text := pg_get_functiondef('agent_board._signed_write_actor_context()'::regprocedure);
|
|
5
|
+
a text; r text; n int;
|
|
6
|
+
begin
|
|
7
|
+
a := $a$ when agent_board._is_service_role()
|
|
8
|
+
then nullif$a$;
|
|
9
|
+
r := $r$ when true
|
|
10
|
+
then nullif$r$;
|
|
11
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
12
|
+
if a = '' or n <> 1 then raise exception 'MUTATION ANCHOR MISS (MC1_context_any_role)'; end if;
|
|
13
|
+
d := replace(d, a, r);
|
|
14
|
+
execute d;
|
|
15
|
+
end $m$;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
-- MG1: _current_agent_has_board_access short-circuits on _is_service_role() again (pre-#954 body)
|
|
2
|
+
do $m$
|
|
3
|
+
declare
|
|
4
|
+
d text := pg_get_functiondef('agent_board._current_agent_has_board_access(uuid)'::regprocedure);
|
|
5
|
+
a text; r text; n int;
|
|
6
|
+
begin
|
|
7
|
+
a := $a$agent_board._seat_gate_bypass()$a$;
|
|
8
|
+
r := $r$agent_board._is_service_role()$r$;
|
|
9
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
10
|
+
if a = '' or n < 1 then raise exception 'MUTATION ANCHOR MISS (MG1_has_board_access_service_bypass)'; end if;
|
|
11
|
+
d := replace(d, a, r);
|
|
12
|
+
a := $a$agent_board._seat_gate_agent_id()$a$;
|
|
13
|
+
r := $r$agent_board.current_agent_id()$r$;
|
|
14
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
15
|
+
if a = '' or n < 1 then raise exception 'MUTATION ANCHOR MISS (MG1_has_board_access_service_bypass)'; end if;
|
|
16
|
+
d := replace(d, a, r);
|
|
17
|
+
execute d;
|
|
18
|
+
end $m$;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
-- MG2: _current_agent_can_send_to_board short-circuits on _is_service_role() again (pre-#954 body)
|
|
2
|
+
do $m$
|
|
3
|
+
declare
|
|
4
|
+
d text := pg_get_functiondef('agent_board._current_agent_can_send_to_board(uuid)'::regprocedure);
|
|
5
|
+
a text; r text; n int;
|
|
6
|
+
begin
|
|
7
|
+
a := $a$agent_board._seat_gate_bypass()$a$;
|
|
8
|
+
r := $r$agent_board._is_service_role()$r$;
|
|
9
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
10
|
+
if a = '' or n < 1 then raise exception 'MUTATION ANCHOR MISS (MG2_can_send_to_board_service_bypass)'; end if;
|
|
11
|
+
d := replace(d, a, r);
|
|
12
|
+
a := $a$agent_board._seat_gate_agent_id()$a$;
|
|
13
|
+
r := $r$agent_board.current_agent_id()$r$;
|
|
14
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
15
|
+
if a = '' or n < 1 then raise exception 'MUTATION ANCHOR MISS (MG2_can_send_to_board_service_bypass)'; end if;
|
|
16
|
+
d := replace(d, a, r);
|
|
17
|
+
execute d;
|
|
18
|
+
end $m$;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
-- MG3: _current_agent_can_access_thread short-circuits on _is_service_role() again (pre-#954 body)
|
|
2
|
+
do $m$
|
|
3
|
+
declare
|
|
4
|
+
d text := pg_get_functiondef('agent_board._current_agent_can_access_thread(uuid)'::regprocedure);
|
|
5
|
+
a text; r text; n int;
|
|
6
|
+
begin
|
|
7
|
+
a := $a$agent_board._seat_gate_bypass()$a$;
|
|
8
|
+
r := $r$agent_board._is_service_role()$r$;
|
|
9
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
10
|
+
if a = '' or n < 1 then raise exception 'MUTATION ANCHOR MISS (MG3_can_access_thread_service_bypass)'; end if;
|
|
11
|
+
d := replace(d, a, r);
|
|
12
|
+
a := $a$agent_board._seat_gate_agent_id()$a$;
|
|
13
|
+
r := $r$agent_board.current_agent_id()$r$;
|
|
14
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
15
|
+
if a = '' or n < 1 then raise exception 'MUTATION ANCHOR MISS (MG3_can_access_thread_service_bypass)'; end if;
|
|
16
|
+
d := replace(d, a, r);
|
|
17
|
+
execute d;
|
|
18
|
+
end $m$;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
-- MG4: _current_agent_can_post_to_thread short-circuits on _is_service_role() again (pre-#954 body)
|
|
2
|
+
do $m$
|
|
3
|
+
declare
|
|
4
|
+
d text := pg_get_functiondef('agent_board._current_agent_can_post_to_thread(uuid)'::regprocedure);
|
|
5
|
+
a text; r text; n int;
|
|
6
|
+
begin
|
|
7
|
+
a := $a$agent_board._seat_gate_bypass()$a$;
|
|
8
|
+
r := $r$agent_board._is_service_role()$r$;
|
|
9
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
10
|
+
if a = '' or n < 1 then raise exception 'MUTATION ANCHOR MISS (MG4_can_post_to_thread_service_bypass)'; end if;
|
|
11
|
+
d := replace(d, a, r);
|
|
12
|
+
execute d;
|
|
13
|
+
end $m$;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
-- MG5: _current_agent_can_access_task short-circuits on _is_service_role() again (pre-#954 body)
|
|
2
|
+
do $m$
|
|
3
|
+
declare
|
|
4
|
+
d text := pg_get_functiondef('agent_board._current_agent_can_access_task(uuid)'::regprocedure);
|
|
5
|
+
a text; r text; n int;
|
|
6
|
+
begin
|
|
7
|
+
a := $a$agent_board._seat_gate_bypass()$a$;
|
|
8
|
+
r := $r$agent_board._is_service_role()$r$;
|
|
9
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
10
|
+
if a = '' or n < 1 then raise exception 'MUTATION ANCHOR MISS (MG5_can_access_task_service_bypass)'; end if;
|
|
11
|
+
d := replace(d, a, r);
|
|
12
|
+
a := $a$agent_board._seat_gate_agent_id()$a$;
|
|
13
|
+
r := $r$agent_board.current_agent_id()$r$;
|
|
14
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
15
|
+
if a = '' or n < 1 then raise exception 'MUTATION ANCHOR MISS (MG5_can_access_task_service_bypass)'; end if;
|
|
16
|
+
d := replace(d, a, r);
|
|
17
|
+
execute d;
|
|
18
|
+
end $m$;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
-- MG6: _current_agent_can_mutate_task short-circuits on _is_service_role() again (pre-#954 body)
|
|
2
|
+
do $m$
|
|
3
|
+
declare
|
|
4
|
+
d text := pg_get_functiondef('agent_board._current_agent_can_mutate_task(uuid)'::regprocedure);
|
|
5
|
+
a text; r text; n int;
|
|
6
|
+
begin
|
|
7
|
+
a := $a$agent_board._seat_gate_bypass()$a$;
|
|
8
|
+
r := $r$agent_board._is_service_role()$r$;
|
|
9
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
10
|
+
if a = '' or n < 1 then raise exception 'MUTATION ANCHOR MISS (MG6_can_mutate_task_service_bypass)'; end if;
|
|
11
|
+
d := replace(d, a, r);
|
|
12
|
+
a := $a$agent_board._seat_gate_agent_id()$a$;
|
|
13
|
+
r := $r$agent_board.current_agent_id()$r$;
|
|
14
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
15
|
+
if a = '' or n < 1 then raise exception 'MUTATION ANCHOR MISS (MG6_can_mutate_task_service_bypass)'; end if;
|
|
16
|
+
d := replace(d, a, r);
|
|
17
|
+
execute d;
|
|
18
|
+
end $m$;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
-- MR1: signed_post_board_message never releases the signer context
|
|
2
|
+
do $m$
|
|
3
|
+
declare
|
|
4
|
+
d text := pg_get_functiondef('agent_board.signed_post_board_message(jsonb,jsonb)'::regprocedure);
|
|
5
|
+
a text; r text; n int;
|
|
6
|
+
begin
|
|
7
|
+
a := $a$ perform agent_board._release_signed_write_actor();
|
|
8
|
+
$a$;
|
|
9
|
+
r := $r$$r$;
|
|
10
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
11
|
+
if a = '' or n <> 1 then raise exception 'MUTATION ANCHOR MISS (MR1_post_board_message_no_release)'; end if;
|
|
12
|
+
d := replace(d, a, r);
|
|
13
|
+
execute d;
|
|
14
|
+
end $m$;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
-- MR2: signed_send_direct_message never releases the signer context
|
|
2
|
+
do $m$
|
|
3
|
+
declare
|
|
4
|
+
d text := pg_get_functiondef('agent_board.signed_send_direct_message(jsonb,jsonb)'::regprocedure);
|
|
5
|
+
a text; r text; n int;
|
|
6
|
+
begin
|
|
7
|
+
a := $a$ perform agent_board._release_signed_write_actor();
|
|
8
|
+
$a$;
|
|
9
|
+
r := $r$$r$;
|
|
10
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
11
|
+
if a = '' or n <> 1 then raise exception 'MUTATION ANCHOR MISS (MR2_send_direct_message_no_release)'; end if;
|
|
12
|
+
d := replace(d, a, r);
|
|
13
|
+
execute d;
|
|
14
|
+
end $m$;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
-- MR3: signed_send_multicast_message never releases the signer context
|
|
2
|
+
do $m$
|
|
3
|
+
declare
|
|
4
|
+
d text := pg_get_functiondef('agent_board.signed_send_multicast_message(jsonb,jsonb)'::regprocedure);
|
|
5
|
+
a text; r text; n int;
|
|
6
|
+
begin
|
|
7
|
+
a := $a$ perform agent_board._release_signed_write_actor();
|
|
8
|
+
$a$;
|
|
9
|
+
r := $r$$r$;
|
|
10
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
11
|
+
if a = '' or n <> 1 then raise exception 'MUTATION ANCHOR MISS (MR3_send_multicast_message_no_release)'; end if;
|
|
12
|
+
d := replace(d, a, r);
|
|
13
|
+
execute d;
|
|
14
|
+
end $m$;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
-- MR4: signed_create_tasking_delivery never releases the signer context
|
|
2
|
+
do $m$
|
|
3
|
+
declare
|
|
4
|
+
d text := pg_get_functiondef('agent_board.signed_create_tasking_delivery(jsonb,jsonb)'::regprocedure);
|
|
5
|
+
a text; r text; n int;
|
|
6
|
+
begin
|
|
7
|
+
a := $a$ perform agent_board._release_signed_write_actor();
|
|
8
|
+
$a$;
|
|
9
|
+
r := $r$$r$;
|
|
10
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
11
|
+
if a = '' or n <> 1 then raise exception 'MUTATION ANCHOR MISS (MR4_create_tasking_delivery_no_release)'; end if;
|
|
12
|
+
d := replace(d, a, r);
|
|
13
|
+
execute d;
|
|
14
|
+
end $m$;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
-- MR5: signed_append_task_event never releases the signer context
|
|
2
|
+
do $m$
|
|
3
|
+
declare
|
|
4
|
+
d text := pg_get_functiondef('agent_board.signed_append_task_event(jsonb,jsonb)'::regprocedure);
|
|
5
|
+
a text; r text; n int;
|
|
6
|
+
begin
|
|
7
|
+
a := $a$ perform agent_board._release_signed_write_actor();
|
|
8
|
+
$a$;
|
|
9
|
+
r := $r$$r$;
|
|
10
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
11
|
+
if a = '' or n <> 1 then raise exception 'MUTATION ANCHOR MISS (MR5_append_task_event_no_release)'; end if;
|
|
12
|
+
d := replace(d, a, r);
|
|
13
|
+
execute d;
|
|
14
|
+
end $m$;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
-- MR6: signed_grant_board_role never releases the signer context
|
|
2
|
+
do $m$
|
|
3
|
+
declare
|
|
4
|
+
d text := pg_get_functiondef('agent_board.signed_grant_board_role(jsonb,jsonb)'::regprocedure);
|
|
5
|
+
a text; r text; n int;
|
|
6
|
+
begin
|
|
7
|
+
a := $a$ perform agent_board._release_signed_write_actor();
|
|
8
|
+
$a$;
|
|
9
|
+
r := $r$$r$;
|
|
10
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
11
|
+
if a = '' or n <> 1 then raise exception 'MUTATION ANCHOR MISS (MR6_grant_board_role_no_release)'; end if;
|
|
12
|
+
d := replace(d, a, r);
|
|
13
|
+
execute d;
|
|
14
|
+
end $m$;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
-- MR7: signed_set_board_authority_ceiling never releases the signer context
|
|
2
|
+
do $m$
|
|
3
|
+
declare
|
|
4
|
+
d text := pg_get_functiondef('agent_board.signed_set_board_authority_ceiling(jsonb,jsonb)'::regprocedure);
|
|
5
|
+
a text; r text; n int;
|
|
6
|
+
begin
|
|
7
|
+
a := $a$ perform agent_board._release_signed_write_actor();
|
|
8
|
+
$a$;
|
|
9
|
+
r := $r$$r$;
|
|
10
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
11
|
+
if a = '' or n <> 1 then raise exception 'MUTATION ANCHOR MISS (MR7_set_board_authority_ceiling_no_release)'; end if;
|
|
12
|
+
d := replace(d, a, r);
|
|
13
|
+
execute d;
|
|
14
|
+
end $m$;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
-- MW1: signed_post_board_message derives its actor WITHOUT binding the signer (the #954 check removed for this wrapper only)
|
|
2
|
+
create function agent_board._m954_actor_id_unbound(p_payload jsonb, p_gateway_decision jsonb, p_actor_field text)
|
|
3
|
+
returns uuid language plpgsql security definer set search_path = agent_board, public as $u$
|
|
4
|
+
declare v_actor uuid; v_payload_actor uuid;
|
|
5
|
+
begin
|
|
6
|
+
v_actor := nullif(p_gateway_decision ->> 'agent_id', '')::uuid;
|
|
7
|
+
if v_actor is null then raise exception 'actor_mismatch: signed write gateway actor is required' using errcode = '42501'; end if;
|
|
8
|
+
v_payload_actor := nullif(p_payload ->> p_actor_field, '')::uuid;
|
|
9
|
+
if v_payload_actor is not null and v_payload_actor <> v_actor then
|
|
10
|
+
raise exception 'actor_mismatch: signed write payload actor must match gateway actor' using errcode = '42501';
|
|
11
|
+
end if;
|
|
12
|
+
return v_actor;
|
|
13
|
+
end $u$;
|
|
14
|
+
do $m$
|
|
15
|
+
declare
|
|
16
|
+
d text := pg_get_functiondef('agent_board.signed_post_board_message(jsonb,jsonb)'::regprocedure);
|
|
17
|
+
a text; r text; n int;
|
|
18
|
+
begin
|
|
19
|
+
a := $a$agent_board._signed_write_actor_id($a$;
|
|
20
|
+
r := $r$agent_board._m954_actor_id_unbound($r$;
|
|
21
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
22
|
+
if a = '' or n <> 1 then raise exception 'MUTATION ANCHOR MISS (MW1_post_board_message_unbound)'; end if;
|
|
23
|
+
d := replace(d, a, r);
|
|
24
|
+
execute d;
|
|
25
|
+
end $m$;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
-- MW2: signed_send_direct_message derives its actor WITHOUT binding the signer (the #954 check removed for this wrapper only)
|
|
2
|
+
create function agent_board._m954_actor_id_unbound(p_payload jsonb, p_gateway_decision jsonb, p_actor_field text)
|
|
3
|
+
returns uuid language plpgsql security definer set search_path = agent_board, public as $u$
|
|
4
|
+
declare v_actor uuid; v_payload_actor uuid;
|
|
5
|
+
begin
|
|
6
|
+
v_actor := nullif(p_gateway_decision ->> 'agent_id', '')::uuid;
|
|
7
|
+
if v_actor is null then raise exception 'actor_mismatch: signed write gateway actor is required' using errcode = '42501'; end if;
|
|
8
|
+
v_payload_actor := nullif(p_payload ->> p_actor_field, '')::uuid;
|
|
9
|
+
if v_payload_actor is not null and v_payload_actor <> v_actor then
|
|
10
|
+
raise exception 'actor_mismatch: signed write payload actor must match gateway actor' using errcode = '42501';
|
|
11
|
+
end if;
|
|
12
|
+
return v_actor;
|
|
13
|
+
end $u$;
|
|
14
|
+
do $m$
|
|
15
|
+
declare
|
|
16
|
+
d text := pg_get_functiondef('agent_board.signed_send_direct_message(jsonb,jsonb)'::regprocedure);
|
|
17
|
+
a text; r text; n int;
|
|
18
|
+
begin
|
|
19
|
+
a := $a$agent_board._signed_write_actor_id($a$;
|
|
20
|
+
r := $r$agent_board._m954_actor_id_unbound($r$;
|
|
21
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
22
|
+
if a = '' or n <> 1 then raise exception 'MUTATION ANCHOR MISS (MW2_send_direct_message_unbound)'; end if;
|
|
23
|
+
d := replace(d, a, r);
|
|
24
|
+
execute d;
|
|
25
|
+
end $m$;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
-- MW3: signed_send_multicast_message derives its actor WITHOUT binding the signer (the #954 check removed for this wrapper only)
|
|
2
|
+
create function agent_board._m954_actor_id_unbound(p_payload jsonb, p_gateway_decision jsonb, p_actor_field text)
|
|
3
|
+
returns uuid language plpgsql security definer set search_path = agent_board, public as $u$
|
|
4
|
+
declare v_actor uuid; v_payload_actor uuid;
|
|
5
|
+
begin
|
|
6
|
+
v_actor := nullif(p_gateway_decision ->> 'agent_id', '')::uuid;
|
|
7
|
+
if v_actor is null then raise exception 'actor_mismatch: signed write gateway actor is required' using errcode = '42501'; end if;
|
|
8
|
+
v_payload_actor := nullif(p_payload ->> p_actor_field, '')::uuid;
|
|
9
|
+
if v_payload_actor is not null and v_payload_actor <> v_actor then
|
|
10
|
+
raise exception 'actor_mismatch: signed write payload actor must match gateway actor' using errcode = '42501';
|
|
11
|
+
end if;
|
|
12
|
+
return v_actor;
|
|
13
|
+
end $u$;
|
|
14
|
+
do $m$
|
|
15
|
+
declare
|
|
16
|
+
d text := pg_get_functiondef('agent_board.signed_send_multicast_message(jsonb,jsonb)'::regprocedure);
|
|
17
|
+
a text; r text; n int;
|
|
18
|
+
begin
|
|
19
|
+
a := $a$agent_board._signed_write_actor_id($a$;
|
|
20
|
+
r := $r$agent_board._m954_actor_id_unbound($r$;
|
|
21
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
22
|
+
if a = '' or n <> 1 then raise exception 'MUTATION ANCHOR MISS (MW3_send_multicast_message_unbound)'; end if;
|
|
23
|
+
d := replace(d, a, r);
|
|
24
|
+
execute d;
|
|
25
|
+
end $m$;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
-- MW4: signed_create_tasking_delivery derives its actor WITHOUT binding the signer (the #954 check removed for this wrapper only)
|
|
2
|
+
create function agent_board._m954_actor_id_unbound(p_payload jsonb, p_gateway_decision jsonb, p_actor_field text)
|
|
3
|
+
returns uuid language plpgsql security definer set search_path = agent_board, public as $u$
|
|
4
|
+
declare v_actor uuid; v_payload_actor uuid;
|
|
5
|
+
begin
|
|
6
|
+
v_actor := nullif(p_gateway_decision ->> 'agent_id', '')::uuid;
|
|
7
|
+
if v_actor is null then raise exception 'actor_mismatch: signed write gateway actor is required' using errcode = '42501'; end if;
|
|
8
|
+
v_payload_actor := nullif(p_payload ->> p_actor_field, '')::uuid;
|
|
9
|
+
if v_payload_actor is not null and v_payload_actor <> v_actor then
|
|
10
|
+
raise exception 'actor_mismatch: signed write payload actor must match gateway actor' using errcode = '42501';
|
|
11
|
+
end if;
|
|
12
|
+
return v_actor;
|
|
13
|
+
end $u$;
|
|
14
|
+
do $m$
|
|
15
|
+
declare
|
|
16
|
+
d text := pg_get_functiondef('agent_board.signed_create_tasking_delivery(jsonb,jsonb)'::regprocedure);
|
|
17
|
+
a text; r text; n int;
|
|
18
|
+
begin
|
|
19
|
+
a := $a$agent_board._signed_write_actor_id($a$;
|
|
20
|
+
r := $r$agent_board._m954_actor_id_unbound($r$;
|
|
21
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
22
|
+
if a = '' or n <> 1 then raise exception 'MUTATION ANCHOR MISS (MW4_create_tasking_delivery_unbound)'; end if;
|
|
23
|
+
d := replace(d, a, r);
|
|
24
|
+
execute d;
|
|
25
|
+
end $m$;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
-- MW5: signed_append_task_event derives its actor WITHOUT binding the signer (the #954 check removed for this wrapper only)
|
|
2
|
+
create function agent_board._m954_actor_id_unbound(p_payload jsonb, p_gateway_decision jsonb, p_actor_field text)
|
|
3
|
+
returns uuid language plpgsql security definer set search_path = agent_board, public as $u$
|
|
4
|
+
declare v_actor uuid; v_payload_actor uuid;
|
|
5
|
+
begin
|
|
6
|
+
v_actor := nullif(p_gateway_decision ->> 'agent_id', '')::uuid;
|
|
7
|
+
if v_actor is null then raise exception 'actor_mismatch: signed write gateway actor is required' using errcode = '42501'; end if;
|
|
8
|
+
v_payload_actor := nullif(p_payload ->> p_actor_field, '')::uuid;
|
|
9
|
+
if v_payload_actor is not null and v_payload_actor <> v_actor then
|
|
10
|
+
raise exception 'actor_mismatch: signed write payload actor must match gateway actor' using errcode = '42501';
|
|
11
|
+
end if;
|
|
12
|
+
return v_actor;
|
|
13
|
+
end $u$;
|
|
14
|
+
do $m$
|
|
15
|
+
declare
|
|
16
|
+
d text := pg_get_functiondef('agent_board.signed_append_task_event(jsonb,jsonb)'::regprocedure);
|
|
17
|
+
a text; r text; n int;
|
|
18
|
+
begin
|
|
19
|
+
a := $a$agent_board._signed_write_actor_id($a$;
|
|
20
|
+
r := $r$agent_board._m954_actor_id_unbound($r$;
|
|
21
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
22
|
+
if a = '' or n <> 1 then raise exception 'MUTATION ANCHOR MISS (MW5_append_task_event_unbound)'; end if;
|
|
23
|
+
d := replace(d, a, r);
|
|
24
|
+
execute d;
|
|
25
|
+
end $m$;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
-- MW6: signed_grant_board_role derives its actor WITHOUT binding the signer (the #954 check removed for this wrapper only)
|
|
2
|
+
create function agent_board._m954_actor_id_unbound(p_payload jsonb, p_gateway_decision jsonb, p_actor_field text)
|
|
3
|
+
returns uuid language plpgsql security definer set search_path = agent_board, public as $u$
|
|
4
|
+
declare v_actor uuid; v_payload_actor uuid;
|
|
5
|
+
begin
|
|
6
|
+
v_actor := nullif(p_gateway_decision ->> 'agent_id', '')::uuid;
|
|
7
|
+
if v_actor is null then raise exception 'actor_mismatch: signed write gateway actor is required' using errcode = '42501'; end if;
|
|
8
|
+
v_payload_actor := nullif(p_payload ->> p_actor_field, '')::uuid;
|
|
9
|
+
if v_payload_actor is not null and v_payload_actor <> v_actor then
|
|
10
|
+
raise exception 'actor_mismatch: signed write payload actor must match gateway actor' using errcode = '42501';
|
|
11
|
+
end if;
|
|
12
|
+
return v_actor;
|
|
13
|
+
end $u$;
|
|
14
|
+
do $m$
|
|
15
|
+
declare
|
|
16
|
+
d text := pg_get_functiondef('agent_board.signed_grant_board_role(jsonb,jsonb)'::regprocedure);
|
|
17
|
+
a text; r text; n int;
|
|
18
|
+
begin
|
|
19
|
+
a := $a$agent_board._signed_write_actor_id($a$;
|
|
20
|
+
r := $r$agent_board._m954_actor_id_unbound($r$;
|
|
21
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
22
|
+
if a = '' or n <> 1 then raise exception 'MUTATION ANCHOR MISS (MW6_grant_board_role_unbound)'; end if;
|
|
23
|
+
d := replace(d, a, r);
|
|
24
|
+
execute d;
|
|
25
|
+
end $m$;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
-- MW7: signed_set_board_authority_ceiling derives its actor WITHOUT binding the signer (the #954 check removed for this wrapper only)
|
|
2
|
+
create function agent_board._m954_actor_id_unbound(p_payload jsonb, p_gateway_decision jsonb, p_actor_field text)
|
|
3
|
+
returns uuid language plpgsql security definer set search_path = agent_board, public as $u$
|
|
4
|
+
declare v_actor uuid; v_payload_actor uuid;
|
|
5
|
+
begin
|
|
6
|
+
v_actor := nullif(p_gateway_decision ->> 'agent_id', '')::uuid;
|
|
7
|
+
if v_actor is null then raise exception 'actor_mismatch: signed write gateway actor is required' using errcode = '42501'; end if;
|
|
8
|
+
v_payload_actor := nullif(p_payload ->> p_actor_field, '')::uuid;
|
|
9
|
+
if v_payload_actor is not null and v_payload_actor <> v_actor then
|
|
10
|
+
raise exception 'actor_mismatch: signed write payload actor must match gateway actor' using errcode = '42501';
|
|
11
|
+
end if;
|
|
12
|
+
return v_actor;
|
|
13
|
+
end $u$;
|
|
14
|
+
do $m$
|
|
15
|
+
declare
|
|
16
|
+
d text := pg_get_functiondef('agent_board.signed_set_board_authority_ceiling(jsonb,jsonb)'::regprocedure);
|
|
17
|
+
a text; r text; n int;
|
|
18
|
+
begin
|
|
19
|
+
a := $a$agent_board._signed_write_actor_id($a$;
|
|
20
|
+
r := $r$agent_board._m954_actor_id_unbound($r$;
|
|
21
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
22
|
+
if a = '' or n <> 1 then raise exception 'MUTATION ANCHOR MISS (MW7_set_board_authority_ceiling_unbound)'; end if;
|
|
23
|
+
d := replace(d, a, r);
|
|
24
|
+
execute d;
|
|
25
|
+
end $m$;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
-- MX1: _signed_write_actor_id binds with set_config(..., false): session-level, outlives the transaction (#956 review RX10)
|
|
2
|
+
do $m$
|
|
3
|
+
declare
|
|
4
|
+
d text := pg_get_functiondef('agent_board._signed_write_actor_id(jsonb,jsonb,text)'::regprocedure);
|
|
5
|
+
a text; r text; n int;
|
|
6
|
+
begin
|
|
7
|
+
a := $a$perform pg_catalog.set_config('agent_board.signed_write_actor', v_actor::text, true);$a$;
|
|
8
|
+
r := $r$perform pg_catalog.set_config('agent_board.signed_write_actor', v_actor::text, false);$r$;
|
|
9
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
10
|
+
if a = '' or n <> 1 then raise exception 'MUTATION ANCHOR MISS (MX1_bind_session_level)'; end if;
|
|
11
|
+
d := replace(d, a, r);
|
|
12
|
+
execute d;
|
|
13
|
+
end $m$;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
-- MX2: _release_signed_write_actor clears with set_config(..., false): session-level
|
|
2
|
+
do $m$
|
|
3
|
+
declare
|
|
4
|
+
d text := pg_get_functiondef('agent_board._release_signed_write_actor()'::regprocedure);
|
|
5
|
+
a text; r text; n int;
|
|
6
|
+
begin
|
|
7
|
+
a := $a$perform pg_catalog.set_config('agent_board.signed_write_actor', '', true);$a$;
|
|
8
|
+
r := $r$perform pg_catalog.set_config('agent_board.signed_write_actor', '', false);$r$;
|
|
9
|
+
n := (length(d) - length(replace(d, a, ''))) / length(a);
|
|
10
|
+
if a = '' or n <> 1 then raise exception 'MUTATION ANCHOR MISS (MX2_release_session_level)'; end if;
|
|
11
|
+
d := replace(d, a, r);
|
|
12
|
+
execute d;
|
|
13
|
+
end $m$;
|