@@ -194,6 +194,10 @@ Use custom SAST rules instead of bundled rules (falls back to bundled rules for
194194socket-basics --python --use-custom-sast-rules
195195```
196196
197+ When this is enabled, custom rules are loaded from YAML files under
198+ ` --custom-sast-rule-path ` . Each rule must include a ` languages ` list so Socket
199+ Basics can map it to the correct OpenGrep language rule file.
200+
197201### ` --custom-sast-rule-path CUSTOM_SAST_RULE_PATH `
198202Relative path to custom SAST rules directory (relative to workspace if set, otherwise cwd).
199203
@@ -206,6 +210,11 @@ Relative path to custom SAST rules directory (relative to workspace if set, othe
206210socket-basics --python --use-custom-sast-rules --custom-sast-rule-path " my_custom_rules"
207211```
208212
213+ Custom rule file notes:
214+ - ` .yml ` and ` .yaml ` files are discovered recursively.
215+ - Files ending in ` .test.yml ` or ` .test.yaml ` are ignored.
216+ - Rules without ` languages ` are skipped.
217+
209218### Language-Specific Rule Configuration
210219
211220For each language, you can enable or disable specific rules:
@@ -519,7 +528,9 @@ All notification integrations support environment variables as alternatives to C
519528
520529| Variable | Description |
521530| ----------| -------------|
522- | ` INPUT_OPENGREP_RULES_DIR ` | Custom directory containing SAST rules |
531+ | ` INPUT_OPENGREP_RULES_DIR ` | Override directory for bundled OpenGrep rule files (` *.yml ` ) |
532+ | ` INPUT_USE_CUSTOM_SAST_RULES ` | Enable repository custom SAST rules |
533+ | ` INPUT_CUSTOM_SAST_RULE_PATH ` | Relative directory path for repository custom SAST rules |
523534
524535## Configuration File
525536
@@ -536,6 +547,8 @@ You can provide configuration via a JSON file using `--config`:
536547
537548 "python_sast_enabled" : true ,
538549 "javascript_sast_enabled" : true ,
550+ "use_custom_sast_rules" : true ,
551+ "custom_sast_rule_path" : " .socket/rules" ,
539552 "go_sast_enabled" : true ,
540553
541554 "secrets_enabled" : true ,
@@ -559,17 +572,18 @@ You can provide configuration via a JSON file using `--config`:
559572Configuration is merged in the following order (later sources override earlier ones):
560573
5615741 . Default values
562- 2 . JSON configuration file (via ` --config ` )
563- 3 . Environment variables
564- 4 . Command-line arguments
575+ 2 . Environment variables
576+ 3 . Socket Basics API configuration (when available and no ` --config ` file is used)
577+ 4 . JSON configuration file (via ` --config ` )
578+ 5 . Command-line arguments
565579
566580** Example:**
567581``` bash
568- # JSON file sets python_sast_enabled: true
569- # Environment has PYTHON_SAST_ENABLED =false
582+ # Environment sets python_sast_enabled= true
583+ # Dashboard/API sets python_sast_enabled =false
570584# CLI has --javascript
571- # Result: JavaScript enabled, Python disabled (env override) , other settings from JSON
572- socket-basics --config config.json -- javascript
585+ # Result: JavaScript enabled, Python follows dashboard/API value , other settings from env/API
586+ socket-basics --javascript
573587```
574588
575589## Common Usage Patterns
0 commit comments