Repository navigation
Expand file tree
/
Copy pathhardcoded-secrets.yaml
More file actions
2241 lines (2056 loc) · 69.7 KB
/
Copy pathhardcoded-secrets.yaml
File metadata and controls
2241 lines (2056 loc) · 69.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# ============================================================================
# Robusta Studio - Hardcoded Secrets & API Keys Detection Rules
# Copyright (c) 2026 Robusta Studio. All rights reserved.
#
# Precision rules for detecting leaked credentials, API keys, tokens,
# private keys, and other secrets hardcoded in source code.
# High-precision patterns targeting specific provider key formats.
#
# Usage: semgrep --config hardcoded-secrets.yaml /path/to/project
# ============================================================================
rules:
# -- AWS Access Keys -------------------------------------------------------
- id: robusta-secrets-aws-access-key
patterns:
- pattern-regex: (?:AKIA|ABIA|ACCA|ASIA)[0-9A-Z]{16}
paths:
exclude:
- "*.md"
- "*.txt"
- "*.lock"
message: >
AWS Access Key ID detected (starts with AKIA/ABIA/ACCA/ASIA followed by
16 alphanumeric characters). Rotate immediately via IAM console and use
environment variables or AWS Secrets Manager instead.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: CRITICAL
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
references:
- https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html
provider: AWS
severity: ERROR
languages: [generic]
- id: robusta-secrets-aws-secret-key
patterns:
- pattern-regex: (?i)(?:aws_secret_access_key|aws_secret_key|secret_access_key)\s*[:=]\s*['"]?([A-Za-z0-9/+=]{40})['"]?
paths:
exclude:
- "*.md"
- "*.lock"
message: >
AWS Secret Access Key detected (40-character base64 string assigned to a
known AWS key variable). Rotate via IAM and store in environment variables
or AWS Secrets Manager.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: CRITICAL
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: AWS
severity: ERROR
languages: [generic]
# -- Google Cloud / GCP ---------------------------------------------------
- id: robusta-secrets-gcp-api-key
patterns:
- pattern-regex: AIza[0-9A-Za-z\-_]{35}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
Google Cloud API key detected (AIza prefix + 35 characters). Restrict the
key's scope in the GCP Console and use Application Default Credentials or
Secret Manager for server-side code.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: GCP
severity: ERROR
languages: [generic]
- id: robusta-secrets-gcp-service-account
patterns:
- pattern-regex: \"type\"\s*:\s*\"service_account\"
paths:
exclude:
- "*.md"
- "*.lock"
message: >
GCP service account JSON key file committed to repository. These contain
a private key that grants full service account permissions. Remove from
repo, rotate the key in IAM, and use Workload Identity Federation instead.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: CRITICAL
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: GCP
severity: ERROR
languages: [generic]
# -- GitHub Tokens ---------------------------------------------------------
- id: robusta-secrets-github-pat
patterns:
- pattern-regex: gh[pousr]_[A-Za-z0-9_]{36,255}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
GitHub Personal Access Token detected (ghp_/gho_/ghu_/ghs_/ghr_ prefix).
Revoke at github.com/settings/tokens and use GITHUB_TOKEN in CI or
environment variables for local dev.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: GitHub
severity: ERROR
languages: [generic]
- id: robusta-secrets-github-fine-grained-pat
patterns:
- pattern-regex: github_pat_[A-Za-z0-9_]{82,}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
GitHub fine-grained Personal Access Token detected. Revoke immediately
at github.com/settings/tokens and use repository-scoped tokens with
minimal permissions.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: GitHub
severity: ERROR
languages: [generic]
# -- GitLab Tokens ---------------------------------------------------------
- id: robusta-secrets-gitlab-token
patterns:
- pattern-regex: glpat-[A-Za-z0-9\-_]{20,}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
GitLab Personal Access Token detected (glpat- prefix). Revoke in
GitLab user settings and use CI_JOB_TOKEN or deploy tokens with
minimal scope instead.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: GitLab
severity: ERROR
languages: [generic]
# -- Slack Tokens ----------------------------------------------------------
- id: robusta-secrets-slack-token
patterns:
- pattern-regex: xox[baprs]-[0-9]{10,13}-[0-9A-Za-z\-]{20,}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
Slack API token detected (xoxb-/xoxa-/xoxp-/xoxr-/xoxs- prefix).
Revoke in Slack app settings and store tokens in a secrets manager.
Bot tokens (xoxb-) can read messages and act as the app.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: Slack
severity: ERROR
languages: [generic]
- id: robusta-secrets-slack-webhook
patterns:
- pattern-regex: https://hooks\.slack\.com/services/T[A-Z0-9]{8,}/B[A-Z0-9]{8,}/[A-Za-z0-9]{24,}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
Slack Incoming Webhook URL detected. Anyone with this URL can post
messages to the linked channel. Remove from code and configure via
environment variable.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: MEDIUM
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: Slack
severity: WARNING
languages: [generic]
# -- Stripe Keys -----------------------------------------------------------
- id: robusta-secrets-stripe-secret-key
patterns:
- pattern-regex: sk_live_[0-9a-zA-Z]{24,}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
Stripe live secret key detected (sk_live_ prefix). This key can create
charges, refunds, and access customer data. Rotate immediately in the
Stripe Dashboard and use restricted keys with minimal permissions.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: CRITICAL
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: Stripe
severity: ERROR
languages: [generic]
- id: robusta-secrets-stripe-restricted-key
patterns:
- pattern-regex: rk_live_[0-9a-zA-Z]{24,}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
Stripe live restricted key detected (rk_live_ prefix). Rotate in
Stripe Dashboard and store in environment variables or a secrets manager.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: Stripe
severity: ERROR
languages: [generic]
# -- Twilio ----------------------------------------------------------------
- id: robusta-secrets-twilio-api-key
patterns:
- pattern-regex: SK[0-9a-fA-F]{32}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
Twilio API Key detected (SK prefix + 32 hex characters). Revoke in
Twilio Console and use environment variables. Twilio keys can send
SMS, make calls, and access account resources.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: MEDIUM
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: Twilio
severity: ERROR
languages: [generic]
# -- SendGrid --------------------------------------------------------------
- id: robusta-secrets-sendgrid-api-key
patterns:
- pattern-regex: SG\.[A-Za-z0-9\-_]{22,}\.[A-Za-z0-9\-_]{22,}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
SendGrid API key detected (SG.xxx.xxx format). Revoke in SendGrid
Settings > API Keys and use environment variables. Leaked keys allow
sending emails as your domain (phishing risk).
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: SendGrid
severity: ERROR
languages: [generic]
# -- Mailgun ---------------------------------------------------------------
- id: robusta-secrets-mailgun-api-key
patterns:
- pattern-regex: key-[0-9a-zA-Z]{32}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
Mailgun API key detected (key- prefix + 32 alphanumeric characters).
Rotate in Mailgun dashboard and store in environment variables.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: MEDIUM
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: Mailgun
severity: WARNING
languages: [generic]
# -- Private Keys ----------------------------------------------------------
- id: robusta-secrets-private-key-rsa
patterns:
- pattern-regex: "-----BEGIN RSA PRIVATE KEY-----"
paths:
exclude:
- "*.md"
- "*.lock"
message: >
RSA private key detected in source code. Private keys must never be
committed. Remove from repo history with git-filter-repo, rotate the
key pair, and store private keys in a vault or HSM.
metadata:
cwe: ["CWE-321"]
owasp: ["A02:2021 Cryptographic Failures"]
confidence: HIGH
impact: CRITICAL
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
severity: ERROR
languages: [generic]
- id: robusta-secrets-private-key-ec
patterns:
- pattern-regex: "-----BEGIN EC PRIVATE KEY-----"
paths:
exclude:
- "*.md"
- "*.lock"
message: >
EC private key detected in source code. Remove from repo, rotate the key
pair, and use a secrets manager or HSM for key storage.
metadata:
cwe: ["CWE-321"]
owasp: ["A02:2021 Cryptographic Failures"]
confidence: HIGH
impact: CRITICAL
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
severity: ERROR
languages: [generic]
- id: robusta-secrets-private-key-openssh
patterns:
- pattern-regex: "-----BEGIN OPENSSH PRIVATE KEY-----"
paths:
exclude:
- "*.md"
- "*.lock"
message: >
OpenSSH private key detected in source code. This grants SSH access to
any server trusting the corresponding public key. Remove, rotate, and
use ssh-agent or a vault for key management.
metadata:
cwe: ["CWE-321"]
owasp: ["A02:2021 Cryptographic Failures"]
confidence: HIGH
impact: CRITICAL
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
severity: ERROR
languages: [generic]
- id: robusta-secrets-private-key-pkcs8
patterns:
- pattern-regex: "-----BEGIN PRIVATE KEY-----"
paths:
exclude:
- "*.md"
- "*.lock"
message: >
PKCS#8 private key detected in source code. Remove from repo history,
rotate the key, and store in a vault or HSM.
metadata:
cwe: ["CWE-321"]
owasp: ["A02:2021 Cryptographic Failures"]
confidence: HIGH
impact: CRITICAL
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
severity: ERROR
languages: [generic]
# -- Heroku ----------------------------------------------------------------
- id: robusta-secrets-heroku-api-key
patterns:
- pattern-regex: (?i)(?:heroku_api_key|heroku_api_token|heroku_oauth_token)\s*[:=]\s*['"]?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}['"]?
paths:
exclude:
- "*.md"
- "*.lock"
message: >
Heroku API key detected (UUID format assigned to a Heroku variable).
Regenerate at dashboard.heroku.com and use Heroku config vars for
deployment credentials.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: Heroku
severity: ERROR
languages: [generic]
# -- npm / PyPI Tokens -----------------------------------------------------
- id: robusta-secrets-npm-token
patterns:
- pattern-regex: npm_[A-Za-z0-9]{36,}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
npm access token detected (npm_ prefix). Revoke at npmjs.com/settings
and use CIDR-scoped automation tokens for CI/CD. A leaked token allows
publishing malicious packages under your account (supply chain attack).
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: CRITICAL
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: npm
severity: ERROR
languages: [generic]
- id: robusta-secrets-pypi-token
patterns:
- pattern-regex: pypi-[A-Za-z0-9\-_]{50,}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
PyPI API token detected (pypi- prefix). Revoke at pypi.org/manage/account
and use project-scoped tokens. A leaked token allows uploading malicious
packages (supply chain attack).
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: CRITICAL
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: PyPI
severity: ERROR
languages: [generic]
# -- Azure -----------------------------------------------------------------
- id: robusta-secrets-azure-storage-key
patterns:
- pattern-regex: (?i)(?:DefaultEndpointsProtocol|AccountKey)\s*=\s*[A-Za-z0-9+/=]{44,}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
Azure Storage connection string or account key detected. Rotate the key
in the Azure Portal and use Managed Identity or Azure Key Vault references
instead of embedding keys in code.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: CRITICAL
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: Azure
severity: ERROR
languages: [generic]
# -- OpenAI / AI Provider Keys ---------------------------------------------
- id: robusta-secrets-openai-api-key
patterns:
- pattern-regex: sk-[A-Za-z0-9]{20}T3BlbkFJ[A-Za-z0-9]{20}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
OpenAI API key detected (sk-...T3BlbkFJ... format). Revoke at
platform.openai.com/api-keys. Leaked keys incur charges on your account
and may expose fine-tuned model data.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: OpenAI
severity: ERROR
languages: [generic]
- id: robusta-secrets-openai-project-key
patterns:
- pattern-regex: sk-proj-[A-Za-z0-9\-_]{80,}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
OpenAI project API key detected (sk-proj- prefix). Revoke at
platform.openai.com and use environment variables for API access.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: OpenAI
severity: ERROR
languages: [generic]
# -- Shopify ---------------------------------------------------------------
- id: robusta-secrets-shopify-token
patterns:
- pattern-regex: shpat_[A-Fa-f0-9]{32}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
Shopify Admin API access token detected (shpat_ prefix). Revoke in
Shopify Partners dashboard. Leaked tokens can read/modify store data
including customer PII and orders.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: Shopify
severity: ERROR
languages: [generic]
# -- Database Connection Strings -------------------------------------------
- id: robusta-secrets-database-url
patterns:
- pattern-regex: (?i)(?:mysql|postgres|postgresql|mongodb|mongodb\+srv|redis|amqp|mssql)://[^:\s]+:[^@\s]+@[^\s'"]+
paths:
exclude:
- "*.md"
- "*.lock"
- "*.example"
- "*.sample"
message: >
Database connection string with embedded credentials detected. Extract
the username and password into environment variables or a secrets manager.
Connection strings with credentials grant direct database access.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: CRITICAL
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
severity: ERROR
languages: [generic]
# -- Generic Password Assignment -------------------------------------------
- id: robusta-secrets-generic-password-assignment
patterns:
- pattern-regex: (?i)(?:password|passwd|pwd|secret|token|api_key|apikey|api_secret|access_token|auth_token|credentials|private_key)\s*[:=]\s*['"][^\s'"]{8,}['"]
- pattern-not-regex: (?i)(?:password|passwd|pwd|secret|token|api_key|apikey|api_secret|access_token|auth_token|credentials|private_key)\s*[:=]\s*['"](?:\$\{|%s|{{|<|os\.environ|process\.env|ENV\[|getenv|placeholder|example|changeme|your[_-]|REPLACE|TODO|FIXME|xxx|test|dummy|fake|mock|sample)
paths:
exclude:
- "*test*"
- "*spec*"
- "*mock*"
- "*fixture*"
- "*.md"
- "*.lock"
- "*.example"
- "*.sample"
- "*.template"
message: >
Hardcoded credential detected in a password/secret/token variable
assignment. Use environment variables, a .env file (gitignored), or a
secrets manager. Never commit real credentials to source control.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: MEDIUM
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
severity: WARNING
languages: [generic]
# -- JWT Secrets in Code ---------------------------------------------------
- id: robusta-secrets-jwt-secret-generic
patterns:
- pattern-regex: (?i)(?:jwt_secret|jwt_key|jwt_signing_key|token_secret)\s*[:=]\s*['"][A-Za-z0-9+/=\-_]{16,}['"]
paths:
exclude:
- "*test*"
- "*spec*"
- "*.md"
- "*.lock"
- "*.example"
message: >
Hardcoded JWT signing secret detected. If this is a symmetric HMAC key,
anyone with it can forge valid tokens. Store in a secrets manager and
consider asymmetric RS256/ES256 keys stored in a vault.
metadata:
cwe: ["CWE-321"]
owasp: ["A02:2021 Cryptographic Failures"]
confidence: HIGH
impact: CRITICAL
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
severity: ERROR
languages: [generic]
# -- .env Files Committed --------------------------------------------------
- id: robusta-secrets-dotenv-committed
patterns:
- pattern-regex: (?i)^(?:DATABASE_URL|DB_PASSWORD|SECRET_KEY|API_KEY|AWS_SECRET|STRIPE_SECRET|PRIVATE_KEY|AUTH_TOKEN|OAUTH_SECRET)\s*=\s*\S+
paths:
include:
- ".env"
- ".env.production"
- ".env.local"
- ".env.staging"
message: >
Secrets detected in a .env file that appears to be tracked by version
control. Add .env* to .gitignore and use .env.example with placeholder
values instead. Rotate any secrets that were committed.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: CRITICAL
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
severity: ERROR
languages: [generic]
# -- Firebase / Google Firebase --------------------------------------------
- id: robusta-secrets-firebase-url
patterns:
- pattern-regex: (?i)(?:firebase_api_key|firebase_token)\s*[:=]\s*['"][A-Za-z0-9\-_]{20,}['"]
paths:
exclude:
- "*.md"
- "*.lock"
message: >
Firebase credential detected in source code. While Firebase API keys
are semi-public, server keys and admin tokens must be kept secret.
Use Firebase Admin SDK with service account credentials from environment.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: MEDIUM
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: Firebase
severity: WARNING
languages: [generic]
# -- Telegram Bot Token ----------------------------------------------------
- id: robusta-secrets-telegram-bot-token
patterns:
- pattern-regex: "[0-9]{8,10}:[A-Za-z0-9_-]{35}"
paths:
exclude:
- "*.md"
- "*.lock"
message: >
Telegram Bot API token detected (numeric bot ID : alphanumeric secret).
Revoke via BotFather /revoke command and store the token in environment
variables.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: MEDIUM
impact: MEDIUM
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: Telegram
severity: WARNING
languages: [generic]
# -- Discord Bot Token -----------------------------------------------------
- id: robusta-secrets-discord-bot-token
patterns:
- pattern-regex: "[MN][A-Za-z0-9]{23,}\\.[A-Za-z0-9_-]{6}\\.[A-Za-z0-9_-]{27,}"
paths:
exclude:
- "*.md"
- "*.lock"
message: >
Discord bot token detected. Regenerate in Discord Developer Portal and
store in environment variables. A leaked token gives full control of
the bot account.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: MEDIUM
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: Discord
severity: ERROR
languages: [generic]
# -- Docker Registry Credentials -------------------------------------------
- id: robusta-secrets-docker-auth
patterns:
- pattern-regex: (?i)(?:docker_password|docker_auth|dockerhub_password|registry_password)\s*[:=]\s*['"][^\s'"]{8,}['"]
paths:
exclude:
- "*.md"
- "*.lock"
message: >
Docker registry credential detected. Use docker credential helpers
(docker-credential-pass, docker-credential-ecr-login) or CI/CD
secrets instead of hardcoding registry passwords.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: Docker
severity: ERROR
languages: [generic]
# -- Hashicorp Vault Token -------------------------------------------------
- id: robusta-secrets-vault-token
patterns:
- pattern-regex: hvs\.[A-Za-z0-9]{24,}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
HashiCorp Vault service token detected (hvs. prefix). Revoke with
`vault token revoke` and use AppRole or Kubernetes auth method instead
of hardcoded tokens.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: CRITICAL
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: HashiCorp
severity: ERROR
languages: [generic]
# -- Supabase --------------------------------------------------------------
- id: robusta-secrets-supabase-service-key
patterns:
- pattern-regex: (?i)(?:supabase_service_role_key|service_role_key)\s*[:=]\s*['"]eyJ[A-Za-z0-9\-_]+\.eyJ[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]+['"]
paths:
exclude:
- "*.md"
- "*.lock"
message: >
Supabase service role key (JWT) detected. This key bypasses Row Level
Security and grants full database access. Use the anon key client-side
and store the service key in environment variables server-side.
metadata:
cwe: ["CWE-798"]
owasp: ["A07:2021 Identification and Authentication Failures"]
confidence: HIGH
impact: CRITICAL
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: Supabase
severity: ERROR
languages: [generic]
- id: robusta-secrets-supabase-token
patterns:
- pattern-regex: sbp_[a-z0-9]{40}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
Supabase management API token detected (sbp_ prefix). Revoke in
Supabase dashboard and use environment variables.
metadata:
cwe: ["CWE-798"]
confidence: HIGH
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: Supabase
severity: ERROR
languages: [generic]
# -- Anthropic -------------------------------------------------------------
- id: robusta-secrets-anthropic-api-key
patterns:
- pattern-regex: sk-ant-(?:admin01|api03)-[A-Za-z0-9_\-]{93}AA
paths:
exclude:
- "*.md"
- "*.lock"
message: >
Anthropic API key detected (sk-ant- prefix). Revoke at console.anthropic.com
and use environment variables. Leaked keys incur charges on your account.
metadata:
cwe: ["CWE-798"]
confidence: HIGH
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: Anthropic
severity: ERROR
languages: [generic]
# -- Groq ------------------------------------------------------------------
- id: robusta-secrets-groq-api-key
patterns:
- pattern-regex: gsk_[a-zA-Z0-9]{52}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
Groq API key detected (gsk_ prefix). Revoke at console.groq.com and
use environment variables.
metadata:
cwe: ["CWE-798"]
confidence: HIGH
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: Groq
severity: ERROR
languages: [generic]
# -- xAI -------------------------------------------------------------------
- id: robusta-secrets-xai-api-key
patterns:
- pattern-regex: xai-[0-9a-zA-Z_]{80}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
xAI (Grok) API key detected (xai- prefix). Revoke and store in
environment variables.
metadata:
cwe: ["CWE-798"]
confidence: HIGH
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: xAI
severity: ERROR
languages: [generic]
# -- OpenRouter ------------------------------------------------------------
- id: robusta-secrets-openrouter-api-key
patterns:
- pattern-regex: sk-or-v1-[0-9a-f]{64}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
OpenRouter API key detected (sk-or-v1- prefix). Revoke at
openrouter.ai/keys and use environment variables.
metadata:
cwe: ["CWE-798"]
confidence: HIGH
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: OpenRouter
severity: ERROR
languages: [generic]
# -- HuggingFace -----------------------------------------------------------
- id: robusta-secrets-huggingface-token
patterns:
- pattern-regex: hf_[a-zA-Z0-9]{34}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
HuggingFace API token detected (hf_ prefix). Revoke at
huggingface.co/settings/tokens and use environment variables.
metadata:
cwe: ["CWE-798"]
confidence: HIGH
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: HuggingFace
severity: ERROR
languages: [generic]
# -- Replicate -------------------------------------------------------------
- id: robusta-secrets-replicate-api-key
patterns:
- pattern-regex: r8_[0-9A-Za-z_\-]{37}
paths:
exclude:
- "*.md"
- "*.lock"
message: >
Replicate API token detected (r8_ prefix). Revoke at replicate.com/account
and use environment variables.
metadata:
cwe: ["CWE-798"]
confidence: HIGH
impact: HIGH
author: Robusta Studio
license: "MIT - Copyright (c) 2026 Robusta Studio. For the open-source community."
provider: Replicate
severity: ERROR
languages: [generic]
# -- NVIDIA ----------------------------------------------------------------
- id: robusta-secrets-nvidia-api-key
patterns:
- pattern-regex: nvapi-[a-zA-Z0-9_\-]{64}
paths:
exclude:
- "*.md"
- "*.lock"
message: >