Create rule for SQL Server connection strings
Author: rgmzCreated Jan 20, 2025Updated Sep 19, 2026
Labelsenhancement
Is your feature request related to a problem? Please describe. Gitleaks should detect SQL Server connection strings
Describe the solution you'd like
Create a rule that detects connection strings if they have a password.
Examples
Data Source=dbserver1.example.com;Initial Catalog=InventoryDB;User Id=admin_user;Password=SecureP@ss123;
Data Source=prod-sql01.mycompany.net;Initial Catalog=SalesDB;User Id=reporting_user;Password=P@ssword789;Encrypt=True;TrustServerCertificate=True;
Data Source=analytics-db03.example.net;Initial Catalog=AnalyticsDB;User Id=analytics_user;Password=4nalyt!cs@Work;MultipleActiveResultSets=True;
Data Source=secure-sql.example.net;Initial Catalog=CustomerDB;Uid=customer_user;Pwd=CustP@ss123;Encrypt=True;TrustServerCertificate=True;
Data Source=analytics-node.example.org,1533;Initial Catalog=AnalyticsDB;Uid=analytics_user;Pwd=An@lytics789;
Data Source=prod-cluster\ReportingInstance;Initial Catalog=ReportsDB;Uid=report_user;Pwd=R3port!Secure;
@"Data Source=n9lxnyuzhv.database.windows.net; Authentication=Active Directory Password; Initial Catalog=testdb; [email protected]; PWD=MyPassWord!";
Server=182.53.24.111;Initial Catalog=technos6_cafe;User ID=technos6_cafe;Password=cn*6s6I12;TrustServerCertificate=True
Server=tcp:assignmentdbserver.database.windows.net,1433;Initial Catalog=SyasyaDb;Persist Security Info=False;User ID=lky1020;Password=lky_1234;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;(These were generated with ChatGPT. Additional research should be performed to ensure they're accurate.)
Describe alternatives you've considered N/A
Additional context
- I've seen a few different formats, including
Provider=...;Location=...;.... I'm not sure if these are variations of the same thing, or a different format. - The keys seem to be case-insensitive.
cc @zricethezav
Source: gitleaks/gitleaks