Skip to content

✨ meetings: email invites with an allowlist of proven calendar emails (Betty C2 part 4) - #18431

Merged
hivecommons-hive[bot] merged 5 commits into
v5from
feat/18395-spoke-invites
Nov 16, 2026
Merged

hivecommons-hive[bot] merged 5 commits into
v5from
feat/18395-spoke-invites

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Part 4 of #18395 (Betty C2, email in; plan #18391 "Allowlist" and "Spoke schedule"). Uses #18423 (wire contract), #18429 (hub relay and verifyRelayedRequest) and #18399 (schedule.Ingest).

Invites

POST /api/meetings/invites (relay-signed, in isPublicPath, fails closed without the relay key) ingests the invites of a hive-mx delivery into the Calendar with platform, join link, native meeting id and passcode.

  • Trust rule: an invite is scheduled at once only when the mail's From passed DMARC alignment, From is the invite's organizer, and From is a proven calendar email of a user on the live dashboard.authorized_users (owner, read-write or read). Everything else is awaiting_approval; attendees never approve. New schedule.AllowlistApprover (wired in cmd/hive) reads a per-delivery, never-stored Event.Trusted.
  • No forged changes: an invite for a meeting already on the calendar (higher SEQUENCE, an override, or a CANCEL) applies only when the delivery is authenticated as that meeting's stored organizer; otherwise it is ignored and reported, so nobody moves or cancels a meeting by copying its UID. A CANCEL for an unknown meeting is ignored.
  • 409 when invites (meetings.email.invites_enabled) or meetings are off, so the sender gets a bounce; 422 when nothing in the delivery is schedulable.

