-
Notifications
You must be signed in to change notification settings - Fork 225
Expand file tree
/
Copy pathconfig.schema.json
More file actions
1451 lines (1451 loc) · 51.2 KB
/
Copy pathconfig.schema.json
File metadata and controls
1451 lines (1451 loc) · 51.2 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
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "dcg configuration",
"description": "JSON Schema for the config.toml of dcg (Destructive Command Guard). Generated from the Rust config types via `dcg config schema`; do not edit by hand. Regenerate after changing any config struct.",
"type": "object",
"properties": {
"general": {
"description": "General settings.",
"$ref": "#/$defs/GeneralConfig",
"default": {
"color": "auto",
"log_file": null,
"verbose": false,
"hook_timeout_ms": null,
"max_hook_input_bytes": null,
"max_command_bytes": null,
"max_findings_per_command": null,
"check_updates": true,
"self_heal_hook": true,
"fail_closed": false
}
},
"output": {
"description": "Output display settings.",
"$ref": "#/$defs/OutputConfig",
"default": {
"highlight_enabled": null,
"explanations_enabled": null,
"high_contrast": null
}
},
"theme": {
"description": "Theme configuration for rich terminal output.",
"$ref": "#/$defs/ThemeConfig",
"default": {
"palette": null,
"use_unicode": null,
"use_color": null
}
},
"packs": {
"description": "Pack configuration.",
"$ref": "#/$defs/PacksConfig",
"default": {
"enabled": [],
"disabled": [],
"custom_paths": []
}
},
"policy": {
"description": "Decision mode policy configuration.",
"$ref": "#/$defs/PolicyConfig",
"default": {}
},
"overrides": {
"description": "Custom overrides.",
"$ref": "#/$defs/OverridesConfig",
"default": {
"allow": [],
"block": [],
"allowlist": null,
"allowlist_rules": null
}
},
"allowlist": {
"description": "Allowlist file management settings.",
"$ref": "#/$defs/AllowlistConfig",
"default": {
"auto_prune_expired": false
}
},
"heredoc": {
"description": "Heredoc/inline-script scanning configuration.",
"$ref": "#/$defs/HeredocConfig",
"default": {
"enabled": null,
"timeout_ms": null,
"max_body_bytes": null,
"max_body_lines": null,
"max_heredocs": null,
"languages": null,
"fallback_on_parse_error": null,
"fallback_on_timeout": null,
"allowlist": null
}
},
"confidence": {
"description": "Confidence scoring configuration for ambiguous matches.",
"$ref": "#/$defs/ConfidenceConfig",
"default": {
"enabled": false,
"warn_threshold": 0.5,
"protect_critical": true
}
},
"logging": {
"description": "Structured logging configuration.",
"$ref": "#/$defs/LoggingConfig",
"default": {
"enabled": false,
"file": null,
"format": "text",
"redaction": {
"enabled": false,
"mode": "arguments",
"max_argument_len": 50
},
"events": {
"deny": true,
"warn": true,
"allow": false
}
}
},
"history": {
"description": "Command history configuration.",
"$ref": "#/$defs/HistoryConfig",
"default": {
"enabled": false,
"redaction_mode": "pattern",
"retention_days": 90,
"max_size_mb": 500,
"database_path": null,
"auto_prune": false,
"prune_check_interval_hours": 24,
"batch_size": 50,
"batch_flush_interval_ms": 100
}
},
"interactive": {
"description": "Interactive prompt configuration.",
"$ref": "#/$defs/InteractiveConfig",
"default": {
"enabled": false,
"verification": "code",
"timeout_seconds": 5,
"code_length": 4,
"max_attempts": 3,
"allow_non_tty_fallback": true,
"disable_in_ci": true,
"require_env": null
}
},
"git_awareness": {
"description": "Git branch-aware strictness configuration.",
"$ref": "#/$defs/GitAwarenessConfig",
"default": {
"enabled": false,
"protected_branches": [
"main",
"production",
"release/*"
],
"protected_strictness": "all",
"relaxed_branches": [
"feature/*",
"experiment/*",
"sandbox/*"
],
"relaxed_strictness": "critical",
"default_strictness": "high",
"detached_head_strictness": "all",
"relaxed_disabled_packs": [],
"show_branch_in_output": true,
"warn_if_not_git": false
}
},
"agents": {
"description": "Agent-specific profiles configuration.",
"$ref": "#/$defs/AgentsConfig",
"default": {
"default": {
"trust_level": "medium",
"disabled_packs": [],
"extra_packs": [],
"additional_allowlist": [],
"disabled_allowlist": false
}
}
},
"response": {
"description": "Graduated response system configuration.",
"$ref": "#/$defs/ResponseConfig",
"default": {
"enabled": false,
"mode": "standard",
"session_warning_count": 1,
"session_soft_block": 2,
"history_soft_block": 3,
"history_hard_block": 5,
"history_window": "24h",
"severity_overrides": {
"critical": null,
"high": null,
"medium": null,
"low": null
}
}
},
"projects": {
"description": "Project-specific configurations (keyed by absolute path).",
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/ProjectConfig"
},
"default": {}
},
"rules": {
"description": "Per-rule settings keyed by `\"<pack_id>:<pattern_name>\"` (#284).\n\nCurrently carries `exempt_target_globs`, the rule-scoped target-path\nexemption. See [`RuleConfig`].",
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/RuleConfig"
},
"default": {}
}
},
"$defs": {
"GeneralConfig": {
"description": "General configuration options.",
"type": "object",
"properties": {
"color": {
"description": "Color output mode: \"auto\", \"always\", \"never\".",
"type": "string",
"default": "auto"
},
"log_file": {
"description": "Path to log file for blocked commands (optional).",
"type": [
"string",
"null"
],
"default": null
},
"verbose": {
"description": "Whether to show verbose output.",
"type": "boolean",
"default": false
},
"hook_timeout_ms": {
"description": "Hook evaluation budget override in milliseconds.\nWhen set, overrides the default hook evaluation budget. Values below\n10 milliseconds are clamped to the minimum safe evaluation window.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0,
"default": null
},
"max_hook_input_bytes": {
"description": "Maximum bytes to read from stdin in hook mode.\nOversized hook envelopes are allowed with an audit warning by default;\n`fail_closed` blocks them because their size is attacker-controlled.\nDefault: 262144 (256 KiB).",
"type": [
"integer",
"null"
],
"format": "uint",
"minimum": 0,
"default": null
},
"max_command_bytes": {
"description": "Maximum bytes for command string after extraction from JSON.\nCommands exceeding this limit produce an explicit indeterminate result;\nreview-capable protocols ask and other protocols block.\nDefault: 65536 (64 KiB).",
"type": [
"integer",
"null"
],
"format": "uint",
"minimum": 0,
"default": null
},
"max_findings_per_command": {
"description": "Maximum findings to report per command.\nLimits output size and processing time for pathological inputs.\nDefault: 100.",
"type": [
"integer",
"null"
],
"format": "uint",
"minimum": 0,
"default": null
},
"check_updates": {
"description": "Whether to check for updates in the background.\nWhen enabled, dcg will spawn a background thread to check for updates\nand show a notice if a newer version is available.\nDefault: true. Disable with truthy `DCG_NO_UPDATE_CHECK`\nor `check_updates` = false.",
"type": "boolean",
"default": true
},
"self_heal_hook": {
"description": "Whether to self-heal the hook registration in settings.json.\nWhen enabled, every hook invocation checks that the dcg entry is still\npresent in `~/.claude/settings.json` and re-registers it if missing.\nThis protects against Claude Code silently overwriting settings.json\nmid-session.\nDefault: true. Disable with `DCG_NO_SELF_HEAL` or `self_heal_hook = false`.",
"type": "boolean",
"default": true
},
"fail_closed": {
"description": "Fail-closed mode for unparseable hook input.\n\nWhen `true`, hook input that cannot be parsed as JSON is BLOCKED\n(denied) instead of allowed. The default (`false`) is the documented\nfail-open behavior: malformed input is allowed so a transient encoding\nglitch never blocks legitimate work. Intended for high-security\nenvironments. Override at runtime with the `DCG_FAIL_CLOSED` env var\n(a truthy value forces fail-closed, a falsy value forces fail-open).",
"type": "boolean",
"default": false
}
}
},
"OutputConfig": {
"description": "Output display configuration.\n\nControls optional output enhancements like span highlighting and explanations.",
"type": "object",
"properties": {
"highlight_enabled": {
"description": "Enable span highlighting in denial output.\nWhen enabled, shows caret-style markers under the matched portion.\nDefault: true",
"type": [
"boolean",
"null"
],
"default": null
},
"explanations_enabled": {
"description": "Enable explanations in denial output.\nWhen enabled, shows detailed explanations for why patterns are dangerous.\nDefault: true",
"type": [
"boolean",
"null"
],
"default": null
},
"high_contrast": {
"description": "Enable high-contrast output.\nUses ASCII borders and a black/white palette for accessibility.\nDefault: false",
"type": [
"boolean",
"null"
],
"default": null
}
}
},
"ThemeConfig": {
"description": "Theme configuration for rich terminal output.",
"type": "object",
"properties": {
"palette": {
"description": "Palette name: \"default\" | \"colorblind\" | \"high-contrast\".",
"type": [
"string",
"null"
],
"default": null
},
"use_unicode": {
"description": "Whether Unicode box drawing is allowed.",
"type": [
"boolean",
"null"
],
"default": null
},
"use_color": {
"description": "Whether colors are allowed (overrides `NO_COLOR` when set to false).",
"type": [
"boolean",
"null"
],
"default": null
}
}
},
"PacksConfig": {
"description": "Pack enablement configuration.",
"type": "object",
"properties": {
"enabled": {
"description": "List of enabled packs (e.g., `[\"database.postgresql\", \"kubernetes\"]`).",
"type": "array",
"items": {
"type": "string"
},
"default": []
},
"disabled": {
"description": "List of explicitly disabled packs (for disabling sub-packs of enabled categories).",
"type": "array",
"items": {
"type": "string"
},
"default": []
},
"custom_paths": {
"description": "Paths to custom external pack YAML files.\n\nSupports glob patterns and tilde expansion:\n- `~/.config/dcg/packs/*.yaml` - User-level packs\n- `.dcg/packs/*.yaml` - Project-level packs\n- `/etc/dcg/packs/*.yaml` - System-wide packs\n\nFiles are loaded in order; later files with the same pack ID override earlier ones.\nPack loading is fail-open: invalid files are logged as warnings but don't prevent\nloading valid packs.",
"type": "array",
"items": {
"type": "string"
},
"default": []
}
}
},
"PolicyConfig": {
"description": "Decision mode policy configuration.\n\nControls how matched patterns are handled: deny (block), ask (require\noperator review), warn (allow with warning), or log (silent allow with\noptional logging).\n\nDefaults respect severity: Critical/High → deny, Medium → warn, Low → log.\nThis config allows overriding the default behavior per pack or per specific rule.",
"type": "object",
"properties": {
"default_mode": {
"description": "Global default mode (overrides severity-based defaults).\nIf not set, severity-based defaults apply.",
"anyOf": [
{
"$ref": "#/$defs/PolicyMode"
},
{
"type": "null"
}
]
},
"observe_until": {
"description": "Optional observe-mode window end timestamp.\n\nWhen set and the current time is **before** this timestamp:\n- `default_mode` applies, but defaults to `\"warn\"` when unset.\n\nWhen set and the current time is **at/after** this timestamp:\n- `default_mode` is ignored and dcg reverts to severity-based defaults.\n\nAccepted formats:\n- RFC 3339: `2026-02-01T00:00:00Z`\n- ISO 8601 without timezone (treated as UTC): `2026-02-01T00:00:00`\n- Date only (treated as end of day UTC): `2026-02-01`",
"type": [
"string",
"null"
]
},
"packs": {
"description": "Per-pack mode overrides.\nKey is `pack_id` (e.g., \"core.git\", \"database.postgresql\").\nValue is the mode to use for all patterns in that pack.",
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/PolicyMode"
}
},
"rules": {
"description": "Per-rule mode overrides.\nKey is `rule_id` (e.g., \"core.git:reset-hard\", \"core.filesystem:rm-rf-root\").\nValue is the mode to use for that specific rule.\nTakes precedence over pack-level and global overrides.",
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/PolicyMode"
}
}
}
},
"PolicyMode": {
"description": "Policy mode for overriding default decision behavior.",
"oneOf": [
{
"description": "Block the command (output JSON deny, print warning).",
"type": "string",
"const": "deny"
},
{
"description": "Require explicit operator review; fail closed if the client cannot ask.",
"type": "string",
"const": "ask"
},
{
"description": "Warn but allow (print warning to stderr, no JSON deny).",
"type": "string",
"const": "warn"
},
{
"description": "Log only (silent allow, record for history).",
"type": "string",
"const": "log"
}
]
},
"OverridesConfig": {
"description": "Custom pattern overrides.",
"type": "object",
"properties": {
"allow": {
"description": "Patterns to allow that would otherwise be blocked.",
"type": "array",
"items": {
"$ref": "#/$defs/AllowOverride"
},
"default": []
},
"block": {
"description": "Additional patterns to block.",
"type": "array",
"items": {
"$ref": "#/$defs/BlockOverride"
},
"default": []
},
"allowlist": {
"description": "Simple allowlist format (backward compatible).\n\nExample in TOML:\n```toml\nallowlist = [\"npm run build\", \"cargo test\"]\n```",
"type": [
"array",
"null"
],
"items": {
"type": "string"
},
"default": null
},
"allowlist_rules": {
"description": "Extended allowlist rules with path-specific conditions.\n\nExample in TOML:\n```toml\n[[allowlist_rules]]\npattern = \"rm -rf node_modules\"\npaths = [\"/home/*/projects/*\", \"/workspace/*\"]\ncomment = \"Allow node_modules cleanup in project directories\"\n```",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/$defs/AllowlistRule"
},
"default": null
}
}
},
"AllowOverride": {
"description": "An allow override - patterns that should be permitted.",
"anyOf": [
{
"description": "Simple pattern string.",
"type": "string"
},
{
"description": "Conditional override with optional `when` clause.",
"type": "object",
"properties": {
"pattern": {
"type": "string"
},
"when": {
"description": "Optional condition (e.g., \"CI=true\").",
"type": [
"string",
"null"
]
}
},
"required": [
"pattern"
]
}
]
},
"BlockOverride": {
"description": "A block override - additional patterns to block.",
"type": "object",
"properties": {
"pattern": {
"description": "The regex pattern to match.",
"type": "string"
},
"reason": {
"description": "Human-readable reason for blocking.",
"type": "string"
}
},
"required": [
"pattern",
"reason"
]
},
"AllowlistRule": {
"description": "An extended allowlist rule with optional path conditions.\n\nThis supports context-aware allowlisting where rules can be scoped\nto specific directories or path patterns. Rules can also have expiration\nsettings (mutually exclusive: only one of `expires`, `ttl`, `ttl_seconds`,\nor `session` should be set).",
"type": "object",
"properties": {
"pattern": {
"description": "The pattern to allow (regex supported).",
"type": "string"
},
"paths": {
"description": "Optional path patterns where this rule applies.\n\nIf `None` or empty, the rule applies globally.\nSupports glob patterns like `/home/*/projects/*`.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
},
"default": null
},
"comment": {
"description": "Optional comment explaining the rule.",
"type": [
"string",
"null"
],
"default": null
},
"expires": {
"description": "Optional expiration timestamp (ISO 8601 format).\n\nAfter this time, the rule is no longer active.\nExample: \"2024-06-01T00:00:00Z\"\n\nMutually exclusive with `ttl`, `ttl_seconds`, and `session`.",
"type": [
"string",
"null"
],
"default": null
},
"ttl": {
"description": "Optional time-to-live duration as a human-readable string.\n\nSupported formats:\n- Minutes: \"30m\", \"30min\", \"30 minutes\"\n- Hours: \"4h\", \"4hr\", \"4 hours\"\n- Days: \"7d\", \"7 days\"\n- Weeks: \"1w\", \"1 week\"\n\nTTL is computed from `created_at` timestamp.\nMutually exclusive with `expires`, `ttl_seconds`, and `session`.",
"type": [
"string",
"null"
],
"default": null
},
"ttl_seconds": {
"description": "Optional time-to-live duration in seconds.\n\nAlternative to `ttl` for programmatic use.\nTTL is computed from `created_at` timestamp.\nMutually exclusive with `expires`, `ttl`, and `session`.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0,
"default": null
},
"session": {
"description": "Whether this is a session-only rule.\n\nSession rules are valid only within the shell session that created them.\nMutually exclusive with `expires`, `ttl`, and `ttl_seconds`.",
"type": [
"boolean",
"null"
],
"default": null
},
"session_id": {
"description": "Session identifier this rule is bound to when `session = true`.",
"type": [
"string",
"null"
],
"default": null
},
"created_at": {
"description": "Timestamp when this rule was created (ISO 8601 format).\n\nRequired for TTL-based expiration. If not set when a TTL is specified,\nit will be automatically set to the current time when the rule is loaded.",
"type": [
"string",
"null"
],
"default": null
}
},
"required": [
"pattern"
]
},
"AllowlistConfig": {
"description": "Settings for layered allowlist files (`.dcg/allowlist.toml`,\n`~/.config/dcg/allowlist.toml`, and `/etc/dcg/allowlist.toml`).",
"type": "object",
"properties": {
"auto_prune_expired": {
"description": "Automatically prune expired entries during allowlist CLI operations.\n\nDisabled by default so expired entries remain as audit history unless a\nuser explicitly opts in or runs `dcg allowlist prune`.",
"type": "boolean",
"default": false
}
}
},
"HeredocConfig": {
"description": "Heredoc and inline-script scanning configuration.\n\nThis configuration controls Tier 1/2/3 heredoc scanning behavior. Because the\nhook is performance- and UX-sensitive, extraction/parse errors use a bounded\nfallback scanner by default.",
"type": "object",
"properties": {
"enabled": {
"description": "Enable heredoc/inline-script scanning.",
"type": [
"boolean",
"null"
],
"default": null
},
"timeout_ms": {
"description": "Timeout budget for Tier 2 extraction (milliseconds).",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0,
"default": null
},
"max_body_bytes": {
"description": "Maximum bytes extracted from heredoc bodies.",
"type": [
"integer",
"null"
],
"format": "uint",
"minimum": 0,
"default": null
},
"max_body_lines": {
"description": "Maximum number of lines extracted from heredoc bodies.",
"type": [
"integer",
"null"
],
"format": "uint",
"minimum": 0,
"default": null
},
"max_heredocs": {
"description": "Maximum number of heredocs to process per command.",
"type": [
"integer",
"null"
],
"format": "uint",
"minimum": 0,
"default": null
},
"languages": {
"description": "Optional allowlist of languages to scan.\n\nValues are case-insensitive and may include aliases:\n- bash: bash, sh, shell\n- python: python, py\n- ruby: ruby, rb\n- perl: perl, pl\n- javascript: javascript, js, node\n- typescript: typescript, ts\n- php: php\n- go: go, golang\n- unknown: unknown\n\nSpecial value \"all\" scans all languages (the default if omitted).",
"type": [
"array",
"null"
],
"items": {
"type": "string"
},
"default": null
},
"fallback_on_parse_error": {
"description": "Use bounded fallback scanning when AST parsing fails for embedded code.\nWhen false, block on the incomplete analysis instead.",
"type": [
"boolean",
"null"
],
"default": null
},
"fallback_on_timeout": {
"description": "Use bounded fallback scanning when extraction/parsing exceeds its timeout.\nWhen false, block on the incomplete analysis instead.",
"type": [
"boolean",
"null"
],
"default": null
},
"allowlist": {
"description": "Content-based allowlist for heredocs (patterns, hashes, commands).",
"anyOf": [
{
"$ref": "#/$defs/HeredocAllowlistConfig"
},
{
"type": "null"
}
],
"default": null
}
}
},
"HeredocAllowlistConfig": {
"description": "Heredoc content allowlist for known-safe patterns and content hashes.\n\nSupports multiple allowlisting mechanisms:\n- Command prefixes: allow all heredocs in commands starting with specific paths\n- Pattern matching: allow heredocs containing specific patterns (optionally filtered by language)\n- Content hashes: allow heredocs with specific content hashes (for known-good scripts)\n- Project scopes: additional allowances for specific project directories",
"type": "object",
"properties": {
"commands": {
"description": "Command prefixes to allowlist entirely (e.g., \"./scripts/approved.sh\").",
"type": "array",
"items": {
"type": "string"
},
"default": []
},
"patterns": {
"description": "Content patterns to allowlist.",
"type": "array",
"items": {
"$ref": "#/$defs/AllowedHeredocPattern"
},
"default": []
},
"content_hashes": {
"description": "Content hashes to allowlist (hash of exact heredoc content).",
"type": "array",
"items": {
"$ref": "#/$defs/ContentHashEntry"
},
"default": []
},
"projects": {
"description": "Project-specific allowlist overrides.",
"type": "array",
"items": {
"$ref": "#/$defs/ProjectHeredocAllowlist"
},
"default": []
}
}
},
"AllowedHeredocPattern": {
"description": "A pattern-based heredoc allowlist entry.",
"type": "object",
"properties": {
"language": {
"description": "Optional language filter (e.g., \"python\", \"bash\"). If None, matches any language.",
"type": [
"string",
"null"
]
},
"pattern": {
"description": "Substring pattern to match in heredoc content.",
"type": "string"
},
"reason": {
"description": "Human-readable reason for allowlisting.",
"type": "string"
}
},
"required": [
"pattern",
"reason"
]
},
"ContentHashEntry": {
"description": "A content-hash based heredoc allowlist entry.",
"type": "object",
"properties": {
"hash": {
"description": "Hash of the exact heredoc content.\n\nThis is a stable, deterministic SHA-256 hash (lowercase hex).",
"type": "string"
},
"reason": {
"description": "Human-readable reason for allowlisting.",
"type": "string"
}
},
"required": [
"hash",
"reason"
]
},
"ProjectHeredocAllowlist": {
"description": "Project-specific heredoc allowlist overrides.",
"type": "object",
"properties": {
"path": {
"description": "Absolute path prefix for the project.",
"type": "string"
},
"patterns": {
"description": "Additional patterns for this project.",
"type": "array",
"items": {
"$ref": "#/$defs/AllowedHeredocPattern"
},
"default": []
},
"content_hashes": {
"description": "Additional content hashes for this project.",
"type": "array",
"items": {
"$ref": "#/$defs/ContentHashEntry"
},
"default": []
}
},
"required": [
"path"
]
},
"ConfidenceConfig": {
"description": "Confidence scoring configuration for ambiguous pattern matches.\n\nWhen enabled, confidence scoring analyzes the context of pattern matches\nto determine if they're likely true positives or false positives. Matches\nin data contexts (quoted strings, commit messages, search patterns) have\nlower confidence and may be downgraded from Deny to Warn.\n\n# Example Configuration (TOML)\n\n```toml\n[confidence]\nenabled = true\nwarn_threshold = 0.5\nprotect_critical = true\n```",
"type": "object",
"properties": {
"enabled": {
"description": "Enable confidence scoring for pattern matches.\n\nWhen enabled, the evaluator computes a confidence score for each match\nbased on execution context (is the match in executed code or data?).\nLow-confidence matches may be downgraded from Deny to Warn.\n\nDefault: false (disabled for backwards compatibility)",
"type": "boolean",
"default": false
},
"warn_threshold": {
"description": "Confidence threshold below which Deny is downgraded to Warn.\n\nValues range from 0.0 (always warn) to 1.0 (never warn).\nRecommended range: 0.3 - 0.7\n\nDefault: 0.5",
"type": "number",
"format": "float",
"default": 0.5
},
"protect_critical": {
"description": "Protect Critical severity patterns from confidence downgrading.\n\nWhen true, Critical severity matches always Deny regardless of\nconfidence score. This prevents catastrophic commands like `rm -rf /`\nfrom being downgraded even if they appear in data context.\n\nDefault: true",
"type": "boolean",
"default": true
}
}
},
"LoggingConfig": {
"description": "Logging configuration.",
"type": "object",
"properties": {
"enabled": {
"description": "Whether structured logging is enabled.",
"type": "boolean",
"default": false
},
"file": {
"description": "Path to log file. Supports ~ expansion.",
"type": [
"string",
"null"
],
"default": null
},
"format": {
"description": "Output format: \"text\" or \"json\".",
"$ref": "#/$defs/LogFormat",
"default": "text"
},
"redaction": {
"description": "Redaction settings.",
"$ref": "#/$defs/RedactionConfig",
"default": {
"enabled": false,
"mode": "arguments",
"max_argument_len": 50
}
},
"events": {
"description": "Events to log.",
"$ref": "#/$defs/LogEventFilter",
"default": {
"deny": true,
"warn": true,
"allow": false
}
}
}
},
"LogFormat": {
"description": "Log output format.",
"type": "string",
"enum": [
"text",
"json"
]
},
"RedactionConfig": {
"description": "Redaction configuration.",
"type": "object",
"properties": {
"enabled": {
"type": "boolean",
"default": false
},
"mode": {
"$ref": "#/$defs/RedactionMode",
"default": "arguments"
},
"max_argument_len": {
"type": "integer",
"format": "uint",
"minimum": 0,
"default": 50
}
}
},
"RedactionMode": {
"description": "Redaction mode.",
"type": "string",
"enum": [
"none",
"arguments",
"full"
]
},
"LogEventFilter": {
"description": "Filter for which events to log.",
"type": "object",
"properties": {
"deny": {
"type": "boolean",
"default": true
},
"warn": {
"type": "boolean",
"default": true
},
"allow": {
"type": "boolean",
"default": false
}
}
},
"HistoryConfig": {
"description": "History configuration options.",
"type": "object",
"properties": {
"enabled": {
"description": "Enable command history collection.",
"type": "boolean",
"default": false
},
"redaction_mode": {
"description": "Redaction mode for stored commands.",
"$ref": "#/$defs/HistoryRedactionMode",
"default": "pattern"
},
"retention_days": {
"description": "Retention window in days.",
"type": "integer",
"format": "uint32",
"minimum": 1,
"maximum": 3650,
"default": 90
},
"max_size_mb": {
"description": "Maximum database size in megabytes.",
"type": "integer",
"format": "uint32",
"minimum": 1,
"default": 500
},
"database_path": {
"description": "Optional database file path override.",
"type": [
"string",
"null"
],
"default": null
},
"auto_prune": {
"description": "Enable automatic pruning of old entries.",
"type": "boolean",
"default": false
},
"prune_check_interval_hours": {
"description": "Interval in hours between automatic prune checks.",
"type": "integer",
"format": "uint32",