@johnhenry/wsh 0.48.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +156 -30
- package/package.json +21 -3
- package/spec/capabilities.md +175 -0
- package/spec/capabilities.vectors.json +200 -0
- package/spec/duplex-binding.md +86 -0
- package/spec/key-options.vectors.json +248 -0
- package/spec/message-matrix.md +259 -0
- package/spec/wsh-v1.md +1607 -0
- package/spec/wsh-v1.yaml +2783 -0
- package/src/auth.mjs +3 -34
- package/src/capabilities.d.ts +53 -0
- package/src/capabilities.mjs +69 -0
- package/src/duplex.d.ts +69 -0
- package/src/duplex.mjs +208 -0
- package/src/gateway-errors.mjs +45 -0
- package/src/identity.d.ts +61 -0
- package/src/identity.mjs +194 -0
- package/src/index.d.ts +11 -0
- package/src/index.mjs +1 -0
- package/src/key-names.mjs +115 -0
- package/src/key-options.mjs +5 -0
- package/src/mcp-duplex.mjs +184 -0
- package/src/memory-host.d.ts +5 -0
- package/src/memory-host.mjs +3 -2
- package/src/objects-core.mjs +31 -8
- package/src/objects.d.ts +18 -5
- package/src/objects.mjs +4 -1
- package/src/page-host.d.ts +46 -2
- package/src/page-host.mjs +10 -2
- package/src/server/connection.mjs +15 -7
- package/src/server/gateway-core.mjs +4 -4
- package/src/server/socket.mjs +5 -2
- package/src/testing-doubles.mjs +115 -0
- package/src/testing.d.ts +44 -0
- package/src/testing.mjs +3 -0
- package/src/transport.mjs +1 -1
- package/src/webmcp.mjs +8 -4
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Shared test vectors for authorized_keys options (wsh #122). Run by test/key-options.test.mjs (Node host) and by the unit test in crates/wsh-server/src/auth/permissions.rs (Rust server): a key line parses to the same permissions on both hosts, and a request is allowed or refused with the same stable code. Add a case here, never to one suite only.",
|
|
3
|
+
"key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFwuwlhewrj73VpJwckueO62uR5tQZacudrGnfSHW89b",
|
|
4
|
+
"keyPlaceholder": "{KEY}",
|
|
5
|
+
"grants": ["pty", "exec", "mcp", "fileTransfer", "relay"],
|
|
6
|
+
"lines": [
|
|
7
|
+
{ "name": "no options: full access", "line": "{KEY} alice@host", "result": "ok", "can": ["pty", "exec", "mcp", "fileTransfer", "relay"], "forcedCommand": null, "maxSessions": null },
|
|
8
|
+
{ "name": "restrict alone grants nothing", "line": "restrict {KEY}", "result": "ok", "can": [], "forcedCommand": null, "maxSessions": null },
|
|
9
|
+
{ "name": "restrict,permit-exec", "line": "restrict,permit-exec {KEY}", "result": "ok", "can": ["exec"], "forcedCommand": null, "maxSessions": null },
|
|
10
|
+
{ "name": "restrict,permit-pty also runs commands (a shell can)", "line": "restrict,permit-pty {KEY}", "result": "ok", "can": ["pty", "exec"], "forcedCommand": null, "maxSessions": null },
|
|
11
|
+
{ "name": "restrict,permit-pty,no-pty leaves exec only", "line": "restrict,permit-pty,no-pty {KEY}", "result": "ok", "can": ["exec"], "forcedCommand": null, "maxSessions": null },
|
|
12
|
+
{ "name": "restrict,permit-mcp", "line": "restrict,permit-mcp {KEY}", "result": "ok", "can": ["mcp"], "forcedCommand": null, "maxSessions": null },
|
|
13
|
+
{ "name": "restrict,permit-file-transfer", "line": "restrict,permit-file-transfer {KEY}", "result": "ok", "can": ["fileTransfer"], "forcedCommand": null, "maxSessions": null },
|
|
14
|
+
{ "name": "restrict,permit-relay", "line": "restrict,permit-relay {KEY}", "result": "ok", "can": ["relay"], "forcedCommand": null, "maxSessions": null },
|
|
15
|
+
{ "name": "every permit-* under restrict", "line": "restrict,permit-pty,permit-exec,permit-mcp,permit-file-transfer,permit-relay {KEY}", "result": "ok", "can": ["pty", "exec", "mcp", "fileTransfer", "relay"], "forcedCommand": null, "maxSessions": null },
|
|
16
|
+
{ "name": "no-pty alone removes only the pty", "line": "no-pty {KEY}", "result": "ok", "can": ["exec", "mcp", "fileTransfer", "relay"], "forcedCommand": null, "maxSessions": null },
|
|
17
|
+
{ "name": "permit-exec without restrict changes nothing", "line": "permit-exec {KEY}", "result": "ok", "can": ["pty", "exec", "mcp", "fileTransfer", "relay"], "forcedCommand": null, "maxSessions": null },
|
|
18
|
+
{ "name": "a forced command is exec only, with or without restrict", "line": "command=\"/usr/bin/uptime\" {KEY}", "result": "ok", "can": ["exec"], "forcedCommand": "/usr/bin/uptime", "maxSessions": null },
|
|
19
|
+
{ "name": "restrict,command", "line": "restrict,command=\"/usr/bin/uptime\" {KEY}", "result": "ok", "can": ["exec"], "forcedCommand": "/usr/bin/uptime", "maxSessions": null },
|
|
20
|
+
{ "name": "a forced command beats permit-pty", "line": "restrict,permit-pty,permit-mcp,command=\"id\" {KEY}", "result": "ok", "can": ["exec"], "forcedCommand": "id", "maxSessions": null },
|
|
21
|
+
{ "name": "a quoted command may hold spaces, commas and escaped quotes", "line": "command=\"echo \\\"hi, there\\\" now\",no-pty {KEY} bob@host", "result": "ok", "can": ["exec"], "forcedCommand": "echo \"hi, there\" now", "maxSessions": null },
|
|
22
|
+
{ "name": "a backslash that does not escape a quote is literal", "line": "command=\"printf a\\nb\" {KEY}", "result": "ok", "can": ["exec"], "forcedCommand": "printf a\\nb", "maxSessions": null },
|
|
23
|
+
{ "name": "a bare command value", "line": "command=uptime {KEY}", "result": "ok", "can": ["exec"], "forcedCommand": "uptime", "maxSessions": null },
|
|
24
|
+
{ "name": "max-sessions bare", "line": "max-sessions=3 {KEY}", "result": "ok", "can": ["pty", "exec", "mcp", "fileTransfer", "relay"], "forcedCommand": null, "maxSessions": 3 },
|
|
25
|
+
{ "name": "max-sessions quoted", "line": "restrict,permit-exec,max-sessions=\"2\" {KEY}", "result": "ok", "can": ["exec"], "forcedCommand": null, "maxSessions": 2 },
|
|
26
|
+
{ "name": "a tab may separate the options from the key", "line": "restrict,permit-exec\t{KEY}\talice@host", "result": "ok", "can": ["exec"], "forcedCommand": null, "maxSessions": null },
|
|
27
|
+
{ "name": "ssh options that ask for less than wsh offers are accepted and change nothing", "line": "no-agent-forwarding,no-X11-forwarding,no-user-rc,no-port-forwarding,restrict,permit-exec {KEY}", "result": "ok", "can": ["exec"], "forcedCommand": null, "maxSessions": null },
|
|
28
|
+
{ "name": "blank line", "line": " ", "result": "skip" },
|
|
29
|
+
{ "name": "comment", "line": "# restrict {KEY}", "result": "skip" },
|
|
30
|
+
{ "name": "another key type is not served", "line": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQ alice", "result": "skip" },
|
|
31
|
+
{ "name": "options in front of another key type", "line": "restrict ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQ alice", "result": "skip" },
|
|
32
|
+
{ "name": "an unterminated quote cannot be split from the key", "line": "command=\"oops {KEY}", "result": "skip" },
|
|
33
|
+
{ "name": "an option this host does not know refuses the key", "line": "restrict,from=\"10.0.0.1\" {KEY}", "result": "refused", "code": "unknown-option" },
|
|
34
|
+
{ "name": "option names are case sensitive", "line": "Restrict {KEY}", "result": "refused", "code": "unknown-option" },
|
|
35
|
+
{ "name": "a future option refuses the key, even next to ones that are known", "line": "permit-exec,permit-teleport {KEY}", "result": "refused", "code": "unknown-option" },
|
|
36
|
+
{ "name": "a stray comma", "line": "restrict,,no-pty {KEY}", "result": "refused", "code": "bad-syntax" },
|
|
37
|
+
{ "name": "a trailing comma", "line": "restrict, {KEY}", "result": "refused", "code": "bad-syntax" },
|
|
38
|
+
{ "name": "single quotes are not quotes", "line": "command='ls' {KEY}", "result": "refused", "code": "bad-syntax" },
|
|
39
|
+
{ "name": "text after a closing quote", "line": "command=\"a\"b {KEY}", "result": "refused", "code": "bad-syntax" },
|
|
40
|
+
{ "name": "a bare value with an equals sign", "line": "command=a=b {KEY}", "result": "refused", "code": "bad-syntax" },
|
|
41
|
+
{ "name": "an empty command", "line": "command=\"\" {KEY}", "result": "refused", "code": "bad-value" },
|
|
42
|
+
{ "name": "command without a value", "line": "restrict,command {KEY}", "result": "refused", "code": "bad-value" },
|
|
43
|
+
{ "name": "max-sessions=0 is not 'unlimited'", "line": "max-sessions=0 {KEY}", "result": "refused", "code": "bad-value" },
|
|
44
|
+
{ "name": "max-sessions that is not a number", "line": "max-sessions=many {KEY}", "result": "refused", "code": "bad-value" },
|
|
45
|
+
{ "name": "max-sessions negative", "line": "max-sessions=-1 {KEY}", "result": "refused", "code": "bad-value" },
|
|
46
|
+
{ "name": "max-sessions fractional", "line": "max-sessions=1.5 {KEY}", "result": "refused", "code": "bad-value" },
|
|
47
|
+
{ "name": "a flag with a value", "line": "restrict=\"yes\" {KEY}", "result": "refused", "code": "bad-value" },
|
|
48
|
+
{ "name": "a control character in a command", "line": "command=\"a\u0001b\" {KEY}", "result": "refused", "code": "bad-value" },
|
|
49
|
+
{ "name": "command given twice", "line": "command=\"a\",command=\"b\" {KEY}", "result": "refused", "code": "duplicate-option" },
|
|
50
|
+
{ "name": "a flag given twice", "line": "restrict,restrict {KEY}", "result": "refused", "code": "duplicate-option" },
|
|
51
|
+
|
|
52
|
+
{ "name": "capabilities: exec and pty", "line": "capabilities=\"exec,pty\" {KEY}", "result": "ok", "can": ["pty", "exec", "mcp", "fileTransfer", "relay"], "forcedCommand": null, "maxSessions": null, "capabilities": ["exec", "pty"] },
|
|
53
|
+
{ "name": "capabilities: a bare value without commas", "line": "capabilities=exec {KEY}", "result": "ok", "can": ["pty", "exec", "mcp", "fileTransfer", "relay"], "forcedCommand": null, "maxSessions": null, "capabilities": ["exec"] },
|
|
54
|
+
{ "name": "capabilities: present but empty is deny-all, not 'no option'", "line": "capabilities=\"\" {KEY}", "result": "ok", "can": ["pty", "exec", "mcp", "fileTransfer", "relay"], "forcedCommand": null, "maxSessions": null, "capabilities": [] },
|
|
55
|
+
{ "name": "capabilities: every form of the grammar", "line": "capabilities=\"exec,pty,relay,fs:read,fs:write,gateway:tcp:db.internal:5432,gateway:tcp:*.example.com:443,gateway:tcp:*:*,gateway:tcp:[::1]:8080,gateway:udp:*:53,gateway:listen:tcp:8080,gateway:listen:tcp:*,unix:/run/app.sock,unix:/srv/*,unix:listen:/run/x.sock,endpoint:logs,endpoint:*,mcp:echo,mcp:*,target:web,target:*,rpc:wsh-host\" {KEY}", "result": "ok", "can": ["pty", "exec", "mcp", "fileTransfer", "relay"], "forcedCommand": null, "maxSessions": null, "capabilities": ["exec", "pty", "relay", "fs:read", "fs:write", "gateway:tcp:db.internal:5432", "gateway:tcp:*.example.com:443", "gateway:tcp:*:*", "gateway:tcp:[::1]:8080", "gateway:udp:*:53", "gateway:listen:tcp:8080", "gateway:listen:tcp:*", "unix:/run/app.sock", "unix:/srv/*", "unix:listen:/run/x.sock", "endpoint:logs", "endpoint:*", "mcp:echo", "mcp:*", "target:web", "target:*", "rpc:wsh-host"] },
|
|
56
|
+
{ "name": "capabilities narrow the options, they do not widen them", "line": "restrict,permit-exec,capabilities=\"exec,pty\" {KEY}", "result": "ok", "can": ["exec"], "forcedCommand": null, "maxSessions": null, "capabilities": ["exec", "pty"] },
|
|
57
|
+
{ "name": "expires, UTC", "line": "expires=\"2030-01-01T00:00:00Z\" {KEY}", "result": "ok", "can": ["pty", "exec", "mcp", "fileTransfer", "relay"], "forcedCommand": null, "maxSessions": null, "expires": 1893456000 },
|
|
58
|
+
{ "name": "expires, with an offset", "line": "expires=\"2030-01-01T00:00:00+01:00\" {KEY}", "result": "ok", "can": ["pty", "exec", "mcp", "fileTransfer", "relay"], "forcedCommand": null, "maxSessions": null, "expires": 1893452400 },
|
|
59
|
+
{ "name": "expires, fractional seconds are dropped", "line": "expires=\"2030-01-01T00:00:00.999Z\" {KEY}", "result": "ok", "can": ["pty", "exec", "mcp", "fileTransfer", "relay"], "forcedCommand": null, "maxSessions": null, "expires": 1893456000 },
|
|
60
|
+
{ "name": "expires on a leap day", "line": "expires=\"2028-02-29T12:00:00Z\" {KEY}", "result": "ok", "can": ["pty", "exec", "mcp", "fileTransfer", "relay"], "forcedCommand": null, "maxSessions": null, "expires": 1835438400 },
|
|
61
|
+
{ "name": "capabilities and expires together, with other options", "line": "restrict,permit-exec,max-sessions=2,capabilities=\"exec\",expires=\"2030-01-01T00:00:00Z\" {KEY}", "result": "ok", "can": ["exec"], "forcedCommand": null, "maxSessions": 2, "capabilities": ["exec"], "expires": 1893456000 },
|
|
62
|
+
{ "name": "an unknown capability refuses the key", "line": "capabilities=\"exec,teleport\" {KEY}", "result": "refused", "code": "unknown-capability" },
|
|
63
|
+
{ "name": "capability names are case sensitive", "line": "capabilities=\"Exec\" {KEY}", "result": "refused", "code": "unknown-capability" },
|
|
64
|
+
{ "name": "fs has read and write only", "line": "capabilities=\"fs:execute\" {KEY}", "result": "refused", "code": "unknown-capability" },
|
|
65
|
+
{ "name": "an empty capability", "line": "capabilities=\"exec,,pty\" {KEY}", "result": "refused", "code": "bad-capability" },
|
|
66
|
+
{ "name": "a trailing comma in capabilities", "line": "capabilities=\"exec,\" {KEY}", "result": "refused", "code": "bad-capability" },
|
|
67
|
+
{ "name": "no spaces inside the capability list", "line": "capabilities=\"exec, pty\" {KEY}", "result": "refused", "code": "bad-capability" },
|
|
68
|
+
{ "name": "a gateway capability needs a port", "line": "capabilities=\"gateway:tcp:db.internal\" {KEY}", "result": "refused", "code": "bad-capability" },
|
|
69
|
+
{ "name": "a port out of range", "line": "capabilities=\"gateway:tcp:db.internal:99999\" {KEY}", "result": "refused", "code": "bad-capability" },
|
|
70
|
+
{ "name": "port 0", "line": "capabilities=\"gateway:tcp:db.internal:0\" {KEY}", "result": "refused", "code": "bad-capability" },
|
|
71
|
+
{ "name": "a gateway capability needs a host", "line": "capabilities=\"gateway:tcp::80\" {KEY}", "result": "refused", "code": "bad-capability" },
|
|
72
|
+
{ "name": "a wildcard in the middle of a host", "line": "capabilities=\"gateway:tcp:a*b.example.com:80\" {KEY}", "result": "refused", "code": "bad-capability" },
|
|
73
|
+
{ "name": "an unknown gateway protocol", "line": "capabilities=\"gateway:sctp:host:1\" {KEY}", "result": "refused", "code": "unknown-capability" },
|
|
74
|
+
{ "name": "a unix path must be absolute", "line": "capabilities=\"unix:run/app.sock\" {KEY}", "result": "refused", "code": "bad-capability" },
|
|
75
|
+
{ "name": "a unix path may not climb", "line": "capabilities=\"unix:/srv/../etc/x\" {KEY}", "result": "refused", "code": "bad-capability" },
|
|
76
|
+
{ "name": "a wildcard only as a trailing /*", "line": "capabilities=\"unix:/srv/*/x\" {KEY}", "result": "refused", "code": "bad-capability" },
|
|
77
|
+
{ "name": "an endpoint name must be a name", "line": "capabilities=\"endpoint:-x\" {KEY}", "result": "refused", "code": "bad-capability" },
|
|
78
|
+
{ "name": "mcp needs a tool", "line": "capabilities=\"mcp:\" {KEY}", "result": "refused", "code": "bad-capability" },
|
|
79
|
+
{ "name": "target needs a name", "line": "capabilities=\"target:\" {KEY}", "result": "refused", "code": "bad-capability" },
|
|
80
|
+
{ "name": "a capability that takes no argument, given one", "line": "capabilities=\"exec:now\" {KEY}", "result": "refused", "code": "unknown-capability" },
|
|
81
|
+
{ "name": "capabilities given twice", "line": "capabilities=\"exec\",capabilities=\"pty\" {KEY}", "result": "refused", "code": "duplicate-option" },
|
|
82
|
+
{ "name": "capabilities without a value", "line": "capabilities {KEY}", "result": "refused", "code": "bad-value" },
|
|
83
|
+
{ "name": "expires that is not a date", "line": "expires=\"tomorrow\" {KEY}", "result": "refused", "code": "bad-value" },
|
|
84
|
+
{ "name": "expires without a time", "line": "expires=\"2030-01-01\" {KEY}", "result": "refused", "code": "bad-value" },
|
|
85
|
+
{ "name": "expires without a zone", "line": "expires=\"2030-01-01T00:00:00\" {KEY}", "result": "refused", "code": "bad-value" },
|
|
86
|
+
{ "name": "expires, lower case t and z are not RFC 3339 here", "line": "expires=\"2030-01-01t00:00:00z\" {KEY}", "result": "refused", "code": "bad-value" },
|
|
87
|
+
{ "name": "expires, month 13", "line": "expires=\"2030-13-01T00:00:00Z\" {KEY}", "result": "refused", "code": "bad-value" },
|
|
88
|
+
{ "name": "expires, 30 February", "line": "expires=\"2030-02-30T00:00:00Z\" {KEY}", "result": "refused", "code": "bad-value" },
|
|
89
|
+
{ "name": "expires, 29 February of a year that is not leap", "line": "expires=\"2029-02-29T00:00:00Z\" {KEY}", "result": "refused", "code": "bad-value" },
|
|
90
|
+
{ "name": "expires, hour 24", "line": "expires=\"2030-01-01T24:00:00Z\" {KEY}", "result": "refused", "code": "bad-value" },
|
|
91
|
+
{ "name": "expires, second 60", "line": "expires=\"2030-01-01T00:00:60Z\" {KEY}", "result": "refused", "code": "bad-value" },
|
|
92
|
+
{ "name": "expires, an offset of 24 hours", "line": "expires=\"2030-01-01T00:00:00+24:00\" {KEY}", "result": "refused", "code": "bad-value" },
|
|
93
|
+
{ "name": "expires without a value", "line": "expires {KEY}", "result": "refused", "code": "bad-value" },
|
|
94
|
+
{ "name": "expires given twice", "line": "expires=\"2030-01-01T00:00:00Z\",expires=\"2031-01-01T00:00:00Z\" {KEY}", "result": "refused", "code": "duplicate-option" }
|
|
95
|
+
],
|
|
96
|
+
"requests": [
|
|
97
|
+
{ "name": "no options: pty", "options": "", "request": { "kind": "open", "channel": "pty" }, "allowed": true },
|
|
98
|
+
{ "name": "no options: everything", "options": "", "request": { "kind": "relay" }, "allowed": true },
|
|
99
|
+
{ "name": "restrict: pty refused", "options": "restrict", "request": { "kind": "open", "channel": "pty" }, "allowed": false, "code": "pty-not-permitted" },
|
|
100
|
+
{ "name": "restrict: exec refused", "options": "restrict", "request": { "kind": "open", "channel": "exec" }, "allowed": false, "code": "exec-not-permitted" },
|
|
101
|
+
{ "name": "restrict: file refused", "options": "restrict", "request": { "kind": "open", "channel": "file" }, "allowed": false, "code": "file-transfer-not-permitted" },
|
|
102
|
+
{ "name": "restrict: file op refused", "options": "restrict", "request": { "kind": "file-op" }, "allowed": false, "code": "file-transfer-not-permitted" },
|
|
103
|
+
{ "name": "restrict: mcp refused", "options": "restrict", "request": { "kind": "mcp" }, "allowed": false, "code": "mcp-not-permitted" },
|
|
104
|
+
{ "name": "restrict: relay refused", "options": "restrict", "request": { "kind": "relay" }, "allowed": false, "code": "relay-not-permitted" },
|
|
105
|
+
{ "name": "permit-exec: exec served", "options": "restrict,permit-exec", "request": { "kind": "open", "channel": "exec" }, "allowed": true },
|
|
106
|
+
{ "name": "permit-exec: pty refused", "options": "restrict,permit-exec", "request": { "kind": "open", "channel": "pty" }, "allowed": false, "code": "pty-not-permitted" },
|
|
107
|
+
{ "name": "permit-pty: pty served", "options": "restrict,permit-pty", "request": { "kind": "open", "channel": "pty" }, "allowed": true },
|
|
108
|
+
{ "name": "permit-pty: exec served", "options": "restrict,permit-pty", "request": { "kind": "open", "channel": "exec" }, "allowed": true },
|
|
109
|
+
{ "name": "no-pty: pty refused", "options": "no-pty", "request": { "kind": "open", "channel": "pty" }, "allowed": false, "code": "pty-not-permitted" },
|
|
110
|
+
{ "name": "no-pty: exec served", "options": "no-pty", "request": { "kind": "open", "channel": "exec" }, "allowed": true },
|
|
111
|
+
{ "name": "permit-file-transfer: upload channel served", "options": "restrict,permit-file-transfer", "request": { "kind": "open", "channel": "file" }, "allowed": true },
|
|
112
|
+
{ "name": "permit-file-transfer: file op served", "options": "restrict,permit-file-transfer", "request": { "kind": "file-op" }, "allowed": true },
|
|
113
|
+
{ "name": "permit-file-transfer: wsh-fs served", "options": "restrict,permit-file-transfer", "request": { "kind": "open", "channel": "rpc", "protocol": "wsh-fs" }, "allowed": true },
|
|
114
|
+
{ "name": "no file permission: wsh-fs refused", "options": "restrict,permit-exec", "request": { "kind": "open", "channel": "rpc", "protocol": "wsh-fs" }, "allowed": false, "code": "file-transfer-not-permitted" },
|
|
115
|
+
{ "name": "permit-mcp: mcp served", "options": "restrict,permit-mcp", "request": { "kind": "mcp" }, "allowed": true },
|
|
116
|
+
{ "name": "permit-mcp: mcp rpc channel served", "options": "restrict,permit-mcp", "request": { "kind": "open", "channel": "rpc", "protocol": "mcp" }, "allowed": true },
|
|
117
|
+
{ "name": "no mcp permission: mcp rpc channel refused", "options": "restrict,permit-exec", "request": { "kind": "open", "channel": "rpc", "protocol": "mcp" }, "allowed": false, "code": "mcp-not-permitted" },
|
|
118
|
+
{ "name": "permit-relay: relay served", "options": "restrict,permit-relay", "request": { "kind": "relay" }, "allowed": true },
|
|
119
|
+
{ "name": "wsh-host is open to a restricted key", "options": "restrict", "request": { "kind": "open", "channel": "rpc", "protocol": "wsh-host" }, "allowed": true },
|
|
120
|
+
{ "name": "an embedder's own rpc protocol is closed to a restricted key", "options": "restrict,permit-exec", "request": { "kind": "open", "channel": "rpc", "protocol": "my-proto" }, "allowed": false, "code": "exec-not-permitted" },
|
|
121
|
+
{ "name": "an embedder's own rpc protocol is open to an unrestricted key", "options": "no-agent-forwarding", "request": { "kind": "open", "channel": "rpc", "protocol": "my-proto" }, "allowed": true },
|
|
122
|
+
{ "name": "a forced command: exec served", "options": "command=\"uptime\"", "request": { "kind": "open", "channel": "exec" }, "allowed": true },
|
|
123
|
+
{ "name": "a forced command: pty refused", "options": "command=\"uptime\"", "request": { "kind": "open", "channel": "pty" }, "allowed": false, "code": "forced-command" },
|
|
124
|
+
{ "name": "a forced command: file refused", "options": "command=\"uptime\"", "request": { "kind": "open", "channel": "file" }, "allowed": false, "code": "forced-command" },
|
|
125
|
+
{ "name": "a forced command: file op refused", "options": "command=\"uptime\"", "request": { "kind": "file-op" }, "allowed": false, "code": "forced-command" },
|
|
126
|
+
{ "name": "a forced command: rpc refused", "options": "command=\"uptime\"", "request": { "kind": "open", "channel": "rpc", "protocol": "wsh-host" }, "allowed": false, "code": "forced-command" },
|
|
127
|
+
{ "name": "a forced command: mcp refused", "options": "command=\"uptime\"", "request": { "kind": "mcp" }, "allowed": false, "code": "mcp-not-permitted" },
|
|
128
|
+
{ "name": "a forced command: relay refused", "options": "command=\"uptime\"", "request": { "kind": "relay" }, "allowed": false, "code": "relay-not-permitted" },
|
|
129
|
+
{ "name": "no options: may install another key (AuthorizedKeyAdd)", "options": "", "request": { "kind": "key-admin" }, "allowed": true },
|
|
130
|
+
{ "name": "max-sessions alone does not restrict key installation", "options": "max-sessions=3", "request": { "kind": "key-admin" }, "allowed": true },
|
|
131
|
+
{ "name": "restrict: may not install a key (it would be a key with no restrictions)", "options": "restrict,permit-exec", "request": { "kind": "key-admin" }, "allowed": false, "code": "key-admin-not-permitted" },
|
|
132
|
+
{ "name": "no-pty: may not install a key", "options": "no-pty", "request": { "kind": "key-admin" }, "allowed": false, "code": "key-admin-not-permitted" },
|
|
133
|
+
{ "name": "a key with a capability list may not install a key (the new key has none)", "options": "capabilities=\"exec,pty,relay,fs:read,fs:write,mcp:*\"", "request": { "kind": "key-admin" }, "allowed": false, "code": "key-admin-not-permitted" },
|
|
134
|
+
{ "name": "a forced command: may not install a key", "options": "command=\"uptime\"", "request": { "kind": "key-admin" }, "allowed": false, "code": "key-admin-not-permitted" },
|
|
135
|
+
{ "name": "max-sessions=2 with none open", "options": "max-sessions=2", "request": { "kind": "open", "channel": "exec" }, "activeSessions": 0, "allowed": true },
|
|
136
|
+
{ "name": "max-sessions=2 with one open", "options": "max-sessions=2", "request": { "kind": "open", "channel": "pty" }, "activeSessions": 1, "allowed": true },
|
|
137
|
+
{ "name": "max-sessions=2 with two open: exec refused", "options": "max-sessions=2", "request": { "kind": "open", "channel": "exec" }, "activeSessions": 2, "allowed": false, "code": "max-sessions" },
|
|
138
|
+
{ "name": "max-sessions=2 with two open: pty refused", "options": "max-sessions=2", "request": { "kind": "open", "channel": "pty" }, "activeSessions": 2, "allowed": false, "code": "max-sessions" },
|
|
139
|
+
{ "name": "max-sessions does not count file channels", "options": "max-sessions=1", "request": { "kind": "open", "channel": "file" }, "activeSessions": 5, "allowed": true },
|
|
140
|
+
{ "name": "no cap: any number open", "options": "restrict,permit-exec", "request": { "kind": "open", "channel": "exec" }, "activeSessions": 1000, "allowed": true },
|
|
141
|
+
|
|
142
|
+
{ "name": "capabilities=exec: exec served", "options": "capabilities=\"exec\"", "request": { "kind": "open", "channel": "exec" }, "allowed": true },
|
|
143
|
+
{ "name": "capabilities=exec: pty refused, naming the capability", "options": "capabilities=\"exec\"", "request": { "kind": "open", "channel": "pty" }, "allowed": false, "code": "capability-missing", "capability": "pty" },
|
|
144
|
+
{ "name": "capabilities=pty: pty served", "options": "capabilities=\"pty\"", "request": { "kind": "open", "channel": "pty" }, "allowed": true },
|
|
145
|
+
{ "name": "capabilities=pty does not imply exec", "options": "capabilities=\"pty\"", "request": { "kind": "open", "channel": "exec" }, "allowed": false, "code": "capability-missing", "capability": "exec" },
|
|
146
|
+
{ "name": "capabilities=\"\": deny-all, exec", "options": "capabilities=\"\"", "request": { "kind": "open", "channel": "exec" }, "allowed": false, "code": "capability-missing", "capability": "exec" },
|
|
147
|
+
{ "name": "capabilities=\"\": deny-all, relay", "options": "capabilities=\"\"", "request": { "kind": "relay" }, "allowed": false, "code": "capability-missing", "capability": "relay" },
|
|
148
|
+
{ "name": "capabilities=\"\": deny-all, file op", "options": "capabilities=\"\"", "request": { "kind": "file-op", "op": "list" }, "allowed": false, "code": "capability-missing", "capability": "fs:read" },
|
|
149
|
+
{ "name": "capabilities=\"\": deny-all, tcp", "options": "capabilities=\"\"", "request": { "kind": "tcp", "host": "example.com", "port": 443 }, "allowed": false, "code": "capability-missing", "capability": "gateway:tcp:example.com:443" },
|
|
150
|
+
{ "name": "options still apply first: restrict refuses what capabilities would grant", "options": "restrict,permit-exec,capabilities=\"exec,pty\"", "request": { "kind": "open", "channel": "pty" }, "allowed": false, "code": "pty-not-permitted" },
|
|
151
|
+
{ "name": "options and capabilities: both allow", "options": "restrict,permit-exec,capabilities=\"exec,pty\"", "request": { "kind": "open", "channel": "exec" }, "allowed": true },
|
|
152
|
+
{ "name": "a forced command still has no pty when the capability is given", "options": "command=\"uptime\",capabilities=\"exec,pty\"", "request": { "kind": "open", "channel": "pty" }, "allowed": false, "code": "forced-command" },
|
|
153
|
+
{ "name": "max-sessions with capabilities", "options": "max-sessions=1,capabilities=\"exec\"", "request": { "kind": "open", "channel": "exec" }, "activeSessions": 1, "allowed": false, "code": "max-sessions" },
|
|
154
|
+
|
|
155
|
+
{ "name": "fs:read: download channel served", "options": "capabilities=\"fs:read\"", "request": { "kind": "open", "channel": "file", "direction": "download" }, "allowed": true },
|
|
156
|
+
{ "name": "fs:read: upload channel refused", "options": "capabilities=\"fs:read\"", "request": { "kind": "open", "channel": "file", "direction": "upload" }, "allowed": false, "code": "capability-missing", "capability": "fs:write" },
|
|
157
|
+
{ "name": "fs:write: upload channel served", "options": "capabilities=\"fs:write\"", "request": { "kind": "open", "channel": "file", "direction": "upload" }, "allowed": true },
|
|
158
|
+
{ "name": "fs:write does not read", "options": "capabilities=\"fs:write\"", "request": { "kind": "open", "channel": "file", "direction": "download" }, "allowed": false, "code": "capability-missing", "capability": "fs:read" },
|
|
159
|
+
{ "name": "fs:read: list", "options": "capabilities=\"fs:read\"", "request": { "kind": "file-op", "op": "list" }, "allowed": true },
|
|
160
|
+
{ "name": "fs:read: stat", "options": "capabilities=\"fs:read\"", "request": { "kind": "file-op", "op": "stat" }, "allowed": true },
|
|
161
|
+
{ "name": "fs:read: read", "options": "capabilities=\"fs:read\"", "request": { "kind": "file-op", "op": "read" }, "allowed": true },
|
|
162
|
+
{ "name": "fs:read: write refused", "options": "capabilities=\"fs:read\"", "request": { "kind": "file-op", "op": "write" }, "allowed": false, "code": "capability-missing", "capability": "fs:write" },
|
|
163
|
+
{ "name": "fs:read: mkdir refused", "options": "capabilities=\"fs:read\"", "request": { "kind": "file-op", "op": "mkdir" }, "allowed": false, "code": "capability-missing", "capability": "fs:write" },
|
|
164
|
+
{ "name": "fs:read: remove refused", "options": "capabilities=\"fs:read\"", "request": { "kind": "file-op", "op": "remove" }, "allowed": false, "code": "capability-missing", "capability": "fs:write" },
|
|
165
|
+
{ "name": "fs:read: rename refused", "options": "capabilities=\"fs:read\"", "request": { "kind": "file-op", "op": "rename" }, "allowed": false, "code": "capability-missing", "capability": "fs:write" },
|
|
166
|
+
{ "name": "fs:write: write", "options": "capabilities=\"fs:write\"", "request": { "kind": "file-op", "op": "write" }, "allowed": true },
|
|
167
|
+
{ "name": "fs:write: remove", "options": "capabilities=\"fs:write\"", "request": { "kind": "file-op", "op": "remove" }, "allowed": true },
|
|
168
|
+
{ "name": "fs:write: list refused", "options": "capabilities=\"fs:write\"", "request": { "kind": "file-op", "op": "list" }, "allowed": false, "code": "capability-missing", "capability": "fs:read" },
|
|
169
|
+
{ "name": "an op nobody knows needs fs:write", "options": "capabilities=\"fs:read\"", "request": { "kind": "file-op", "op": "chmod" }, "allowed": false, "code": "capability-missing", "capability": "fs:write" },
|
|
170
|
+
{ "name": "wsh-fs needs both fs:read and fs:write (clients fall back to FileOp otherwise)", "options": "capabilities=\"fs:read\"", "request": { "kind": "open", "channel": "rpc", "protocol": "wsh-fs" }, "allowed": false, "code": "capability-missing", "capability": "fs:write" },
|
|
171
|
+
{ "name": "wsh-fs with both", "options": "capabilities=\"fs:read,fs:write\"", "request": { "kind": "open", "channel": "rpc", "protocol": "wsh-fs" }, "allowed": true },
|
|
172
|
+
{ "name": "rpc mcp needs mcp:*", "options": "capabilities=\"mcp:echo\"", "request": { "kind": "open", "channel": "rpc", "protocol": "mcp" }, "allowed": false, "code": "capability-missing", "capability": "mcp:*" },
|
|
173
|
+
{ "name": "rpc mcp with mcp:*", "options": "capabilities=\"mcp:*\"", "request": { "kind": "open", "channel": "rpc", "protocol": "mcp" }, "allowed": true },
|
|
174
|
+
{ "name": "rpc wsh-host needs rpc:wsh-host", "options": "capabilities=\"exec\"", "request": { "kind": "open", "channel": "rpc", "protocol": "wsh-host" }, "allowed": false, "code": "capability-missing", "capability": "rpc:wsh-host" },
|
|
175
|
+
{ "name": "rpc wsh-host with it", "options": "capabilities=\"rpc:wsh-host\"", "request": { "kind": "open", "channel": "rpc", "protocol": "wsh-host" }, "allowed": true },
|
|
176
|
+
{ "name": "an embedder's rpc protocol with rpc:NAME", "options": "capabilities=\"rpc:my-proto\"", "request": { "kind": "open", "channel": "rpc", "protocol": "my-proto" }, "allowed": true },
|
|
177
|
+
{ "name": "an embedder's rpc protocol is not granted by another name", "options": "capabilities=\"rpc:my-proto\"", "request": { "kind": "open", "channel": "rpc", "protocol": "other" }, "allowed": false, "code": "capability-missing", "capability": "rpc:other" },
|
|
178
|
+
|
|
179
|
+
{ "name": "mcp:echo: call echo", "options": "capabilities=\"mcp:echo\"", "request": { "kind": "mcp-call", "tool": "echo" }, "allowed": true },
|
|
180
|
+
{ "name": "mcp:echo: call another tool refused", "options": "capabilities=\"mcp:echo\"", "request": { "kind": "mcp-call", "tool": "shell" }, "allowed": false, "code": "capability-missing", "capability": "mcp:shell" },
|
|
181
|
+
{ "name": "mcp:echo: list echo", "options": "capabilities=\"mcp:echo\"", "request": { "kind": "mcp-tool", "tool": "echo" }, "allowed": true },
|
|
182
|
+
{ "name": "mcp:echo: another tool is not listed", "options": "capabilities=\"mcp:echo\"", "request": { "kind": "mcp-tool", "tool": "shell" }, "allowed": false, "code": "capability-missing", "capability": "mcp:shell" },
|
|
183
|
+
{ "name": "mcp:*: any tool", "options": "capabilities=\"mcp:*\"", "request": { "kind": "mcp-call", "tool": "shell" }, "allowed": true },
|
|
184
|
+
{ "name": "mcp discovery needs some mcp capability", "options": "capabilities=\"exec\"", "request": { "kind": "mcp" }, "allowed": false, "code": "capability-missing", "capability": "mcp:*" },
|
|
185
|
+
{ "name": "mcp discovery with one tool", "options": "capabilities=\"mcp:echo\"", "request": { "kind": "mcp" }, "allowed": true },
|
|
186
|
+
{ "name": "mcp capability does not need the option", "options": "restrict,capabilities=\"mcp:echo\"", "request": { "kind": "mcp-call", "tool": "echo" }, "allowed": false, "code": "mcp-not-permitted" },
|
|
187
|
+
|
|
188
|
+
{ "name": "relay capability", "options": "capabilities=\"relay\"", "request": { "kind": "relay" }, "allowed": true },
|
|
189
|
+
{ "name": "no relay capability", "options": "capabilities=\"exec\"", "request": { "kind": "relay" }, "allowed": false, "code": "capability-missing", "capability": "relay" },
|
|
190
|
+
|
|
191
|
+
{ "name": "tcp: exact host and port", "options": "capabilities=\"gateway:tcp:db.internal:5432\"", "request": { "kind": "tcp", "host": "db.internal", "port": 5432 }, "allowed": true },
|
|
192
|
+
{ "name": "tcp: the host is case-insensitive", "options": "capabilities=\"gateway:tcp:db.internal:5432\"", "request": { "kind": "tcp", "host": "DB.Internal", "port": 5432 }, "allowed": true },
|
|
193
|
+
{ "name": "tcp: another port", "options": "capabilities=\"gateway:tcp:db.internal:5432\"", "request": { "kind": "tcp", "host": "db.internal", "port": 22 }, "allowed": false, "code": "capability-missing", "capability": "gateway:tcp:db.internal:22" },
|
|
194
|
+
{ "name": "tcp: another host", "options": "capabilities=\"gateway:tcp:db.internal:5432\"", "request": { "kind": "tcp", "host": "db.internal.evil.com", "port": 5432 }, "allowed": false, "code": "capability-missing", "capability": "gateway:tcp:db.internal.evil.com:5432" },
|
|
195
|
+
{ "name": "tcp: a suffix pattern matches a subdomain", "options": "capabilities=\"gateway:tcp:*.example.com:443\"", "request": { "kind": "tcp", "host": "api.example.com", "port": 443 }, "allowed": true },
|
|
196
|
+
{ "name": "tcp: a suffix pattern matches a deeper subdomain", "options": "capabilities=\"gateway:tcp:*.example.com:443\"", "request": { "kind": "tcp", "host": "a.b.example.com", "port": 443 }, "allowed": true },
|
|
197
|
+
{ "name": "tcp: a suffix pattern does not match the apex", "options": "capabilities=\"gateway:tcp:*.example.com:443\"", "request": { "kind": "tcp", "host": "example.com", "port": 443 }, "allowed": false, "code": "capability-missing", "capability": "gateway:tcp:example.com:443" },
|
|
198
|
+
{ "name": "tcp: a suffix pattern does not match a look-alike", "options": "capabilities=\"gateway:tcp:*.example.com:443\"", "request": { "kind": "tcp", "host": "evilexample.com", "port": 443 }, "allowed": false, "code": "capability-missing", "capability": "gateway:tcp:evilexample.com:443" },
|
|
199
|
+
{ "name": "tcp: any port", "options": "capabilities=\"gateway:tcp:db.internal:*\"", "request": { "kind": "tcp", "host": "db.internal", "port": 1 }, "allowed": true },
|
|
200
|
+
{ "name": "tcp: any host, one port", "options": "capabilities=\"gateway:tcp:*:443\"", "request": { "kind": "tcp", "host": "1.2.3.4", "port": 443 }, "allowed": true },
|
|
201
|
+
{ "name": "tcp: any host and port", "options": "capabilities=\"gateway:tcp:*:*\"", "request": { "kind": "tcp", "host": "anything.example", "port": 9 }, "allowed": true },
|
|
202
|
+
{ "name": "tcp: an IPv6 literal", "options": "capabilities=\"gateway:tcp:[::1]:8080\"", "request": { "kind": "tcp", "host": "::1", "port": 8080 }, "allowed": true },
|
|
203
|
+
{ "name": "tcp: udp is not tcp", "options": "capabilities=\"gateway:tcp:*:*\"", "request": { "kind": "udp", "host": "1.1.1.1", "port": 53 }, "allowed": false, "code": "capability-missing", "capability": "gateway:udp:1.1.1.1:53" },
|
|
204
|
+
{ "name": "udp: granted", "options": "capabilities=\"gateway:udp:*:53\"", "request": { "kind": "udp", "host": "1.1.1.1", "port": 53 }, "allowed": true },
|
|
205
|
+
{ "name": "udp: another port", "options": "capabilities=\"gateway:udp:*:53\"", "request": { "kind": "udp", "host": "1.1.1.1", "port": 123 }, "allowed": false, "code": "capability-missing", "capability": "gateway:udp:1.1.1.1:123" },
|
|
206
|
+
{ "name": "dns: a name the key may connect to", "options": "capabilities=\"gateway:tcp:db.internal:5432\"", "request": { "kind": "dns", "name": "db.internal" }, "allowed": true },
|
|
207
|
+
{ "name": "dns: a name it may not", "options": "capabilities=\"gateway:tcp:db.internal:5432\"", "request": { "kind": "dns", "name": "other.internal" }, "allowed": false, "code": "capability-missing", "capability": "gateway:tcp:other.internal:*" },
|
|
208
|
+
{ "name": "dns: no gateway capability at all", "options": "capabilities=\"exec\"", "request": { "kind": "dns", "name": "db.internal" }, "allowed": false, "code": "capability-missing", "capability": "gateway:tcp:db.internal:*" },
|
|
209
|
+
{ "name": "listen tcp: that port", "options": "capabilities=\"gateway:listen:tcp:8080\"", "request": { "kind": "listen-tcp", "port": 8080 }, "allowed": true },
|
|
210
|
+
{ "name": "listen tcp: another port", "options": "capabilities=\"gateway:listen:tcp:8080\"", "request": { "kind": "listen-tcp", "port": 80 }, "allowed": false, "code": "capability-missing", "capability": "gateway:listen:tcp:80" },
|
|
211
|
+
{ "name": "listen tcp: any port", "options": "capabilities=\"gateway:listen:tcp:*\"", "request": { "kind": "listen-tcp", "port": 80 }, "allowed": true },
|
|
212
|
+
{ "name": "listen tcp: connecting is not listening", "options": "capabilities=\"gateway:tcp:*:*\"", "request": { "kind": "listen-tcp", "port": 8080 }, "allowed": false, "code": "capability-missing", "capability": "gateway:listen:tcp:8080" },
|
|
213
|
+
{ "name": "unix: exact path", "options": "capabilities=\"unix:/run/app.sock\"", "request": { "kind": "unix", "path": "/run/app.sock" }, "allowed": true },
|
|
214
|
+
{ "name": "unix: another path", "options": "capabilities=\"unix:/run/app.sock\"", "request": { "kind": "unix", "path": "/run/other.sock" }, "allowed": false, "code": "capability-missing", "capability": "unix:/run/other.sock" },
|
|
215
|
+
{ "name": "unix: under a directory", "options": "capabilities=\"unix:/srv/*\"", "request": { "kind": "unix", "path": "/srv/a/b.sock" }, "allowed": true },
|
|
216
|
+
{ "name": "unix: the directory itself is not under it", "options": "capabilities=\"unix:/srv/*\"", "request": { "kind": "unix", "path": "/srv" }, "allowed": false, "code": "capability-missing", "capability": "unix:/srv" },
|
|
217
|
+
{ "name": "unix: a look-alike directory", "options": "capabilities=\"unix:/srv/*\"", "request": { "kind": "unix", "path": "/srvx/a.sock" }, "allowed": false, "code": "capability-missing", "capability": "unix:/srvx/a.sock" },
|
|
218
|
+
{ "name": "unix: climbing out of the directory", "options": "capabilities=\"unix:/srv/*\"", "request": { "kind": "unix", "path": "/srv/../etc/x.sock" }, "allowed": false, "code": "capability-missing", "capability": "unix:/srv/../etc/x.sock" },
|
|
219
|
+
{ "name": "unix: a relative path", "options": "capabilities=\"unix:/srv/*\"", "request": { "kind": "unix", "path": "srv/a.sock" }, "allowed": false, "code": "capability-missing", "capability": "unix:srv/a.sock" },
|
|
220
|
+
{ "name": "unix: connecting is not listening", "options": "capabilities=\"unix:/run/app.sock\"", "request": { "kind": "listen-unix", "path": "/run/app.sock" }, "allowed": false, "code": "capability-missing", "capability": "unix:listen:/run/app.sock" },
|
|
221
|
+
{ "name": "unix listen: exact path", "options": "capabilities=\"unix:listen:/run/x.sock\"", "request": { "kind": "listen-unix", "path": "/run/x.sock" }, "allowed": true },
|
|
222
|
+
{ "name": "unix listen does not connect", "options": "capabilities=\"unix:listen:/run/x.sock\"", "request": { "kind": "unix", "path": "/run/x.sock" }, "allowed": false, "code": "capability-missing", "capability": "unix:/run/x.sock" },
|
|
223
|
+
|
|
224
|
+
{ "name": "endpoint: that name", "options": "capabilities=\"endpoint:logs\"", "request": { "kind": "endpoint", "name": "logs" }, "allowed": true, "hosts": ["node"] },
|
|
225
|
+
{ "name": "endpoint: another name", "options": "capabilities=\"endpoint:logs\"", "request": { "kind": "endpoint", "name": "db" }, "allowed": false, "code": "capability-missing", "capability": "endpoint:db", "hosts": ["node"] },
|
|
226
|
+
{ "name": "endpoint:*", "options": "capabilities=\"endpoint:*\"", "request": { "kind": "endpoint", "name": "db" }, "allowed": true, "hosts": ["node"] },
|
|
227
|
+
{ "name": "endpoint: on a target needs the target too", "options": "capabilities=\"endpoint:logs\"", "request": { "kind": "endpoint", "name": "logs", "target": "web" }, "allowed": false, "code": "capability-missing", "capability": "target:web", "hosts": ["node"] },
|
|
228
|
+
|
|
229
|
+
{ "name": "target: a named target the key holds", "options": "capabilities=\"exec,target:web\"", "request": { "kind": "open", "channel": "exec", "target": "web" }, "allowed": true, "hosts": ["node"] },
|
|
230
|
+
{ "name": "target: another target", "options": "capabilities=\"exec,target:web\"", "request": { "kind": "open", "channel": "exec", "target": "db" }, "allowed": false, "code": "capability-missing", "capability": "target:db", "hosts": ["node"] },
|
|
231
|
+
{ "name": "target: the target is not enough without the kind", "options": "capabilities=\"target:web\"", "request": { "kind": "open", "channel": "exec", "target": "web" }, "allowed": false, "code": "capability-missing", "capability": "exec", "hosts": ["node"] },
|
|
232
|
+
{ "name": "target:*", "options": "capabilities=\"exec,target:*\"", "request": { "kind": "open", "channel": "exec", "target": "db" }, "allowed": true, "hosts": ["node"] },
|
|
233
|
+
{ "name": "target: the host's own backends need no target capability", "options": "capabilities=\"exec,target:web\"", "request": { "kind": "open", "channel": "exec" }, "allowed": true },
|
|
234
|
+
{ "name": "target: a file op on a target", "options": "capabilities=\"fs:read\"", "request": { "kind": "file-op", "op": "list", "target": "web" }, "allowed": false, "code": "capability-missing", "capability": "target:web", "hosts": ["node"] },
|
|
235
|
+
{ "name": "target: listing shows only the targets the key holds", "options": "capabilities=\"target:web\"", "request": { "kind": "target", "name": "web" }, "allowed": true, "hosts": ["node"] },
|
|
236
|
+
{ "name": "target: listing hides the others", "options": "capabilities=\"target:web\"", "request": { "kind": "target", "name": "db" }, "allowed": false, "code": "capability-missing", "capability": "target:db", "hosts": ["node"] },
|
|
237
|
+
|
|
238
|
+
{ "name": "expires: before it", "options": "expires=\"2030-01-01T00:00:00Z\"", "now": 1893455999, "request": { "kind": "open", "channel": "exec" }, "allowed": true },
|
|
239
|
+
{ "name": "expires: at it", "options": "expires=\"2030-01-01T00:00:00Z\"", "now": 1893456000, "request": { "kind": "open", "channel": "exec" }, "allowed": false, "code": "key-expired" },
|
|
240
|
+
{ "name": "expires: after it", "options": "expires=\"2030-01-01T00:00:00Z\"", "now": 1893456001, "request": { "kind": "relay" }, "allowed": false, "code": "key-expired" },
|
|
241
|
+
{ "name": "expires: the login is refused too", "options": "expires=\"2030-01-01T00:00:00Z\"", "now": 1893456000, "request": { "kind": "login" }, "allowed": false, "code": "key-expired" },
|
|
242
|
+
{ "name": "expires: the login before it", "options": "expires=\"2030-01-01T00:00:00Z\"", "now": 1893455999, "request": { "kind": "login" }, "allowed": true },
|
|
243
|
+
{ "name": "expires: an offset is honoured", "options": "expires=\"2030-01-01T00:00:00+01:00\"", "now": 1893452400, "request": { "kind": "login" }, "allowed": false, "code": "key-expired" },
|
|
244
|
+
{ "name": "expires: before it, with capabilities", "options": "capabilities=\"exec\",expires=\"2030-01-01T00:00:00Z\"", "now": 1893455999, "request": { "kind": "open", "channel": "exec" }, "allowed": true },
|
|
245
|
+
{ "name": "expires beats capabilities", "options": "capabilities=\"exec\",expires=\"2030-01-01T00:00:00Z\"", "now": 1893456000, "request": { "kind": "open", "channel": "exec" }, "allowed": false, "code": "key-expired" },
|
|
246
|
+
{ "name": "no expiry: any time", "options": "capabilities=\"exec\"", "now": 99999999999, "request": { "kind": "login" }, "allowed": true }
|
|
247
|
+
]
|
|
248
|
+
}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
<!-- GENERATED by `npm run matrix` (scripts/message-matrix.mjs) from spec/wsh-v1.yaml and the source of each implementation. Do not edit; `npm run matrix:check` (CI, and test/message-matrix.test.mjs) fails when this file is stale. -->
|
|
2
|
+
|
|
3
|
+
# Message matrix: spec versus implementations
|
|
4
|
+
|
|
5
|
+
Every message of [`wsh-v1.yaml`](wsh-v1.yaml) and whether each implementation **names** it: sends it or acts on it in code that is
|
|
6
|
+
neither generated nor a test. `yes` means a handler or a sender exists; `-` means nothing in that implementation has heard of the message
|
|
7
|
+
(the Rust types still decode it, since every message is generated into both languages; the JS decoder passes it through).
|
|
8
|
+
It does not say that every field is honoured: [`test/spec-conformance.test.mjs`](../test/spec-conformance.test.mjs) and the interop tests do that.
|
|
9
|
+
How it is derived, and which files count for which column, is in the header of [`scripts/message-matrix.mjs`](../scripts/message-matrix.mjs).
|
|
10
|
+
A column is the whole implementation of that role: **JS host** = `createWshServer`, `createMemoryHost`, `createReverseHost`, the relay;
|
|
11
|
+
**JS client** = `WshClient` and its helpers; **Rust host** = `wsh-server`; **Rust client** = `wsh-client` and the `wsh` CLI.
|
|
12
|
+
Which messages a peer may RECEIVE without negotiating, and what to do about a message a peer does not know, is in [COMPATIBILITY.md](../COMPATIBILITY.md).
|
|
13
|
+
|
|
14
|
+
## Summary
|
|
15
|
+
|
|
16
|
+
| | messages named | of |
|
|
17
|
+
| --- | ---: | ---: |
|
|
18
|
+
| JS host | 69 | 110 |
|
|
19
|
+
| JS client | 97 | 110 |
|
|
20
|
+
| Rust host | 105 | 110 |
|
|
21
|
+
| Rust client | 75 | 110 |
|
|
22
|
+
|
|
23
|
+
62 messages are named by all four; 1 by none of them (defined in the spec, implemented nowhere yet).
|
|
24
|
+
|
|
25
|
+
## Per message
|
|
26
|
+
|
|
27
|
+
### handshake
|
|
28
|
+
|
|
29
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
30
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
31
|
+
| Hello | 0x01 | yes | yes | yes | yes |
|
|
32
|
+
| ServerHello | 0x02 | yes | yes | yes | yes |
|
|
33
|
+
| Challenge | 0x03 | yes | yes | yes | yes |
|
|
34
|
+
| AuthMethods | 0x04 | - | - | - | - |
|
|
35
|
+
| Auth | 0x05 | yes | yes | yes | yes |
|
|
36
|
+
| AuthOk | 0x06 | yes | yes | yes | yes |
|
|
37
|
+
| AuthFail | 0x07 | yes | yes | yes | yes |
|
|
38
|
+
|
|
39
|
+
### channel
|
|
40
|
+
|
|
41
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
42
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
43
|
+
| Open | 0x10 | yes | yes | yes | yes |
|
|
44
|
+
| OpenOk | 0x11 | yes | yes | yes | yes |
|
|
45
|
+
| OpenFail | 0x12 | yes | yes | yes | yes |
|
|
46
|
+
| SessionData | 0x17 | yes | yes | yes | yes |
|
|
47
|
+
| Resize | 0x13 | yes | yes | yes | yes |
|
|
48
|
+
| Signal | 0x14 | yes | yes | yes | yes |
|
|
49
|
+
| Exit | 0x15 | yes | yes | yes | yes |
|
|
50
|
+
| Close | 0x16 | yes | yes | yes | yes |
|
|
51
|
+
|
|
52
|
+
### transport
|
|
53
|
+
|
|
54
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
55
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
56
|
+
| Error | 0x20 | yes | yes | yes | yes |
|
|
57
|
+
| Ping | 0x21 | yes | yes | yes | yes |
|
|
58
|
+
| Pong | 0x22 | yes | yes | yes | yes |
|
|
59
|
+
|
|
60
|
+
### session
|
|
61
|
+
|
|
62
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
63
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
64
|
+
| Attach | 0x30 | yes | yes | yes | yes |
|
|
65
|
+
| Resume | 0x31 | yes | yes | yes | yes |
|
|
66
|
+
| Rename | 0x32 | - | - | yes | - |
|
|
67
|
+
| IdleWarning | 0x33 | - | yes | yes | - |
|
|
68
|
+
| Shutdown | 0x34 | - | yes | yes | yes |
|
|
69
|
+
| Snapshot | 0x35 | - | - | yes | - |
|
|
70
|
+
| Presence | 0x36 | yes | yes | yes | yes |
|
|
71
|
+
| ControlChanged | 0x37 | - | yes | yes | - |
|
|
72
|
+
| Metrics | 0x38 | - | yes | yes | - |
|
|
73
|
+
| Clipboard | 0x39 | - | yes | yes | - |
|
|
74
|
+
| RecordingExport | 0x3a | - | - | yes | - |
|
|
75
|
+
| CommandJournal | 0x3b | - | - | yes | - |
|
|
76
|
+
| MetricsRequest | 0x3c | - | yes | yes | - |
|
|
77
|
+
| SuspendSession | 0x3d | - | yes | yes | - |
|
|
78
|
+
| RestartPty | 0x3e | - | yes | yes | - |
|
|
79
|
+
| SessionListRequest | 0x3f | yes | yes | yes | yes |
|
|
80
|
+
| SessionList | 0x5f | yes | yes | yes | yes |
|
|
81
|
+
| Detach | 0x60 | yes | yes | yes | yes |
|
|
82
|
+
| DetachOk | 0x61 | yes | yes | yes | yes |
|
|
83
|
+
| DetachFail | 0x62 | yes | yes | yes | yes |
|
|
84
|
+
|
|
85
|
+
### mcp
|
|
86
|
+
|
|
87
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
88
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
89
|
+
| McpDiscover | 0x40 | yes | yes | yes | yes |
|
|
90
|
+
| McpTools | 0x41 | yes | yes | yes | yes |
|
|
91
|
+
| McpCall | 0x42 | yes | yes | yes | yes |
|
|
92
|
+
| McpResult | 0x43 | yes | yes | yes | yes |
|
|
93
|
+
| McpCancel | 0x44 | yes | yes | yes | - |
|
|
94
|
+
|
|
95
|
+
### reverse
|
|
96
|
+
|
|
97
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
98
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
99
|
+
| ReverseRegister | 0x50 | yes | yes | yes | yes |
|
|
100
|
+
| ReverseList | 0x51 | yes | yes | yes | yes |
|
|
101
|
+
| ReversePeers | 0x52 | yes | yes | yes | yes |
|
|
102
|
+
| ReverseConnect | 0x53 | yes | yes | yes | yes |
|
|
103
|
+
| ReverseAccept | 0x54 | yes | yes | yes | yes |
|
|
104
|
+
| ReverseReject | 0x55 | yes | yes | yes | yes |
|
|
105
|
+
| ReverseClose | 0x57 | yes | yes | yes | yes |
|
|
106
|
+
| ReverseChallenge | 0x58 | yes | yes | yes | yes |
|
|
107
|
+
| ReverseProof | 0x59 | yes | yes | yes | yes |
|
|
108
|
+
| RelayForward | 0x56 | yes | yes | yes | yes |
|
|
109
|
+
|
|
110
|
+
### gateway
|
|
111
|
+
|
|
112
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
113
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
114
|
+
| OpenTcp | 0x70 | yes | yes | yes | yes |
|
|
115
|
+
| OpenUdp | 0x71 | yes | yes | yes | yes |
|
|
116
|
+
| ResolveDns | 0x72 | yes | - | yes | yes |
|
|
117
|
+
| GatewayOk | 0x73 | yes | yes | yes | yes |
|
|
118
|
+
| GatewayFail | 0x74 | yes | yes | yes | yes |
|
|
119
|
+
| GatewayClose | 0x75 | yes | yes | yes | yes |
|
|
120
|
+
| InboundOpen | 0x76 | yes | yes | yes | yes |
|
|
121
|
+
| InboundAccept | 0x77 | yes | yes | yes | yes |
|
|
122
|
+
| InboundReject | 0x78 | yes | yes | yes | yes |
|
|
123
|
+
| DnsResult | 0x79 | yes | - | yes | yes |
|
|
124
|
+
| ListenRequest | 0x7a | yes | yes | yes | yes |
|
|
125
|
+
| ListenOk | 0x7b | yes | yes | yes | yes |
|
|
126
|
+
| ListenFail | 0x7c | yes | yes | yes | yes |
|
|
127
|
+
| ListenClose | 0x7d | yes | yes | yes | yes |
|
|
128
|
+
| GatewayData | 0x7e | yes | yes | yes | yes |
|
|
129
|
+
| GatewayCredit | 0x7f | yes | yes | yes | yes |
|
|
130
|
+
| OpenUnix | 0x63 | yes | yes | yes | yes |
|
|
131
|
+
| OpenEndpoint | 0x64 | yes | yes | yes | yes |
|
|
132
|
+
| ListenUnix | 0x65 | yes | yes | yes | yes |
|
|
133
|
+
|
|
134
|
+
### guest
|
|
135
|
+
|
|
136
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
137
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
138
|
+
| GuestInvite | 0x80 | - | yes | yes | - |
|
|
139
|
+
| GuestJoin | 0x81 | - | yes | yes | - |
|
|
140
|
+
| GuestRevoke | 0x82 | - | yes | yes | - |
|
|
141
|
+
|
|
142
|
+
### sharing
|
|
143
|
+
|
|
144
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
145
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
146
|
+
| ShareSession | 0x83 | - | yes | yes | - |
|
|
147
|
+
| ShareRevoke | 0x84 | - | yes | yes | - |
|
|
148
|
+
|
|
149
|
+
### compression
|
|
150
|
+
|
|
151
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
152
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
153
|
+
| CompressBegin | 0x85 | - | yes | yes | - |
|
|
154
|
+
| CompressAck | 0x86 | - | yes | yes | - |
|
|
155
|
+
|
|
156
|
+
### ratecontrol
|
|
157
|
+
|
|
158
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
159
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
160
|
+
| RateControl | 0x87 | - | yes | yes | - |
|
|
161
|
+
| RateWarning | 0x88 | - | yes | yes | - |
|
|
162
|
+
|
|
163
|
+
### linking
|
|
164
|
+
|
|
165
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
166
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
167
|
+
| SessionLink | 0x89 | - | yes | yes | - |
|
|
168
|
+
| SessionUnlink | 0x8a | - | yes | yes | - |
|
|
169
|
+
|
|
170
|
+
### copilot
|
|
171
|
+
|
|
172
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
173
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
174
|
+
| CopilotAttach | 0x8b | - | yes | yes | - |
|
|
175
|
+
| CopilotSuggest | 0x8c | - | yes | yes | - |
|
|
176
|
+
| CopilotDetach | 0x8d | - | yes | yes | - |
|
|
177
|
+
|
|
178
|
+
### e2e
|
|
179
|
+
|
|
180
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
181
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
182
|
+
| KeyExchange | 0x8e | yes | yes | yes | yes |
|
|
183
|
+
| EncryptedFrame | 0x8f | yes | yes | yes | yes |
|
|
184
|
+
|
|
185
|
+
### echo
|
|
186
|
+
|
|
187
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
188
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
189
|
+
| EchoAck | 0x90 | - | yes | yes | yes |
|
|
190
|
+
| EchoState | 0x91 | - | yes | yes | yes |
|
|
191
|
+
|
|
192
|
+
### termsync
|
|
193
|
+
|
|
194
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
195
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
196
|
+
| TermSync | 0x92 | - | yes | yes | yes |
|
|
197
|
+
| TermDiff | 0x93 | - | yes | yes | yes |
|
|
198
|
+
|
|
199
|
+
### scaling
|
|
200
|
+
|
|
201
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
202
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
203
|
+
| NodeAnnounce | 0x94 | - | - | yes | - |
|
|
204
|
+
| NodeRedirect | 0x95 | - | - | yes | - |
|
|
205
|
+
|
|
206
|
+
### principals
|
|
207
|
+
|
|
208
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
209
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
210
|
+
| SessionGrant | 0x96 | - | yes | yes | - |
|
|
211
|
+
| SessionRevoke | 0x97 | - | yes | yes | - |
|
|
212
|
+
|
|
213
|
+
### filechannel
|
|
214
|
+
|
|
215
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
216
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
217
|
+
| FileOp | 0x98 | yes | yes | yes | yes |
|
|
218
|
+
| FileResult | 0x99 | yes | yes | yes | yes |
|
|
219
|
+
| FileChunk | 0x9a | yes | yes | yes | yes |
|
|
220
|
+
|
|
221
|
+
### keys
|
|
222
|
+
|
|
223
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
224
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
225
|
+
| AuthorizedKeyAdd | 0x9f | - | yes | yes | yes |
|
|
226
|
+
| AuthorizedKeyResult | 0xa0 | - | yes | yes | yes |
|
|
227
|
+
|
|
228
|
+
### policy
|
|
229
|
+
|
|
230
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
231
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
232
|
+
| PolicyEval | 0x9b | - | yes | yes | - |
|
|
233
|
+
| PolicyResult | 0x9c | - | yes | yes | - |
|
|
234
|
+
| PolicyUpdate | 0x9d | - | yes | yes | - |
|
|
235
|
+
|
|
236
|
+
### terminal
|
|
237
|
+
|
|
238
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
239
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
240
|
+
| TerminalConfig | 0x9e | - | - | yes | - |
|
|
241
|
+
|
|
242
|
+
### shares
|
|
243
|
+
|
|
244
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
245
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
246
|
+
| ShareOffer | 0xa8 | yes | - | - | yes |
|
|
247
|
+
| ShareRequest | 0xa9 | yes | - | - | yes |
|
|
248
|
+
| ShareReply | 0xaa | yes | - | - | yes |
|
|
249
|
+
|
|
250
|
+
### targets
|
|
251
|
+
|
|
252
|
+
| message | code | JS host | JS client | Rust host | Rust client |
|
|
253
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
254
|
+
| ListTargets | 0xab | yes | yes | yes | yes |
|
|
255
|
+
| TargetList | 0xac | yes | yes | - | yes |
|
|
256
|
+
|
|
257
|
+
## Defined but named by no implementation
|
|
258
|
+
|
|
259
|
+
AuthMethods (0x04, handshake).
|