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
postgresql://reporter:S3cret9@db.prod.internal:5432/finance— Database scheme with embedded credentials, host, port and database namemongodb+srv://svc-report:Xy9pQ4tW@cluster0.mongo.internal/admin— MongoDB SRV connection string with embedded credentialsjdbc:mysql://app_user:Q8gT2wZv@db01.corp.local:3306/orders— JDBC database URL with embedded credentials
Should not match
https://example.com/path— URL without credentials (no user:pass@ section)mysql://localhost/mydb— Database URL without credentialsamqp://user:password@broker.internal— Non-database scheme belongs to a separate service-URL credential classifiermysql://db.prod.internal/finance— Database URL without an embedded credentialTutorial: mysql://demo:password@example.com/sample— Placeholder password and example host are rejected in the primary; tutorial/sample context is excludedtemplate example placeholder record identifier— Template/sample context should be excluded even when anchor words are present
Known false positives
- Authentication-related terminology in software documentation, security training materials, or system architecture descriptions without actual credentials. Mitigation: Require proximity to credential-specific patterns (API keys, connection strings, tokens) rather than general security terminology.
- Code snippets and configuration examples containing credential-related keywords or placeholder values in developer documentation. Mitigation: Check for common placeholder patterns (example.com, localhost, 0000) and documentation file types to reduce false positives from technical writing.