Skip to main content
Configure SQL review rules and implement security best practices for production GitOps workflows.

SQL Review Configuration

Configure SQL review rules to enforce standards across your team.

SQL Review Policy

Configure 200+ linting rules for automated validation
Critical Rules (ERROR level):
  • DROP DATABASE
  • DROP TABLE (without confirmation)
  • ❌ Missing WHERE clause in UPDATE/DELETE
  • NOT NULL on existing columns without default
  • ❌ Charset changes on existing columns
Warning Rules (WARN level):
  • ⚠️ Missing indexes on foreign keys
  • ⚠️ Column without comments
  • ⚠️ Table without primary key
  • ⚠️ Large IN clause (> 1000 items)
Info Rules:
  • 💡 Consider partitioning for large tables
  • 💡 Index naming convention suggestions

Example Policy

Review Severity Levels

Configure how different rule violations are handled:

Security Best Practices

Use Service Accounts

Create dedicated service accounts for CI/CD:
Service account setup:
  1. Create service account in Bytebase
  2. Grant the GitOps Service Agent role for automated CI/CD workflows
  3. Store token in CI/CD secrets
  4. Rotate tokens regularly
The GitOps Service Agent role is specifically designed for CI/CD integrations with minimal permissions required for automated deployments.

API Authentication

Learn about service account authentication

Least Privilege Database Access

Configure Bytebase with minimal database permissions: For schema changes:
For readonly access:
Avoid using superuser accounts.

Protect Sensitive Migrations

For migrations containing sensitive data:
Alternatives:
  • Store secrets in secret management systems (AWS Secrets Manager, HashiCorp Vault)
  • Reference secrets via environment variables in CI/CD
  • Use Bytebase secret integration

Instance Configuration

Configure database connections with secret managers

Secrets Management

Option 1: CI/CD Secrets
Option 2: Secret Manager
Option 3: External Secret Store

Audit and Compliance

Enable comprehensive audit logging:
What gets logged:
  • All schema changes
  • Who approved changes
  • When deployments occurred
  • Access to sensitive data
  • Policy violations

Audit Log

Configure audit logging for compliance

Network Security

Restrict Bytebase Access:
  • Use VPN or private networking for production
  • Enable IP allowlisting
  • Use TLS for all connections
  • Implement firewall rules
Database Connection Security:

Role-Based Access Control

Configure appropriate roles:

Roles and Permissions

Configure role-based access control

Code Review Security

Security checklist for PR/MR reviews:
  • ✅ No hardcoded secrets or passwords
  • ✅ No SELECT * exposing sensitive columns
  • ✅ Proper WHERE clauses to prevent mass updates
  • ✅ No DROP statements without explicit approval
  • ✅ Appropriate indexes to prevent performance issues
  • ✅ Data access follows compliance requirements

Next Steps

Performance

Optimize migration performance

SQL Review Rules

Complete reference of 200+ rules

Audit Log

Configure audit logging

Data Masking

Protect sensitive data