Skip to content

[codex] remove zod from backend validation#1902

Open
riderx wants to merge 36 commits intomainfrom
codex/arktype-rbac-pilot
Open

[codex] remove zod from backend validation#1902
riderx wants to merge 36 commits intomainfrom
codex/arktype-rbac-pilot

Conversation

@riderx
Copy link
Copy Markdown
Member

@riderx riderx commented Apr 9, 2026

Summary (AI generated)

  • migrate backend and backend-adjacent tests from Zod to ArkType/standard-schema validation helpers
  • replace plugin request parsing and remaining private/public validator usage so source no longer imports zod
  • remove direct zod dependency and Deno import-map entries, and rename the old contract test to plugin-validation.test.ts

Motivation (AI generated)

The branch started as a narrow RBAC pilot, but the migration target is now the full repository validator surface. This update carries the migration through the remaining backend runtime paths and test assertions so the codebase no longer depends on Zod directly.

Business Impact (AI generated)

This standardizes validation on ArkType across the backend, reduces validator drift between endpoints and tests, and removes a deprecated parallel validation stack. It also keeps plugin compatibility behavior explicit on high-traffic endpoints instead of splitting logic between two schema libraries.

Test Plan (AI generated)

  • bun lint:backend
  • bun typecheck
  • bunx vitest run tests/plugin-validation.test.ts tests/admin-stats.unit.test.ts tests/queue-consumer-message-shape.unit.test.ts
  • DB-backed integration suites run in GitHub Actions (local Docker/OrbStack unavailable in this session)

Generated with AI

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 9, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Centralized RBAC request validation and JSON parsing were added via a new rbac_validation.ts and @hono/standard-validator/arktype schemas; private RBAC handlers (groups, role_bindings, roles) were refactored to use these validators. Drizzle client init and Deno dependency maps were updated; unit tests for validation and auth-order were added.

Changes

Cohort / File(s) Summary
Dependencies & Config
package.json, supabase/functions/deno.json
Added @hono/standard-validator, arktype, @standard-schema/spec; upgraded drizzle-orm to 1.0.0-beta.21 (pinned beta).
Validation Module
supabase/functions/_backend/private/rbac_validation.ts
New centralized validation: arktype schemas for params/bodies, validateJsonBody, Standard Schema v1 issue interpretation, and standardized Hono error-hooks returning 400 { error: ... }.
Groups Endpoint
supabase/functions/_backend/private/groups.ts
Replaced ad-hoc UUID and JSON parsing with sValidator and validateJsonBody; handlers now read validated inputs via c.req.valid(...) and removed inline checks and explicit Context typing.
Role Bindings Endpoint
supabase/functions/_backend/private/role_bindings.ts
Switched to sValidator/validateJsonBody + hooks; removed local parsing utilities and type aliases; handlers use validated params/body and preserved permission/DB logic.
Roles Endpoint
supabase/functions/_backend/private/roles.ts
Replaced local scope-type validation with sValidator + schema hook; handlers read scope_type from validated params and removed local defs.
DB Client Init
supabase/functions/_backend/utils/pg.ts
Changed Drizzle initialization to options form: drizzle({ client: db, schema, logger: true }) instead of positional args.
Tests
tests/private-rbac-validation.unit.test.ts, tests/private-rbac-auth-order.unit.test.ts, tests/organization-api.test.ts
Added unit tests for RBAC validation hooks and auth-vs-validation ordering; updated organization API test to use creator-specific auth headers.

Sequence Diagram(s)

sequenceDiagram
  participant Client as Client
  participant App as Hono App
  participant Auth as Auth Middleware
  participant Validator as rbac_validation
  participant DB as Database

  Client->>App: HTTP request (params/body)
  App->>Auth: authenticate request
  alt auth fails
    Auth-->>Client: 401 Unauthorized
  else auth succeeds
    App->>Validator: validate params/body (sValidator / validateJsonBody)
    alt validation fails
      Validator-->>Client: 400 { error: "..." }
    else validation succeeds
      App->>DB: perform action (query/insert/update/delete)
      DB-->>App: result
      App-->>Client: 200/204 response
    end
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

codex

Poem

🐇 I hopped through schemas, neat and spry,

Hooks caught errors as they fluttered by,
Params now tidy, JSON parsed with care,
Tests thumped approval in the quiet air,
A crunchy carrot for validators fair.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title '[codex] remove zod from backend validation' accurately describes the main objective of migrating from Zod to ArkType/standard-schema validation across the backend, matching the summary and changes in the PR.
Description check ✅ Passed The PR description includes a comprehensive AI-generated summary with motivation and business impact, and lists test plan items, but the author-provided description structure does not fully match the repository template format.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/arktype-rbac-pilot

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

@codspeed-hq
Copy link
Copy Markdown
Contributor

codspeed-hq bot commented Apr 9, 2026

Merging this PR will not alter performance

✅ 28 untouched benchmarks


Comparing codex/arktype-rbac-pilot (7342740) with main (110282f)

Open in CodSpeed

@riderx riderx marked this pull request as ready for review April 10, 2026 14:25
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 023453b7de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread supabase/functions/_backend/private/rbac_validation.ts Outdated
Comment thread supabase/functions/_backend/private/rbac_validation.ts Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
eslint.config.js (1)

18-27: Remove duplicate Object.groupBy polyfill block.

This block is redundant after the earlier guard at Line 3; it adds dead/duplicate fallback logic and increases config drift risk.

♻️ Proposed cleanup
-if (!Object.groupBy) {
-  Object.groupBy = function groupBy(items, callbackfn) {
-    return items.reduce((groups, item, index) => {
-      const key = callbackfn(item, index)
-      groups[key] ??= []
-      groups[key].push(item)
-      return groups
-    }, Object.create(null))
-  }
-}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@eslint.config.js` around lines 18 - 27, Remove the duplicate Object.groupBy
polyfill block: delete the second if (!Object.groupBy) { function groupBy(...) {
... } } block so only the original guard-and-definition remains; ensure the only
definition is the earlier guarded polyfill for Object.groupBy and no other
duplicate fallback exists.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@supabase/functions/_backend/private/groups.ts`:
- Around line 30-31: The route-level param/body validators (sValidator('param',
orgIdParamSchema, invalidOrgIdHook)) are being executed before authentication,
causing anonymous requests with bad input to return 400 instead of 401; reorder
the middleware so authentication runs first (move the auth handler before
sValidator) for the app.get('/:org_id', app.post, app.put and app.delete routes
in this file (look for usages of sValidator, orgIdParamSchema, invalidOrgIdHook
and the route handlers that extract c.req.valid), and apply the same change to
the other affected declarations noted in the comment so auth always executes
prior to validation.

In `@supabase/functions/_backend/private/role_bindings.ts`:
- Around line 122-123: The route-level validators (sValidator(...)) are running
before the authentication/Unauthorized check, causing malformed anonymous
requests to return 400 instead of 401; fix by ensuring auth enforcement runs
before validation: reorder middleware so the authentication check/middleware
(the Unauthorized check used elsewhere in this file) executes prior to
sValidator (or add a dedicated auth middleware ahead of sValidator) for
app.get('/:org_id') and apply the same change to the POST, PATCH and DELETE
routes referenced (the handlers around the other sValidator usages). Ensure you
reference and preserve the existing Unauthorized/auth check symbol when
reordering so validation only runs after auth.

In `@supabase/functions/_backend/private/roles.ts`:
- Line 16: The route registers currently run sValidator(...) before the
authentication guard, causing unauthenticated requests with invalid params to
return 400 instead of 401; reorder middleware so the auth guard runs first
(e.g., register authGuard before sValidator in the middleware list for
app.get('/', ...) and the other affected route around lines 55-56), ensuring
authGuard(...) executes before sValidator(...) so authentication is enforced
prior to validation.

In `@tests/private-rbac-validation.unit.test.ts`:
- Around line 19-23: Replace the type alias named StandardSchema with an
interface declaration to satisfy ts/consistent-type-definitions; keep the same
shape and method signature (the nested '~standard' property and its validate
method returning StandardSchemaV1.Result<unknown> |
Promise<StandardSchemaV1.Result<unknown>>), i.e., convert the "type
StandardSchema = { ... }" declaration into "interface StandardSchema { ... }"
preserving the property and validate signature.

---

Nitpick comments:
In `@eslint.config.js`:
- Around line 18-27: Remove the duplicate Object.groupBy polyfill block: delete
the second if (!Object.groupBy) { function groupBy(...) { ... } } block so only
the original guard-and-definition remains; ensure the only definition is the
earlier guarded polyfill for Object.groupBy and no other duplicate fallback
exists.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6466c357-75dd-4d3a-b91b-7db0d75d14ca

📥 Commits

Reviewing files that changed from the base of the PR and between 299a8ab and 023453b.

⛔ Files ignored due to path filters (2)
  • bun.lock is excluded by !**/*.lock
  • supabase/functions/deno.lock is excluded by !**/*.lock
📒 Files selected for processing (9)
  • eslint.config.js
  • package.json
  • supabase/functions/_backend/private/groups.ts
  • supabase/functions/_backend/private/rbac_validation.ts
  • supabase/functions/_backend/private/role_bindings.ts
  • supabase/functions/_backend/private/roles.ts
  • supabase/functions/_backend/utils/pg.ts
  • supabase/functions/deno.json
  • tests/private-rbac-validation.unit.test.ts

Comment thread supabase/functions/_backend/private/groups.ts
Comment thread supabase/functions/_backend/private/role_bindings.ts
Comment thread supabase/functions/_backend/private/roles.ts
Comment thread tests/private-rbac-validation.unit.test.ts Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 79a091d128

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread supabase/functions/_backend/private/groups.ts Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c355dd926c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread supabase/functions/_backend/private/rbac_validation.ts Outdated
Comment thread supabase/functions/_backend/private/rbac_validation.ts Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
supabase/functions/_backend/private/role_bindings.ts (1)

122-129: ⚠️ Potential issue | 🟠 Major

Auth check runs after param validation — potential API regression.

The sValidator middleware at line 123 runs before the handler body, meaning an invalid org_id from an unauthenticated request returns 400 Invalid org_id instead of 401 Unauthorized. This changes the error contract for anonymous requests with malformed params.

If preserving "401 before 400" semantics is required, consider extracting the auth check into a middleware that runs before sValidator:

Suggested pattern
+function requireAuth(c: Context, next: () => Promise<void>) {
+  if (!c.get('auth')?.userId) {
+    return c.json({ error: 'Unauthorized' }, 401)
+  }
+  return next()
+}
+
 // GET /private/role_bindings/:org_id - List role bindings for an org
-app.get('/:org_id', sValidator('param', orgIdParamSchema, invalidOrgIdHook), async (c) => {
+app.get('/:org_id', requireAuth, sValidator('param', orgIdParamSchema, invalidOrgIdHook), async (c) => {
   const { org_id: orgId } = c.req.valid('param')
-  const userId = c.get('auth')?.userId
-
-  if (!userId) {
-    return c.json({ error: 'Unauthorized' }, 401)
-  }
+  const userId = c.get('auth')!.userId

Apply the same ordering to POST (line 190), PATCH (line 325), and DELETE (line 428) routes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@supabase/functions/_backend/private/role_bindings.ts` around lines 122 - 129,
The current route handlers attach sValidator('param', orgIdParamSchema,
invalidOrgIdHook) before performing the auth check inside the handler, causing
malformed org_id from anonymous requests to return 400 instead of the desired
401; fix by extracting the auth check into a middleware that runs before
sValidator (e.g., create an auth middleware that checks c.get('auth')?.userId
and returns 401 if missing) and apply it to the routes that validate
org_id—specifically the GET '/:org_id' handler (where sValidator is used), and
likewise reorder middleware for the POST, PATCH, and DELETE org_id routes so the
auth middleware runs before sValidator('param', orgIdParamSchema,
invalidOrgIdHook).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@supabase/functions/_backend/private/role_bindings.ts`:
- Around line 122-129: The current route handlers attach sValidator('param',
orgIdParamSchema, invalidOrgIdHook) before performing the auth check inside the
handler, causing malformed org_id from anonymous requests to return 400 instead
of the desired 401; fix by extracting the auth check into a middleware that runs
before sValidator (e.g., create an auth middleware that checks
c.get('auth')?.userId and returns 401 if missing) and apply it to the routes
that validate org_id—specifically the GET '/:org_id' handler (where sValidator
is used), and likewise reorder middleware for the POST, PATCH, and DELETE org_id
routes so the auth middleware runs before sValidator('param', orgIdParamSchema,
invalidOrgIdHook).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5e1eb6e4-b7d1-438f-b734-9882d8f413fa

📥 Commits

Reviewing files that changed from the base of the PR and between 79a091d and c355dd9.

📒 Files selected for processing (4)
  • supabase/functions/_backend/private/groups.ts
  • supabase/functions/_backend/private/rbac_validation.ts
  • supabase/functions/_backend/private/role_bindings.ts
  • tests/private-rbac-validation.unit.test.ts
✅ Files skipped from review due to trivial changes (1)
  • supabase/functions/_backend/private/groups.ts

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 120ace77b9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread supabase/functions/_backend/private/rbac_validation.ts Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@supabase/functions/_backend/private/rbac_validation.ts`:
- Around line 76-77: In the two JSON-parse catch blocks inside
rbac_validation.ts (the catch around reading/parsing the body and the second
similar catch), stop passing the thrown parse `error` into simpleErrorWithStatus
as `{ error }` (which overwrites the legacy `error` code); instead preserve the
helper's `error` field by passing the legacy code only and move the raw parse
information into a different key such as `{ parseError: String(error) }` or `{
parse_error: String(error) }` (or omit sensitive internals entirely), so call
simpleErrorWithStatus(...) with the legacy error code and additional info under
a non-conflicting property; update both occurrences where `{ error }` is
currently passed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bc95cd0d-352a-42f0-afc6-6ea34379293c

📥 Commits

Reviewing files that changed from the base of the PR and between c355dd9 and 120ace7.

📒 Files selected for processing (2)
  • supabase/functions/_backend/private/rbac_validation.ts
  • tests/private-rbac-validation.unit.test.ts

Comment thread supabase/functions/_backend/private/rbac_validation.ts Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
tests/organization-api.test.ts (1)

124-127: Assert API key payload shape before dereferencing id/key.

The optional response type plus non-null assertions can hide contract regressions and fail later with less-clear errors. Validate shape immediately after the status check.

Suggested change
-    const createdKey = await createResponse.json<{ id?: number, key?: string, error?: string, message?: string }>()
-    expect(createResponse.status, JSON.stringify(createdKey)).toBe(200)
-    readOnlyKey = createdKey.key!
-    readOnlyKeyId = createdKey.id!
+    const createdKey = await createResponse.json<{ id?: number, key?: string, error?: string, message?: string }>()
+    expect(createResponse.status, JSON.stringify(createdKey)).toBe(200)
+    const parsedKey = z.object({ id: z.number(), key: z.string() }).parse(createdKey)
+    readOnlyKey = parsedKey.key
+    readOnlyKeyId = parsedKey.id
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/organization-api.test.ts` around lines 124 - 127, The test dereferences
createdKey.id and createdKey.key with non-null assertions after parsing
createResponse, which can mask payload regressions; update the test around
createResponse / createdKey to assert the payload shape immediately after the
status check by verifying createdKey has both id and key and they are the
expected types (e.g., id is a number and key is a string) before assigning to
readOnlyKey and readOnlyKeyId (references: variables createdKey, createResponse,
readOnlyKey, readOnlyKeyId).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/organization-api.test.ts`:
- Around line 124-127: The test dereferences createdKey.id and createdKey.key
with non-null assertions after parsing createResponse, which can mask payload
regressions; update the test around createResponse / createdKey to assert the
payload shape immediately after the status check by verifying createdKey has
both id and key and they are the expected types (e.g., id is a number and key is
a string) before assigning to readOnlyKey and readOnlyKeyId (references:
variables createdKey, createResponse, readOnlyKey, readOnlyKeyId).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6caecc43-ed49-42d4-842b-ec5914dec52c

📥 Commits

Reviewing files that changed from the base of the PR and between 120ace7 and c3add38.

📒 Files selected for processing (1)
  • tests/organization-api.test.ts

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aaa196b0cf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread supabase/functions/_backend/private/groups.ts
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b1759fbee2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread supabase/functions/_backend/private/groups.ts Outdated
@riderx riderx changed the title [codex] pilot arktype validation for private rbac routes [codex] remove zod from backend validation Apr 11, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 337b3d6e2e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread supabase/functions/_backend/utils/plugin_validation.ts
@socket-security
Copy link
Copy Markdown

socket-security bot commented Apr 11, 2026

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ef309db13d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread supabase/functions/_backend/private/verify_email_otp.ts Outdated
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7342740533

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +38 to +45
v_is_super_admin := EXISTS (
SELECT 1
FROM public.org_users
WHERE org_users.org_id = NEW.org_id
AND org_users.user_id = auth.uid()
AND org_users.app_id IS NULL
AND org_users.channel_id IS NULL
AND org_users.user_right = public.rbac_right_super_admin()::public.user_min_right
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve legacy 2FA/password-policy checks for super-admin trigger

The new check_org_user_privileges() migration replaces the legacy-path super-admin gate from check_min_rights('super_admin', ...) to a direct org_users lookup, which drops the built-in 2FA and password-policy enforcement in check_min_rights_legacy. For orgs with RBAC disabled, authenticated super-admins who do not satisfy these controls can now pass the trigger’s v_is_super_admin check and proceed with privileged org_users writes that were previously blocked by the legacy gate.

Useful? React with 👍 / 👎.

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