-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrules-format.schema.json
More file actions
183 lines (183 loc) · 7.98 KB
/
Copy pathrules-format.schema.json
File metadata and controls
183 lines (183 loc) · 7.98 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
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/PerryLink/dsh-permission-rules/main/docs/rules-format.schema.json",
"title": "dsh-permission-rules rule file",
"description": "Declarative allow/deny/ask permission rules for DeepSeek Harness, evaluated in file order with first-match-wins semantics.",
"type": "object",
"additionalProperties": false,
"properties": {
"rules": {
"description": "The ordered rule list; omitted or empty means an empty rule set (everything passes through).",
"type": "array",
"items": { "$ref": "#/$defs/rule" }
}
},
"$defs": {
"rule": {
"type": "object",
"additionalProperties": false,
"required": ["action", "reason"],
"properties": {
"match": { "$ref": "#/$defs/match" },
"action": {
"description": "What the rule does to a matching tool call.",
"enum": ["allow", "deny", "ask"]
},
"reason": {
"description": "Non-empty explanation; deny/ask reasons become model-visible tool results or approval reasons.",
"type": "string",
"minLength": 1
},
"enabled": {
"description": "false keeps the rule visible but inert (displayed as disabled).",
"type": "boolean"
},
"description": {
"description": "Optional one-line explanation shown by /rules.",
"type": "string",
"minLength": 1
},
"tags": {
"description": "Free-form labels shown by /rules.",
"type": "array",
"items": { "type": "string", "minLength": 1 }
}
}
},
"match": {
"description": "Match dimensions combined with AND; absent dimensions impose no restriction.",
"type": "object",
"additionalProperties": false,
"properties": {
"tools": {
"description": "Tool-name globs (always glob semantics, regardless of patternMode).",
"type": "array",
"items": { "type": "string", "minLength": 1 }
},
"agents": {
"description": "Agent-identity selector globs (main, subagent, preset:<name>); any selector matching any candidate satisfies the dimension. Unknown identity never matches.",
"type": "array",
"items": { "type": "string", "minLength": 1 }
},
"params": {
"description": "Param key to pattern(s). EVERY key must be present and match; a !-prefixed pattern negates. Scalars are stringified; arrays and nested objects contribute their scalar leaves.",
"type": "object",
"additionalProperties": {
"oneOf": [
{ "$ref": "#/$defs/pattern" },
{
"type": "array",
"items": { "$ref": "#/$defs/pattern" },
"minItems": 1
}
]
}
},
"paths": {
"description": "Workspace-relative path patterns; ANY candidate path matching ANY pattern satisfies the dimension. Candidates come from documented argument keys at any nesting depth.",
"type": "array",
"items": { "type": "string", "minLength": 1 }
},
"absent": {
"description": "Argument keys that must be ABSENT; every listed key must be missing.",
"type": "array",
"items": { "type": "string", "minLength": 1 }
},
"when": {
"description": "Host conditions: every listed env var must be present and match; any listed platform matches.",
"type": "object",
"additionalProperties": false,
"properties": {
"env": {
"type": "object",
"additionalProperties": {
"oneOf": [
{ "$ref": "#/$defs/pattern" },
{
"type": "array",
"items": { "$ref": "#/$defs/pattern" },
"minItems": 1
}
]
}
},
"platform": {
"type": "array",
"items": {
"enum": ["aix", "android", "darwin", "freebsd", "linux", "openbsd", "sunos", "win32"]
}
}
}
},
"argv": {
"description": "Shell command decomposition scope: the call must carry a command-string argument whose lexical decomposition (command words, argument tokens, redirect targets, pipeline signature) satisfies every listed field. command/pipeline are globs; args/anyArg follow patternMode. args requires EVERY pattern to match some token; anyArg requires SOME token to match a pattern; a !-prefixed args/anyArg pattern negates. A block must name at least one field.",
"type": "object",
"additionalProperties": false,
"properties": {
"command": {
"description": "Command-word globs; ANY simple-command word matching ANY pattern satisfies the field.",
"type": "array",
"items": { "type": "string", "minLength": 1 }
},
"args": {
"description": "Argument-token patterns; EVERY pattern must match at least one token; a !-prefixed pattern negates.",
"type": "array",
"items": { "$ref": "#/$defs/pattern" },
"minItems": 1
},
"anyArg": {
"description": "Argument-token patterns; ANY token matching ANY pattern satisfies the field; a !-prefixed pattern negates.",
"type": "array",
"items": { "$ref": "#/$defs/pattern" },
"minItems": 1
},
"pipeline": {
"description": "Pipeline-signature globs matched against the command words joined by `|` (e.g. curl|sh); ANY pattern matching satisfies the field.",
"type": "array",
"items": { "type": "string", "minLength": 1 }
}
}
},
"network": {
"description": "Network scope (a network rule): the call must carry a URL candidate (a web-tool URL argument, or a URL embedded in bash/pwsh command text) — or, at the proxy layer, a connection target — satisfying every listed dimension. domains are subdomain-inclusive unless wildcarded; ips accept IPv4/IPv6 literals, globs, and IPv4 CIDRs; ports accept \"*\", one port, or an inclusive low-high range (numeric YAML ports accepted); schemes are http/https. A network block must name at least one dimension.",
"type": "object",
"additionalProperties": false,
"properties": {
"domains": {
"description": "Domain patterns; ANY matching the target host satisfies the dimension.",
"type": "array",
"items": { "type": "string", "minLength": 1 }
},
"ips": {
"description": "IP literals, globs, or IPv4 CIDRs; an IPv4-mapped IPv6 literal (::ffff:169.254.169.254, ::ffff:a9fe:a9fe) is unmapped to its dotted IPv4 form before matching, and a mapped pattern also covers the plain IPv4 spelling; ANY matching the target address satisfies the dimension.",
"type": "array",
"items": { "type": "string", "minLength": 1 }
},
"ports": {
"description": "\"*\", one port, or an inclusive low-high range; ANY matching the effective port satisfies the dimension.",
"type": "array",
"items": {
"oneOf": [
{ "type": "string", "minLength": 1 },
{ "type": "integer", "minimum": 0, "maximum": 65535 }
]
}
},
"schemes": {
"description": "Target scheme must be one of these.",
"type": "array",
"items": { "enum": ["http", "https"] }
}
}
}
}
},
"pattern": {
"oneOf": [
{ "type": "string", "minLength": 1 },
{ "type": "number" },
{ "type": "boolean" }
]
}
}
}