Generic Database Credentials in URL

Detects database connection URLs with embedded user:password@host credentials, restricted to database schemes (mongodb/mongodb+srv, postgres/postgresql, mysql, redis/rediss, mssql/sqlserver, oracle, jdbc). Placeholder passwords and localhost/example hosts are rejected; non-database credential URLs (AMQP, LDAP, FTP) belong to a separate service-URL credential classifier.

Type
regex
Engine
universal
Confidence
low
Confidence justification
High confidence: structurally constrained pattern with corroborative keyword support reduces false positive rates significantly. Added context gating and exclusion rules improve precision and reduce incidental matches.
Detection quality
Partial
Jurisdictions
global
Regulations
Criminal Code Act 1995 (Cth)
Frameworks
CIS Controls, ISO 27001, NIST CSF, PCI-DSS, SOC 2
Data categories
credentials, security
Scope
wide
Risk rating
8
Platform compatibility
Purview: Compatible, GCP DLP: Unsupported, Macie: Unsupported, Zscaler: Compatible, Palo Alto: Unsupported, Netskope: Unsupported

Pattern

(?i)\b(?:mongodb(?:\+srv)?|postgres(?:ql)?|mysql|rediss?|mssql|sqlserver|oracle|jdbc:[a-z][a-z0-9]{0,23})://[^/:@\s]{1,64}:(?!(?:password|passw0rd|changeme|placeholder|example|dummy)@)[^/@\s]{1,128}@(?!(?:localhost|127\.0\.0\.1|example\.(?:com|net|org))\b)[^/:\s]{1,255}

Corroborative evidence keywords

api key, api_key, apikey, access key, secret key, private key, auth token, authorization, access token, bearer, conn str, connection string, connectionstring, cookie, credential, database, host, [object Object], oauth, passphrase (+33 more)

Proximity: 300 characters

Should match

Should not match

Known false positives

Collections