Skip to content

Commit 2226826

Browse files
npub1mprnacetjua2xx3p5eddmhxyk6wv929ymm5py8kd2xfxurxahspqqlgytaTyler Longwell
andcommitted
docs(multi-tenant): model host-scoped open auth deltas
Co-authored-by: Tyler Longwell <[email protected]> Signed-off-by: Tyler Longwell <[email protected]>
1 parent 5f60e2e commit 2226826

3 files changed

Lines changed: 405 additions & 72 deletions

File tree

‎docs/spec/MultiTenantAuth.spthy‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,30 @@ rule Probe_Host_Token_Mismatch:
337337
]->
338338
[ ]
339339

340+
341+
// Open-community AUTH auto-registration. A community with no NIP-43 member
342+
// pubkey allowlist admits any authenticated npub, but still only into the
343+
// community resolved from the connection host. This is a separate admission
344+
// source from NIP-43 member-list signing: NIP-43 admissions emit
345+
// `MemberAdmitted`; open AUTH emits `OpenCommunityAutoRegistered`. Both mint the
346+
// same downstream `!Admitted(pk, comm)` fact, so later read/write checks stay
347+
// literal admission checks rather than read-path carve-outs.
348+
rule Mark_Open_Community:
349+
[ !Community(comm) ]
350+
--[
351+
OpenCommunityEnabled(comm)
352+
]->
353+
[ !OpenCommunity(comm) ]
354+
355+
rule Authenticate_To_Open_Community:
356+
[ !ClientPublic(pk), !HostCommunity(host, comm), !OpenCommunity(comm) ]
357+
--[
358+
OpenCommunityAutoRegistered(pk, comm, host),
359+
HostBoundFor(host, comm),
360+
OpenRegistrationResolved(pk, comm, host, comm)
361+
]->
362+
[ !Admitted(pk, comm) ]
363+
340364
// ============================================================================
341365
// Per-community signing keys
342366
// ============================================================================
@@ -567,6 +591,14 @@ lemma host_token_mismatch_not_authorized:
567591
HostTokenMismatchAttempt(tok, client, minted_comm, host_comm, host) @ i
568592
==> not (Ex #j. ChannelLessAuthorized(tok, client, minted_comm, host) @ j)"
569593

594+
// Open-community auto-registration is host-confined: the registered community is
595+
// exactly the community bound to the connection host. There is no client-supplied
596+
// community selector in the rule.
597+
lemma open_auth_registration_confined_to_host_community:
598+
"All pk registered_comm host host_comm #i.
599+
OpenRegistrationResolved(pk, registered_comm, host, host_comm) @ i
600+
==> registered_comm = host_comm"
601+
570602
// S2: every minted token has exactly one stamped community, and every requested
571603
// channel recorded for that mint resolved to that stamp.
572604
lemma minted_token_channels_match_stamp:
@@ -709,4 +741,8 @@ lemma executable_member_admitted:
709741
exists-trace
710742
"Ex pk comm #i. MemberAdmitted(pk, comm) @ i"
711743

744+
lemma executable_open_auth_registration:
745+
exists-trace
746+
"Ex pk comm host #i. OpenCommunityAutoRegistered(pk, comm, host) @ i"
747+
712748
end

‎docs/spec/MultiTenantRelay.cfg‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,28 @@ SPECIFICATION Spec
55

66
CONSTANTS
77
Communities = {commA, commB}
8-
Channels = {chanA1, chanA2, chanB1, chanB2}
8+
Channels = {chanA1, chanA2, chanB1, chanB2, chanFresh}
99
Hosts = {hostA, hostB, hostBad}
1010
Actors = {alice}
1111
Workers = {relay1}
12-
MsgIds = {msg1, msg2}
12+
MsgIds = {msg1}
1313
AuditVals = {audit0, audit1}
1414
CommA = commA
1515
CommB = commB
1616
ChanA1 = chanA1
1717
ChanA2 = chanA2
1818
ChanB1 = chanB1
1919
ChanB2 = chanB2
20+
ChanFresh = chanFresh
2021
HostA = hostA
2122
HostB = hostB
2223
HostBad = hostBad
2324
NoChannel = noChannel
2425
NoCommunity = noCommunity
26+
OpenCommunities = {commA}
2527
SanitizedErrors = {"auth-required", "restricted", "invalid", "duplicate", "pow", "rate-limited", "blocked", "error", "frame-too-large"}
2628

2729
INVARIANT Safety
2830
CONSTRAINT BoundedObservations
31+
CONSTRAINT BoundedWitnesses
2932
SYMMETRY Symmetry

0 commit comments

Comments
 (0)