Skip to content

2.0.0-rc.3: security fixes, CI pipeline and docs cleanup - #42

Merged
rickypid merged 12 commits into
insideapp-srl:mainfrom
rickypid:fix/security-audit
Oct 23, 2026
Merged

rickypid merged 12 commits into
insideapp-srl:mainfrom
rickypid:fix/security-audit

Conversation

@rickypid

@rickypid rickypid commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What does it do?

Third release candidate of 2.0.0 (2.0.0-rc.3): fixes the findings of a security audit of the package, adds the GitHub Actions pipeline and cleans up template leftovers in the docs.

Security fixes (SQL scripts, Edge Function, Dart client, example app):

  • The media cleanup queue only accepts a chats_assets object in the deleted message's own room folder, not referenced by another message; cleanup-media re-checks every row, retries failing objects and leaves aside the ones that keep failing. Before, a message source could make the function delete any Storage object of the project with the service role.
  • httpSupabaseHeadersFor(url) sends the access token to this project's Storage only; httpSupabaseHeaders (sent to any URL, including avatars and message sources other users choose) is deprecated. Example and docs updated.
  • Column privileges on rooms, room_members, users; role changes for real group admins only. A direct-room member could add third parties to a 1-to-1 conversation.
  • Unique message ids (chats.message_ids), RPCs bound to the row they authorized, server-assigned createdAt (a far-future value blocked partition maintenance), server-owned status/reactions/pin, edit = content only, forward origin attested by the database.
  • Realtime: only the database sends on chats:room:<id> (members could forge message events), typing on chats:room:<id>:typing, room/membership changes on a private chats:user:<uid> channel instead of Postgres Changes (DELETE events leaked memberships), private presence, removed members disconnected.
  • chats_assets objects are overwritten by their uploader, deleted by their uploader or a group admin.
  • The partman-run-maintenance cron job always failed (shared transaction block): split in two jobs, plus an event trigger securing new partitions.
  • Example app: sanitized download names, confirmation before opening (documents and media only).

CI: format/analyze/unit tests/pana on Flutter 3.35.0 (the minimum, package only) and stable, pgTAP + integration tests on a local Supabase stack, docs build; Pages via actions/deploy-pages; publish to pub.dev on v* tags behind the pub.dev environment approval; Dependabot.

SDK: minimum raised to Dart 3.9 / Flutter 3.35 (supabase_flutter >= 2.16 requires it); the example app requires Dart 3.11 (file_saver 0.4).

Docs: Realtime, security, usage and triggers guides, MIGRATION.md section for release candidate users, Docusaurus/CONTRIBUTING/issue template placeholders fixed, LICENSE copyright line for InsideApp.

Why is it needed?

The audit found two high-severity issues (arbitrary Storage deletion through cleanup-media, session token sent to attacker-chosen URLs) and several medium/low ones; they must be fixed before 2.0.0.

How to test it?

supabase start
bash tool/local_db.sh
supabase test db                          # 95 pgTAP tests (28 new regression tests)
bash tool/test_integration.sh --no-reset  # 29 integration tests (2 new)
flutter test --exclude-tags integration   # 36 unit tests

All of them pass locally; the v1 → v2 migration (V1_REF=v1.6.2 tool/v1_fixture.sh && tool/local_db.sh --no-reset) and tool/test_storage_migration.sh pass too.

Upgrade note: the database and the Realtime protocol change together: re-run the SQL scripts and update the package at the same time (see MIGRATION.md).

Repository settings needed after merge:

  • Settings > Pages > Source: "GitHub Actions".
  • Settings > Environments: create pub.dev with required reviewers.
  • pub.dev > Admin > Automated publishing: enable GitHub Actions for this repository, tag pattern v{{version}}, environment pub.dev.

Related issues/PRs

Follows #41 (2.0.0-rc.2).

🤖 Generated with Claude Code

rickypid and others added 12 commits March 9, 2026 16:31
Replace the Docusaurus placeholders (footer "My Project, Inc.", default
README, template comments, tutorial sidebar naming) and the Flyer Chat
references copied into CONTRIBUTING and the issue templates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…audit

- media cleanup queue only accepts the deleted message's own room
  attachments; cleanup-media re-checks rows and retries failing ones
- httpSupabaseHeadersFor(url) sends the token to this project's Storage
  only; httpSupabaseHeaders is deprecated
- column privileges on rooms, room_members and users; role changes for
  group admins only (no third member in direct rooms)
- unique message ids (chats.message_ids), RPCs bound to the authorized
  row, server-assigned createdAt, server-owned status/reactions/pin,
  attested forward origin
- Realtime: database-only message channel, separate typing channel,
  per-user room change channel, private presence, removed members
  disconnected; rooms/room_members out of the publication
- chats_assets overwritten by the uploader, deleted by uploader or admin
- partman cron job no longer fails; new partitions secured on creation
- example app: safe download names, confirmation before opening files
- pgTAP and integration regression tests, docs and migration notes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI runs format, analyze, unit tests and pana on the minimum and latest
Flutter, pgTAP and integration tests on a local Supabase stack, and the
docs build. Docs deploy through actions/deploy-pages; publishing runs on
version tags behind the pub.dev environment approval.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
supabase_flutter >=2.16.0 requires Dart 3.9, so the declared Dart 3.8 /
Flutter 3.32 minimum could not resolve (caught by the CI job on the
minimum Flutter). pana needs cwebp/gif2webp to check the screenshots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The example app depends on file_saver 0.4, which needs Dart 3.11: its SDK
constraint now says so, and the minimum-version job skips it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rickypid
rickypid merged commit d6e43aa into insideapp-srl:main Oct 23, 2026
4 checks passed
@rickypid
rickypid deleted the fix/security-audit branch October 23, 2026 15:55
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