Skip to content

Close the admin's file and search doors, and Google takeovers - #194

Merged
misabegovic merged 2 commits into
mainfrom
fix/admin-gates-and-google-linking
Oct 14, 2026
Merged

misabegovic merged 2 commits into
mainfrom
fix/admin-gates-and-google-linking

Conversation

@misabegovic

Copy link
Copy Markdown
Owner

Summary

The two security gaps from the first review of the repository, now fixed and each proven by a test.

  • Avo's attachments and search controllers sat outside every policy gate, and Avo Community's own authorization allows everything. A curator could:

    • delete or replace a traveller's avatar, a tour's audio or a moment's photo;
    • search accounts by name or email.

    AdminAttachmentGate now asks the record's policy for update? before an upload or a delete. AdminSearchGate asks the resource's policy for index?. All three Avo gates are registered in config/initializers/avo_gates.rb.

  • A Google sign-in could hand an account to a stranger. Anyone could register with someone else's address, since an unconfirmed account works for three days. When the owner later signed in with Google, the account was linked and confirmed with the stranger's password and sessions intact. Now an unconfirmed account found by email gets a new password and ends every session before it's confirmed. A confirmed account keeps its password.

  • A flaky test, fixed along the way: the refused-storage browser test from Work on phones from iOS 15 and Android browsers of about 2019 #190 failed about one run in two under the full suite. It read the map's catalogue from an earlier test's HTTP cache in the shared browser. It now runs in a browser session of its own.

Test plan

  • test/integration/admin_engine_gates_test.rb:
    • a curator can't delete or replace a traveller's avatar, and can't search accounts;
    • a curator can still change a place's photos;
    • an admin can do all of it.
    • Each refusal test fails with its gate removed (checked by switching the gates off).
  • OmniAuth tests: a stranger's password and session token don't survive the link, and a confirmed account keeps its password.
  • bin/ci on the pushed commit is green: 2491 unit runs and 72 browser runs, 0 failures, signed off.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JEmikXtNoH7wAg6veTjbyT

misabegovic and others added 2 commits October 14, 2026 13:13
- Avo's attachments and search controllers sat outside every policy gate,
  and Avo Community's own check allows everything: a curator could delete or
  replace a traveller's avatar or a tour's audio and search accounts by
  email. AdminAttachmentGate asks the record's policy for update? before an
  upload or a delete; AdminSearchGate asks the resource's policy for index?.
  Each hole has a test that fails without its gate.
- Linking Google to an unconfirmed account found by email now replaces its
  password and ends its sessions before confirming it, so a stranger who
  registered with someone else's address loses the account to its owner. A
  confirmed account keeps its password.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JEmikXtNoH7wAg6veTjbyT
Under the full suite the shared browser answered the map's catalogue from
an earlier test's HTTP cache, so the map drew no places and the test failed
one run in two. Its own session starts with an empty cache, and its broken
storage reaches no other test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JEmikXtNoH7wAg6veTjbyT
@misabegovic
misabegovic merged commit 98c46a0 into main Oct 14, 2026
1 check passed
@misabegovic
misabegovic deleted the fix/admin-gates-and-google-linking branch October 14, 2026 11:26
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.

1 participant