Calendar emails (new pkg/mailallow)

  • Per-user addresses in connector-state/email/allowlist.json (0600), at most 10 per user, each with a 24-hour proof code (hive-proof- + 12 base32).
  • GET/POST/DELETE /api/meetings/calendar-emails for the signed-in user (identity from X-Hive-User, any role); add returns the code and the instruction "Send an email from that address to hive@ with in the subject"; ?all=1 gives the owner the whole allowlist (no codes); the owner may remove anyone's address.
  • POST /api/meetings/calendar-emails/proof (relay-signed) proves the address whose code is in the subject only when the mail came from it with DMARC alignment; failures are recorded on the address and answered 422 (the sender's server bounces it).
  • The effective allowlist is checked against the live access list on every decision, so removing a user's access revokes their addresses at once.

Config, docs

meetings.email.invites_enabled and meetings.email.files_enabled (default on; HIVE_MEETINGS_EMAIL_*), dashboard_import_allowlist.txt (mailallow, mailin/wire), openapi.json, api-reference (citations fixed with check-docs-citations.py --fix), meetings.md ("Who can invite Betty", "Proving calendar emails"), env-vars.md.

Tests: mailallow store (add/prove/revoke/expiry/limits/persistence), the relay endpoints (signature, delivery id binding, replay, size, kind), the trust decision table, proof outcomes, the calendar-emails API by role, and the cmd/hive ingest adapter against a real scheduler (trusted vs awaiting, stale SEQUENCE, forged update/cancel/override ignored, organizer cancel applied, invalid invites).

🤖 Generated with Claude Code

@kubestellar-prow kubestellar-prow Bot added dco-signoff: yes Indicates the PR's author has signed the DCO. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 16, 2026
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#18438 🐛 fix: throttle repeated proxy-proof rejection WARN same files src/pkg/dashboard/server.go
#18463 ✨ Gateway spend: price models from the gateway, show unknown prices explicitly CONFLICT src/docs/api-reference/snapshots-and-style.md (conflict)
src/pkg/dashboard/server.go
#18432 ✨ Inbox: auto-transcribe hive recordings same files src/cmd/hive/boot_inbox.go

@hivecommons-hive

hivecommons-hive Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • overlayfs-exec-guard

Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path.

hive/awaiting-ci: rebased onto v5 (conflicts in boot_inbox.go and api-reference docs resolved, citations re-fixed). CI pending — sweep will merge when green.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325

Review findings from adjudicator (folded here because this head already carries its hive review):

Correctness review (head de34d7e) — one in-scope defect.

Delivery-level trusted is applied to every invite in the delivery

src/pkg/dashboard/api_meetings_email.go:145-151 sets trusted once per delivery. It becomes true as soon as ANY invite's organizer equals From and From is allowlisted. src/cmd/hive/meetings_email.go:108 then passes that same flag to eventFromInvite for EVERY invite. AllowlistApprover (scheduler.go, SourceEmail: return !ev.Trusted) therefore schedules all of them immediately.

A mail from an allowlisted, DMARC-aligned user can carry two VEVENTs. One has organizer = the sender. The other has organizer = anyone, for example an attacker-chosen meeting link. Both are scheduled at once, and the bot joins the second. That breaks the PR's stated rule that "From is the invite's organizer". The tests only exercise single-invite deliveries, so they don't catch it.

Fix: decide trust per invite, and compute it in the ingester.

-	trusted := false
-	for _, inv := range d.Invites {
-		if inv.Organizer != nil && strings.EqualFold(inv.Organizer.Email, d.Auth.From) {
-			trusted = s.mailTrusted(d.Auth)
-			break
-		}
-	}
+	trusted := s.mailTrusted(d.Auth) // sender allowlisted and aligned

and in IngestInvites:

-		ev, err := d.sched.Ingest(eventFromInvite(inv, del, trusted))
+		invTrusted := trusted && inv.Organizer != nil && strings.EqualFold(inv.Organizer.Email, del.Auth.From)
+		ev, err := d.sched.Ingest(eventFromInvite(inv, del, invTrusted))

Please add a test with a mixed-organizer delivery where only the own-organizer invite is scheduled and the other is awaiting_approval.

I did not check the mailallow store internals (expiry, persistence) in depth.

Review findings from adjudicator-2 (folded here because this head already carries its hive review):

Security review at head de34d7e. I found one in-scope issue to fix, plus a lower-severity note.

1. One delivery-wide trusted flag is applied to every invite in the mail (medium).

  • src/pkg/dashboard/api_meetings_email.go (handleMeetingsInvites, the loop over d.Invites) sets trusted as soon as any one invite's organizer equals From, then breaks.
  • IngestInvites passes that single flag to every invite (src/cmd/hive/meetings_email.go, eventFromInvite(inv, del, trusted)).
  • The PR body says the rule is that From is "the invite's organizer".
  • An allowlisted sender can include an ICS with two VEVENTs. One names themselves as organizer. The other names someone else, such as the owner or a colleague.
  • The second event is scheduled with no approval, with a forged Organizer. It also sets InvitedBy to that forged address.
  • That forged organizer is then what existingFor and sameInviter use to authenticate later changes and cancels.
  • The fix is to decide trust per invite inside IngestInvites. The trusted parameter would become a pre-computed "From is aligned and allowlisted" boolean, ANDed with the organizer check for each invite:
-		ev, err := d.sched.Ingest(eventFromInvite(inv, del, trusted))
+		invTrusted := trusted && inv.Organizer != nil && strings.EqualFold(inv.Organizer.Email, del.Auth.From)
+		ev, err := d.sched.Ingest(eventFromInvite(inv, del, invTrusted))

In the handler, set trusted = s.mailTrusted(d.Auth) once and drop the organizer loop.

2. An aligned organizer can change an approved meeting's join link without re-approval (low).

  • Scheduler.Ingest keeps the owner's approval for a change from the same inviter (scheduler.go:239-242, sameInviter).
  • A mail aligned for the stored organizer can therefore swap JoinURL, Platform or Passcode on an owner-approved meeting. The organizer does not need to be allowlisted.
  • The approval was given for the original link.
  • Consider clearing ApprovedBy when the join target changes on the email path. This is arguably pre-existing behaviour that this PR newly exposes over email.

I did not find a problem in the relay verification path (fail closed without a key, signature and delivery-ID check, body cap) or in the proof-code flow (mailallow.Prove requires an exact From match plus alignment). I did not run the tests.

Review findings from reviewer-2 (folded here because this head already carries its hive review):

Routing, not a defect report. This adds relay-signed routes to isPublicPath and an allowlist that bypasses approval for emailed invites, which is an auth/trust surface.

What I read: the handlers in src/pkg/dashboard/api_meetings_email.go fail closed without a relay key (readRelayedDelivery), bind the delivery id to the relay header, and mailTrusted goes through Store.Trusted -> Allowed, which requires a proven entry and a live hasMailAccess check (mailallow.go). I found no bypass there. I did not read the scheduler/Ingest changes line by line, so the forged-change protections described in the body are unverified by me.

Also: the PR is mergeable_state=dirty and needs a rebase.

Evidence bundle `#184317fc5034` sha256:9a2790f5aa933f93d0df7087e438ad9ff203aa3923178df0151d50aea09e4928 — download from the dashboard or `hivectl review evidence #18431`.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Mutation testing

⏱️ The 900s mutation budget ran out, so 3 package(s) were not fully mutated and the results below do not cover them:

  • pkg/dashboard: cut short (partial, no report)
  • pkg/mailallow: skipped (not started)
  • pkg/meetings/schedule: skipped (not started)

1 mutant(s) in changed files are not reached by any test (NOT COVERED). A maintainer may apply the mutation/acknowledged label to accept this.

File Line Mutation
src/cmd/hive/meetings_email.go 112 CONDITIONALS_NEGATION

Verdict: uncovered (#17349).

@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 16, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intent alignment (PR title + diff as contract; no linked issue): 1 in-scope gap.

Trust rule is evaluated once per delivery, not per invite. The PR body says an invite is scheduled at once only when From "is the invite's organizer". handleMeetingsInvites (src/pkg/dashboard/api_meetings_email.go, the trusted := false; for _, inv := range d.Invites {... break} loop) sets trusted = true as soon as ANY invite in the delivery has Organizer == From. IngestInvites then passes that single flag to every invite (eventFromInvite(inv, del, trusted) → Trusted: trusted, src/cmd/hive/meetings_email.go). An allowlisted sender can attach a second VEVENT whose organizer is someone else, or has no organizer, and it is scheduled immediately instead of awaiting_approval. That bypasses the owner approval the PR promises for everything that isn't allowlisted-organizer mail. The tests listed in the body cover only single-invite deliveries.

Suggested fix, in eventFromInvite:

		Source: schedule.SourceEmail, InvitedBy: d.Auth.From,
		Trusted: trusted && inv.Organizer != nil && strings.EqualFold(inv.Organizer.Email, d.Auth.From),

(add strings is already imported in that file). Add a test with a two-invite delivery where only the first is organized by From; the second must come back awaiting_approval.

Everything else matches the body: existing-meeting changes and CANCELs are gated on the stored organizer, config flags and routes are present, and the docs and openapi additions are in scope. Reviewed head de34d7e.

— hive: agent=adjudicator-3 backend=claude model=claude-sonnet-5-5 claude=2.1.325

@hivecommons-hive

Copy link
Copy Markdown
Contributor

hive/scanner: merge conflict with v5 (DIRTY) and the baseline check says the branch is 5 commits behind v5 (MERGE_BASE). Failing: testutil-guard, dashboard/rest test shards, coverage. Please merge v5 and re-check before diagnosing the test failures; not pushing to a non-hive branch.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325

@clubanderson
clubanderson force-pushed the feat/18395-spoke-invites branch from de34d7e to b5a0474 Compare November 16, 2026 16:08
@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 16, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decision needed: @clubanderson should a trusted delivery auto-schedule only the invites whose own organizer equals the authenticated From, or is whole-delivery trust intended?

The email-invite trust rule is decided once per delivery but applied to every invite in it. The PR body says an invite is auto-scheduled only when From is the invite's organizer, and the code does not enforce that per invite.

  • src/pkg/dashboard/api_meetings_email.go (handleMeetingsInvites): the loop sets trusted = s.mailTrusted(d.Auth) and breaks as soon as one invite has Organizer.Email == d.Auth.From.
  • src/cmd/hive/meetings_email.go (IngestInvites → eventFromInvite): that single boolean is stamped as Trusted: trusted on every invite in the delivery, and AllowlistApprover.NeedsApproval then returns false for each.
  • Consequence: an allowlisted, DMARC-aligned user who sends one invite they organize plus a second with a different or missing organizer gets the second scheduled at once, with its join link, platform and passcode, and no owner approval. TestEventFromInviteWithoutOrganizer asserts Trusted stays true for an invite with no organizer, so the test pins this behaviour rather than catching it.
  • The existing-meeting path is stricter and looks right: changes apply only when del.Auth.Aligned and the stored organizer equals From.

The likely fix is a per-invite check in eventFromInvite or IngestInvites, so Trusted = trusted && inv.Organizer != nil && EqualFold(inv.Organizer.Email, From), with a mixed-organizer delivery test. This touches auth and an outbound-join side effect, so I'm routing it to a human instead of calling it a defect.

Not verified: I read the dashboard handler, the ingest adapter and AllowlistApprover. I did not read mailallow.go in depth (code expiry, per-user limits), so I have no claim about it either way.

— hive: agent=reviewer backend=claude model=claude-sonnet-5-5 claude=2.1.325

@hivecommons-hive

Copy link
Copy Markdown
Contributor

scanner: CI triage — baseline check says this is PR-local (not a shared incident). TestSettingsDialogReferencesEveryHiveYAMLLeaf (settings_parity_test.go:33) fails because meetings.email.files_enabled and meetings.email.invites_enabled are new hive.yaml leaves that the Settings UI does not reference and that are not allowlisted. Fix: add controls for both keys in the Settings dialog (or, if intentionally hidden, add them to the parity test's allowlist). The coverage job fails downstream of the same test. Not pushing to this branch as it is not hive-authored.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325

@hivecommons-hive

Copy link
Copy Markdown
Contributor

hive/scanner: CI failure is PR-local (baseline check: FIX_DIFF). TestSettingsDialogReferencesEveryHiveYAMLLeaf (settings_parity_test.go:33) reports meetings.email.files_enabled and meetings.email.invites_enabled as not referenced by the Settings UI and not allowlisted. Fix: add both keys to the Settings dialog (preferred) or to the parity test allowlist. The coverage/test jobs are downstream of this. Not pushing to this branch (human-authored).


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325

@hivecommons-hive

Copy link
Copy Markdown
Contributor

scanner: CI failure is PR-local (baseline check: isolated, FIX_DIFF). TestSettingsDialogReferencesEveryHiveYAMLLeaf (settings_parity_test.go:33) reports meetings.email.files_enabled and meetings.email.invites_enabled as hive.yaml leaves not referenced by the Settings UI and not allowlisted. Fix: surface both in the Settings dialog, or add them to the parity test's allowlist with a reason. Not pushing to this branch (human-authored).


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325

@hivecommons-hive

Copy link
Copy Markdown
Contributor

hive/scanner triage: the baseline check says this is PR-local (FIX_DIFF), not a shared incident. The failing test (dashboard 2/4), test (dashboard shuffle 2/3), coverage and test jobs all trace to one test: TestSettingsDialogReferencesEveryHiveYAMLLeaf (settings_parity_test.go:33). It reports that meetings.email.files_enabled and meetings.email.invites_enabled are neither referenced by the Settings UI nor allowlisted.

Suggested fix: add the two keys to the Settings dialog, or to that test's allowlist if they are deliberately env/config-only. overlayfs-exec-guard was cancelled after 10m (a runner problem, not this diff). Not pushing, since this is a human-authored branch.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325

@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 16, 2026
@clubanderson clubanderson added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 16, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

… (Betty C2, part 4)

POST /api/meetings/invites takes hive-mx invites the hub relayed and signed
(verifyRelayedRequest) and ingests them into the Calendar: an invite whose
From address passed DMARC alignment, is its organizer and is a proven
calendar email of a user on the live access list is scheduled at once
(schedule.AllowlistApprover, Event.Trusted); everything else awaits
approval and attendees never approve. A change or CANCEL for a meeting
already on the calendar applies only when authenticated as its organizer.

New pkg/mailallow: per-user calendar emails with proof codes in
connector-state/email/allowlist.json. GET/POST/DELETE
/api/meetings/calendar-emails lists, adds (with the instruction to mail
the code to hive@<host>) and removes them; POST
/api/meetings/calendar-emails/proof proves an address from a relayed
proof mail when it is DMARC aligned for that exact address. Removing a
user's access revokes their addresses. meetings.email.invites_enabled and
files_enabled (HIVE_MEETINGS_EMAIL_*), openapi.json, api-reference,
meetings.md and env-vars.md.

Part of #18391, #18395.

Signed-off-by: Andy Anderson <andy@clubanderson.com>
Signed-off-by: Andy Anderson <andy@clubanderson.com>
Signed-off-by: Andy Anderson <andy@clubanderson.com>
@hivecommons-hive
hivecommons-hive Bot force-pushed the feat/18395-spoke-invites branch from 7e2f859 to e598128 Compare November 16, 2026 18:47
@kubestellar-prow kubestellar-prow Bot removed the lgtm Indicates that a PR is ready to be merged. label Nov 16, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

New changes are detected. LGTM label has been removed.

…s in the next PR

Signed-off-by: Andy Anderson <andy@clubanderson.com>
Signed-off-by: Andy Anderson <andy@clubanderson.com>
@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 16, 2026
@hivecommons-hive
hivecommons-hive Bot merged commit 17c285d into v5 Nov 16, 2026
89 of 90 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the feat/18395-spoke-invites branch November 16, 2026 19:05
@hivecommons-hive

Copy link
Copy Markdown
Contributor

merged by Hive trusted-author auto-merge: author @clubanderson holds role owner and GitHub permission admin on repo; CI green at 7fc5034.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. conflicts-with-open-pr Open PR has a merge conflict with another open PR dco-signoff: yes Indicates the PR's author has signed the DCO. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant