Skip to content

fix(auth): remove the anonymous rollback path and legacy compatibility fields - #97

Merged
toto04 merged 1 commit into
mainfrom
chore/remove-legacy-compat
Oct 27, 2026
Merged

toto04 merged 1 commit into
mainfrom
chore/remove-legacy-compat

Conversation

@BIA3IA

@BIA3IA BIA3IA commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Final cleanup after RFC v3 Phase 6 (#93). Every caller now uses IdP tokens, so what was kept for rollback and for older clients goes.

  • Anonymous path: LEGACY_ANONYMOUS is removed. A request without a token is always refused (UNAUTHORIZED), and handlers always receive the token's actor.
    • policy() loses its tokenOnly option, which is now the only behaviour.
    • The e-signing development user (agent-preview-user), which only worked on the anonymous path, goes too.
  • Grant compatibility fields: key, source and grantedBy (always idp:<id>, "idp" and null) are removed from grant lists and from tg.grants.checkUser. No consumer reads them (checked admin and telegram main).
  • tg_audit_log.admin_id (migration 0029): before the drop, any row that still has only admin_id gets it copied into actor_tg_id, so no author is lost. tg.auditLog.getById joins the actor on actor_tg_id only.
  • Socket events to the bot: adminId and performerId are removed. The bot reads only actor and performer since telegram#158.

Not marked as breaking on purpose: every consumer already stopped using these. It releases a patch.

Order

  • Merge PoliNetworkOrg/admin first: the dashboard's Telegram profile still falls back to audit.adminId; the admin PR linked below removes it.
  • PoliNetworkOrg/polinetwork-cd removes the now-ignored LEGACY_ANONYMOUS env var; it can go before or after.
  • The website must have its IdP variables set (it does in production). PoliNetworkOrg/web makes them required.
  • Merging is deploying, and migration 0029 drops a column. A backup before merging is still a good idea.

Verification

  • bun run typecheck, bunx biome ci, bun run build, bun run build:npm: OK.
  • bun run test with the Postgres integration suites: 295 passed, 1 skipped.
  • A new router test checks that every procedure refuses a call without a token.
  • Migration on a throwaway Postgres 18 migrated with today's main: a row with only admin_id keeps its author in actor_tg_id, and the column and its index are gone. drizzle-kit generate then reports no schema changes.

…y fields

Phase 6 is deployed and every caller uses IdP tokens, so the leftovers
kept for rollback and for older clients go:

- LEGACY_ANONYMOUS and the anonymous path: a request without a token is
  always refused, handlers always get the token's actor, and policy()
  loses its tokenOnly option. The e-signing development user that only
  worked on the anonymous path goes too.
- Grant compatibility fields: key, source and grantedBy (always
  idp:<id>, "idp" and null).
- tg_audit_log.admin_id (migration 0029). Rows that still have only
  admin_id get it copied into actor_tg_id first, so no author is lost.
- adminId and performerId in the socket events to the bot, which reads
  only actor and performer.

A router test now checks that every procedure refuses a call without
a token.
@coderabbitai

coderabbitai Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 37d87ac8-821b-469e-96d0-4e451b8d68af
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@toto04
toto04 merged commit 1c9f937 into main Oct 27, 2026
2 checks passed
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