Database Connections
CodescanBot can do more than explain vulnerabilities — it can fix them end-to-end. When a security fix requires a database change (a stored procedure, a constraint, an index, a schema alteration), the bot generates the exact SQL or command, shows it to you for review, and executes it directly against your database with one click.
What you need before you start
Supported databases
CodescanBot supports two modes for each database:
Bot connects and runs the migration automatically
Bot writes the migration script — you copy and run it
| Database | Mode | Covers |
|---|---|---|
| 🐘 PostgreSQL | Live execution | Supabase · Neon · CockroachDB · AWS RDS · Railway · Render |
| ⚡ Supabase | Live execution | Supabase Cloud (simplified URL + Service Role Key flow) |
| 🐬 MySQL / MariaDB | Live execution | PlanetScale · AWS RDS MySQL · Aurora · ClearDB |
| 🍃 MongoDB | Live execution | MongoDB Atlas · AWS DocumentDB · Azure Cosmos DB |
| 🪟 SQL Server | Live execution | Azure SQL Database · AWS RDS MSSQL · On-Premise |
| ⚡ Redis | Live execution | Redis Cloud · Upstash · AWS ElastiCache · Heroku Redis |
| ◉ Cassandra | Live execution | Apache Cassandra · DataStax Astra · AWS Keyspaces |
| ◈ Oracle DB | Script-only | Oracle Database · Oracle Cloud · Oracle XE |
| ⬡ DynamoDB | Script-only | AWS DynamoDB |
| ❄ Snowflake | Script-only | Snowflake Cloud Data Platform |
| ◈ BigQuery | Script-only | Google Cloud BigQuery |
| 🔥 Firestore | Script-only | Firebase / Google Cloud Firestore |
| 📁 SQLite | Script-only | Local development only |
How to connect and run a migration
Step 1 — Open CodescanBot
- Go to codesscan.com/scan and scan your code
- Click ◈ CodescanBot in the scanner header (or press Ctrl+K)
- Select a vulnerability from the findings list
Step 2 — Configure your database connection
- In the CodescanBot panel header, click the 🗄 DB button
- A database panel slides open — click the tab for your database type
- Fill in the connection credentials (see the per-database guides below)
- The button shows 🗄 DB ● when credentials are entered
Step 3 — Ask the bot to fix the vulnerability
- Type “fix this” or click the ⚡ Apply fix chip
- The bot fixes the code file AND, if a DB change is needed, generates the migration automatically
- A DATABASE MIGRATION READY panel appears showing the exact SQL
- Review the SQL — then click ▶ Execute Migration (live databases) or 📋 Copy Migration Script (script-only)
- The result is shown immediately: ✅ success or ❌ error with the database message
PostgreSQL — connection guide
Covers Supabase, Neon, CockroachDB, AWS RDS PostgreSQL, Railway, Render, and any self-hosted PostgreSQL instance.
Option A — Connection string (recommended)
# Standard PostgreSQL URL format
postgresql://username:password@host:5432/database_name
# With SSL (required for most cloud providers)
postgresql://username:password@host:5432/database_name?sslmode=require
# Examples
postgresql://postgres:mypass@db.mycompany.com:5432/production
postgresql://user:pass@ep-xyz.us-east-2.aws.neon.tech/neondb?sslmode=requireOption B — Individual fields
| Field | Description | Default |
|---|---|---|
| Host | Database server hostname or IP | localhost |
| Port | PostgreSQL port | 5432 |
| Database | Name of the database to connect to | postgres |
| Username | PostgreSQL user | postgres |
| Password | User password | — |
| SSL | Set to true for cloud-hosted databases | false |
Supabase — connection guide
Use the Supabase tab for the simplest setup — just your project URL and Service Role Key. CodeScan derives the correct PostgreSQL connection string automatically.
- Log in to supabase.com → open your project
- Go to Project Settings → API
- Copy the Project URL (format:
https://xyz.supabase.co) - Copy the service_role key (under Project API keys — not the anon key)
- Paste both into the Supabase tab in the DB panel
MySQL / MariaDB — connection guide
Covers MySQL 5.7+, MySQL 8.x, MariaDB 10.x, PlanetScale, AWS RDS MySQL, and Amazon Aurora MySQL.
# Connection string format
mysql://username:password@host:3306/database_name
# With SSL
mysql://username:password@host:3306/database_name?ssl=true
# PlanetScale (requires SSL)
mysql://user:pscale_pw_xxx@host.us-east.psdb.cloud/database?ssl={"rejectUnauthorized":true}
# AWS RDS MySQL
mysql://admin:password@mydb.abc123.us-east-1.rds.amazonaws.com:3306/mydbWhere to find credentials:
- PlanetScale: Dashboard → Database → Connect → Create password → choose Node.js driver → copy connection string
- AWS RDS: RDS Console → Databases → your instance → Connectivity tab → Endpoint + Port
- Self-hosted: Use the host where MySQL is running, port 3306, and a user with
ALTERandCREATE ROUTINEprivileges
MongoDB — connection guide
Covers MongoDB Atlas, AWS DocumentDB, and Azure Cosmos DB for MongoDB. For MongoDB, migrations are sent as JSON commands (not SQL) that the bot formats automatically.
# MongoDB Atlas (SRV format — recommended)
mongodb+srv://username:password@cluster0.abc123.mongodb.net/myDatabase
# Standard format
mongodb://username:password@host:27017/database
# With auth source
mongodb://username:password@host:27017/database?authSource=admin
# Atlas example
mongodb+srv://codescan:MyPass123@cluster0.xyz.mongodb.net/productionWhere to find your Atlas connection string:
- Atlas → your cluster → Connect
- Choose Drivers → Node.js
- Copy the connection string and replace
<password>with your actual password
{"createIndexes":"users","indexes":[{"key":{"email":1},"name":"email_unique","unique":true}]}. These run via db.command() directly.Microsoft SQL Server — connection guide
Covers Azure SQL Database, AWS RDS for SQL Server, and on-premise SQL Server 2016+.
| Field | Description | Azure SQL example |
|---|---|---|
| Server | Server hostname | myserver.database.windows.net |
| Port | SQL Server port | 1433 |
| Database | Database name | mydb |
| Username | SQL login | sqladmin |
| Password | SQL login password | •••••• |
| Encrypt | true for Azure SQL, false for on-prem without SSL | true |
| Trust Cert | true for self-signed certs (dev/local only) | false |
For Azure SQL, find the server name in Azure Portal → SQL databases → your database → Overview → Server name.
Redis — connection guide
Covers Redis Cloud, Upstash, AWS ElastiCache, and Heroku Redis. Redis migrations run as commands (SET, HSET, CONFIG SET, etc.) rather than SQL.
# Connection string formats
redis://password@host:6379
redis://username:password@host:6379
rediss://password@host:6380 # rediss:// = TLS
# Upstash (always TLS)
rediss://default:AXXXpasy...@us1-abc.upstash.io:6380
# Redis Cloud
redis://:mypassword@redis-12345.c1.us-east-1-1.ec2.cloud.redislabs.com:12345
# AWS ElastiCache (no password by default, TLS optional)
redis://my-cluster.abc123.ng.0001.use1.cache.amazonaws.com:6379Cassandra — connection guide
Covers Apache Cassandra, DataStax Astra DB, and AWS Keyspaces. Migrations run as CQL (Cassandra Query Language).
| Field | Description | Example |
|---|---|---|
| Contact Points | Comma-separated host(s) | 127.0.0.1 or node1,node2 |
| Port | CQL native transport port | 9042 |
| Keyspace | Keyspace to connect to | my_keyspace |
| Data Center | Local DC for load balancing | datacenter1 |
| Username | Cassandra user | cassandra |
| Password | User password | •••••• |
Script-only databases
For Oracle, DynamoDB, Snowflake, BigQuery, Firestore, and SQLite — CodescanBot generates the correct migration syntax for the selected database but cannot execute it directly (these databases require native drivers or cloud SDKs that cannot run in a serverless environment). Instead:
- Select the database type in the DB panel
- Ask the bot to fix the vulnerability — it generates the correct migration syntax for your database
- A 📋 Copy Migration Script button appears instead of Execute
- Click it to copy the migration to your clipboard
- Paste and run it in your database console or CLI
Where to run script-only migrations
Safety and security
Troubleshooting
Quick reference
# ── Open CodescanBot ──────────────────────────────────────────────
# Click ◈ CodescanBot in scanner header OR Ctrl+K
# ── Connect your database ─────────────────────────────────────────
# Click 🗄 DB → pick database tab → fill credentials
# Green dot (🗄 DB ●) = credentials entered
# ── Trigger a migration ───────────────────────────────────────────
# Select a vulnerability → ask bot to "fix this"
# Bot patches code + proposes DB migration
# Click ▶ Execute Migration (live databases)
# Click 📋 Copy Migration Script (script-only databases)
# ── Connection string formats ─────────────────────────────────────
# PostgreSQL postgresql://user:pass@host:5432/db?sslmode=require
# Supabase Project URL + service_role key (use Supabase tab)
# MySQL mysql://user:pass@host:3306/db
# MongoDB mongodb+srv://user:pass@cluster.mongodb.net/db
# SQL Server host + port + db + user + pass (use SQL Server tab)
# Redis redis://:password@host:6379
# Cassandra host + keyspace + datacenter + credentials