BeforeMerge

AI-native code review knowledge base. Structured rules that catch what linters miss.

Product

  • Features
  • Explore
  • Pricing
  • Docs
  • GitHub

Company

  • About
  • Blog
  • Contributors
  • Contributing

Legal

  • Privacy Policy
  • Terms of Service
  • MIT License

© 2026 BeforeMerge. Built by Peter Krzyzek

BeforeMerge
Features
Explore
PricingBlogContributorsInstall Guide
3Sign In
FeaturesExplore
RulesSkillsKnowledgePrompts
PricingBlogContributorsInstall Guide
Sign In

Explore

Browse 354 rules, 42 knowledge articles, and 28 prompt templates across security, performance, architecture, and quality.

Sort:
Previous1234Next

Automate these checks on every PR

BeforeMerge scans your pull requests against these rules automatically. Get actionable feedback before code ships to production.

Join WaitlistLearn More

91 rules matching filters

Use prepared, parameterized statements

HIGH

Bind user input as parameters rather than concatenating it into SQL strings.

SecurityMySQL & MariaDB

Require TLS/SSL on all database connections

HIGH

Enforce sslmode=require (or stricter, with CA verification) so no client can connect to the managed database over plaintext.

SecurityManaged Databases

Grant least-privilege roles; never let apps use superuser

HIGH

Create scoped application roles with only the privileges they need; reserve superuser/owner accounts for migrations and admin.

SecurityManaged Databases

Rotate database credentials regularly and never share them

MEDIUM

Issue per-service credentials from a secrets manager, rotate them on a schedule, and keep them out of source control.

SecurityManaged Databases

Store secrets in env or a secret manager, never in code

CRITICAL

Keep API keys, tokens, and credentials out of source; load them from environment variables or a managed secret store.

SecurityNode.js Security

Run the process with least privilege, not as root

MEDIUM

Run Node under a dedicated unprivileged user with only the permissions it needs; never run as root.

SecurityNode.js Security

Use parameterized queries to prevent injection

CRITICAL

Build database queries with parameter binding or an ORM, never by concatenating user input into SQL/NoSQL strings.

SecurityNode.js Security

Pin and verify dependency integrity with a lockfile

MEDIUM

Commit a lockfile and install with integrity verification (npm ci) so exact, tamper-checked versions are used.

SecurityNode.js Security

Avoid leaking stack traces and internal errors to clients

MEDIUM

Return generic error messages to clients and log details server-side; never expose stack traces or internals.

SecurityNode.js Security

Implement CSRF protection for state-changing requests

HIGH

Protect non-idempotent requests with anti-CSRF tokens or SameSite cookies plus origin verification.

SecurityNode.js Security

Keep dependencies patched and run npm audit in CI

MEDIUM

Track and update dependencies regularly; run npm audit or an SCA tool in CI to block builds with known-vulnerable packages.

SecurityNode.js Security

Use HTTPS and secure, httpOnly, sameSite cookies

MEDIUM

Serve all traffic over HTTPS and set Secure, HttpOnly, and SameSite attributes on session and auth cookies.

SecurityNode.js Security

Limit request body size to prevent resource exhaustion

MEDIUM

Cap the maximum accepted request/payload size so large uploads cannot exhaust memory or bandwidth.

SecurityNode.js Security

Rate-limit public and auth endpoints

HIGH

Apply per-IP / per-account rate limiting and throttling to login, signup, password-reset, and other public endpoints.

SecurityNode.js Security

Store secrets in the CI secret store, never in code or logs

HIGH

Inject secrets from the CI secret manager at runtime; never commit them or print them to logs.

SecurityCI/CD & DevOps

Scan dependencies and images for vulnerabilities in CI

HIGH

Run dependency and container-image vulnerability scans in the pipeline and fail on critical findings.

SecurityCI/CD & DevOps

Authenticate and Authorize Every Non-Public Endpoint

CRITICAL

Require authentication on all non-public routes and enforce per-resource authorization (object-level) on every request.

SecurityAPI Design

Never Leak Internals or Stack Traces in Error Responses

CRITICAL

Return sanitized error messages for 4xx/5xx; log full stack traces server-side only and never expose them to clients.

SecurityAPI Design

Never use the admin client for reads in server actions

HIGH

createAdminClient() bypasses RLS. Use it only for writes that need service_role privileges. For reads, use createClient().

Securitynextjssupabase

Use the anon key for public-facing pages

HIGH

Public pages (explore, content detail) should use createReadOnlyClient() with the anon key, not the service_role.

Securitynextjssupabase

Never expose the service_role key to the client

CRITICAL

The SUPABASE_SERVICE_ROLE_KEY must never be in a NEXT_PUBLIC_ env var or imported in "use client" files.

Securitynextjssupabase

Enable RLS on every table

CRITICAL

Every table must have Row Level Security enabled. Tables without RLS are fully accessible via the anon key.

Securitynextjssupabase

Scope all mutations to the authenticated organization

CRITICAL

Every insert/update/delete must include organization_id from requireAuth(). RLS is defense-in-depth, not the only defense.

Securitynextjssupabase

Mark server modules with import "server-only"

HIGH

Add import "server-only" to any module that uses secrets, database connections, or server-only APIs.

Securitynextjssupabase
Next.js + Supabase Standards
Next.js + Supabase Standards
Next.js + Supabase Standards
Next.js + Supabase Standards
Next.js + Supabase Standards
Next.js + Supabase Standards