Skip to content

fix(basedao): reject empty member ids and use the constructor's realm - #66

Closed
davd-gzl wants to merge 2 commits into
feat/topaz-v2-renamefrom
fix/realm-identity-hardening
Closed

davd-gzl wants to merge 2 commits into
feat/topaz-v2-renamefrom
fix/realm-identity-hardening

Conversation

@davd-gzl

@davd-gzl davd-gzl commented Jul 19, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #65 and targeting its branch.

A DAO cannot identify a caller from another realm, so CallerID resolves to the empty string there. AddMember accepted "" as a member id, so one such member let any unidentified cross-realm caller pass the member gate and propose, vote and execute. Rejecting it closes that, including the NewMembersStore path. New now records the realm it was handed instead of reading unsafe.CurrentRealm(), which returns the borrower, and the member-only README example reads cur.Previous() under an IsCurrent guard instead of stack-walking in a non-crossing function.

Verified at the topaz-1 launch tip fc4052651: packages and demo realms green, lint clean, three new tests, and the fixture that previously let a foreign realm write through the DAO now fails at construction. The Execute realm threading and the lambda handler are untouched, since both change public interfaces.

CallerID cannot name a caller from another realm and resolves to the
empty string there. AddMember accepted "" as a member id, so a single
such member let any unidentified cross-realm caller pass the member
gate and propose, vote and execute.

- AddMember rejects an empty member id, which also covers the
  NewMembersStore initial-members path.
- New records the realm it was handed rather than reading
  unsafe.CurrentRealm(), which returns the borrower.
- The member-only README example is a crossing function reading
  cur.Previous() under an IsCurrent guard, instead of stack-walking
  with unsafe.PreviousRealm() in a non-crossing function.
@davd-gzl
davd-gzl marked this pull request as draft July 19, 2026 18:39
@davd-gzl
davd-gzl marked this pull request as ready for review July 19, 2026 23:03
@zxxma

zxxma commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

@davd-gzl thanks for this — closing because it has landed, not because it was dropped.

Your AddMember("") guard and its tests are in feat/topaz-v2-rename via #70, committed under your authorship (eee13ee). Your README change carried over too, with one correction: a member id is a pkgpath for a realm caller and an address only for an account, so ext.IsMember(caller.Address().String()) would have silently locked out every realm member.

The one part I did not take is the change to New(). d.Realm is what the entry points now compare the threaded realm against, so a caller-supplied value would let whoever calls New() decide the identity the DAO later requires of itself — and gno's stdlib says of runtime.NewRealm in as many words: "Callers should NOT use this to fabricate realm-context for authorization — a constructed Realm is just a (addr, pkgPath) tuple and carries no runtime-validated authority." It stays unsafe.CurrentRealm().

Related: your #15 is closed by this work too — that was P0-B, and a foreign realm can no longer make the DAO act under its identity.

I know you declined the interface-breaking scope here, and #69–#72 went ahead with it because the topaz-1 publish is immutable and it was now-or-never. Genuinely open to feedback on any of it — if you disagree with a call, say so and we'll revisit before the ceremony runs.

@zxxma zxxma closed this Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants