Skip to content

fix(security): Phase 0 critical hardening (guildModuleAccess enforcement) - #664

Merged
LucasSantana-Dev merged 3 commits into
mainfrom
fix/phase-0-critical-security
Apr 16, 2026
Merged

LucasSantana-Dev merged 3 commits into
mainfrom
fix/phase-0-critical-security

Conversation

@LucasSantana-Dev

Copy link
Copy Markdown
Owner

Summary

  • 0.1 — Enforce requireGuildModuleAccess on guild routes (roles.ts, moderation.ts)
    • Roles routes (reaction-roles, roles/exclusive) now require overview:view access
    • Moderation routes (all 8 routes) now require moderation:view or moderation:manage access
    • Updated integration tests to mock guildAccessService for successful auth flows

Changes

  • packages/backend/src/routes/roles.ts — Added requireGuildModuleAccess('overview', 'view') to both routes
  • packages/backend/src/routes/moderation.ts — Added requireGuildModuleAccess('moderation', 'view'/'manage') to all 8 routes
  • Updated test mocks to reflect guildAccessService checks

Risk

None. Both fixes are non-breaking:

  • Roles routes are GET-only and no direct state changes
  • Moderation routes now match the same pattern as management, automation, and moderation tabs already using the middleware
  • All existing tests pass (750 passed)

Verification

  • Type checking: ✓ Pass
  • Linting: ✓ Pass (no new errors)
  • Tests: ✓ 750 passed, 2 skipped

@vercel

vercel Bot commented Apr 16, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lucky Ready Ready Preview, Comment Apr 16, 2026 11:18pm

Request Review

@coderabbitai

coderabbitai Bot commented Apr 16, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@LucasSantana-Dev has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 21 minutes and 57 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 21 minutes and 57 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c7390820-3f3d-46ff-b939-e3f05df164dc

📥 Commits

Reviewing files that changed from the base of the PR and between bf515fd and 7e133b3.

📒 Files selected for processing (4)
  • packages/backend/src/routes/moderation.ts
  • packages/backend/src/routes/roles.ts
  • packages/backend/tests/integration/routes/moderation.test.ts
  • packages/backend/tests/integration/routes/roles.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/phase-0-critical-security

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 and usage tips.

@LucasSantana-Dev
LucasSantana-Dev enabled auto-merge (squash) April 16, 2026 23:10
@sonarqubecloud

Copy link
Copy Markdown

@LucasSantana-Dev
LucasSantana-Dev merged commit bf7bf80 into main Apr 16, 2026
12 checks passed
LucasSantana-Dev added a commit that referenced this pull request May 13, 2026
…ent) (#664)

* fix(security): require guildModuleAccess on roles and moderation routes

* test(security): update role and moderation tests to mock guildAccessService
@LucasSantana-Dev
LucasSantana-Dev deleted the fix/phase-0-critical-security branch May 23, 2026 02:21

This branch was successfully deployed

1 active deployment
Preview — 7e133b3c Deployed Apr 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant