requestshield 0.1.4 → 0.1.6
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 +421 -85
- package/config/.env.prod +7 -0
- package/package.json +21 -12
- package/skills/requestshield/SKILL.md +299 -307
- package/skills/requestshield/assets/AGENTS.codex.md +62 -62
- package/skills/requestshield/references/backend-java-core.md +128 -128
- package/skills/requestshield/references/backend-spring-boot.md +145 -145
- package/skills/requestshield/references/browser-manual.md +210 -210
- package/skills/requestshield/references/browser-seamless.md +156 -164
- package/skills/requestshield/references/cli.md +107 -182
- package/skills/requestshield/references/integration-planning.md +362 -389
- package/skills/requestshield/references/troubleshooting.md +114 -118
- package/src/agent-detector.mjs +102 -74
- package/src/api-client.mjs +115 -79
- package/src/args.mjs +140 -80
- package/src/browser-opener.mjs +32 -0
- package/src/cli.mjs +277 -51
- package/src/commands/agent-setup.mjs +182 -185
- package/src/commands/application-mutations.mjs +33 -0
- package/src/commands/application-response.mjs +55 -0
- package/src/commands/apps-get.mjs +20 -0
- package/src/commands/apps-list.mjs +94 -0
- package/src/commands/auth-status.mjs +37 -0
- package/src/commands/keys-create.mjs +7 -38
- package/src/commands/mutation-support.mjs +110 -0
- package/src/commands/secret-commands.mjs +45 -0
- package/src/commands/signin.mjs +70 -57
- package/src/commands/signout.mjs +9 -0
- package/src/commands/update-check.mjs +12 -4
- package/src/config.mjs +150 -0
- package/src/entrypoint.mjs +24 -0
- package/src/errors.mjs +3 -1
- package/src/main.mjs +5 -24
- package/src/oauth-client.mjs +153 -0
- package/src/oauth-loopback.mjs +120 -0
- package/src/session-files.mjs +213 -0
- package/src/session-store.mjs +177 -64
|
@@ -1,164 +1,156 @@
|
|
|
1
|
-
# Browser SDK — Seamless mode
|
|
2
|
-
|
|
3
|
-
Seamless mode is the recommended browser integration for applications that use `fetch`
|
|
4
|
-
or asynchronous `XMLHttpRequest`. Browser SDK 1.1 matches configured application
|
|
5
|
-
endpoints and adds `X-IntelliFend-Token` automatically, so no call site changes.
|
|
6
|
-
|
|
7
|
-
Prerequisites: a public App Key, the **exact** application API endpoints to protect, and
|
|
8
|
-
backend protection configured for the corresponding operations.
|
|
9
|
-
|
|
10
|
-
## 1. Load the hosted SDK
|
|
11
|
-
|
|
12
|
-
Place the script before any application bundle that can issue a protected request —
|
|
13
|
-
otherwise an early request leaves the page before interception is installed:
|
|
14
|
-
|
|
15
|
-
```html
|
|
16
|
-
<script
|
|
17
|
-
src="
|
|
18
|
-
data-app-key="YOUR_APP_KEY"
|
|
19
|
-
data-protect='["/api/register"]'
|
|
20
|
-
defer
|
|
21
|
-
></script>
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
`data-protect` is a **JSON array** — note the single quotes around the attribute so the
|
|
25
|
-
inner double quotes survive. Each entry is either a root-relative pathname beginning
|
|
26
|
-
with `/`, or an absolute URL without embedded credentials. Malformed JSON is a configuration
|
|
27
|
-
error — validate the attribute before shipping rather than assuming a parse failure will
|
|
28
|
-
announce itself.
|
|
29
|
-
|
|
30
|
-
Applications with a custom script loader can configure the same behaviour after the
|
|
31
|
-
hosted script loads:
|
|
32
|
-
|
|
33
|
-
```javascript
|
|
34
|
-
IntelliFend.init({
|
|
35
|
-
appKey: 'YOUR_APP_KEY',
|
|
36
|
-
protect: ['/api/register'],
|
|
37
|
-
});
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Use script attributes *or* explicit initialization for initial setup, not both.
|
|
41
|
-
|
|
42
|
-
## 2. Match application endpoints exactly
|
|
43
|
-
|
|
44
|
-
RequestShield compares the **exact origin and exact pathname**. This is where a Seamless
|
|
45
|
-
install either works or quietly does nothing, so resolve it before writing the attribute:
|
|
46
|
-
|
|
47
|
-
- Query strings and fragments are ignored on both sides.
|
|
48
|
-
- **Pathname case and trailing slash are significant.**
|
|
49
|
-
- Root-relative entries resolve against the page origin.
|
|
50
|
-
- Cross-origin entries use HTTPS, except for loopback development.
|
|
51
|
-
- The same endpoint rule applies to every HTTP method.
|
|
52
|
-
|
|
53
|
-
So `/api/register` matches `/api/register?source=campaign`, but it does **not** match
|
|
54
|
-
`/api/Register` or `/api/register/`.
|
|
55
|
-
|
|
56
|
-
The practical consequence: **list the URL the application passes to `fetch` or
|
|
57
|
-
asynchronous `XMLHttpRequest`.** With a normal development proxy, the application
|
|
58
|
-
requests `/api/register` on the frontend origin. The proxy then rewrites and forwards
|
|
59
|
-
that request to an upstream route such as `https://api.example.com/register`. The
|
|
60
|
-
rewrite happens outside the browser and does not change the URL matched by Seamless.
|
|
61
|
-
Configure `/api/register`, and ensure the proxy forwards `X-IntelliFend-Token`
|
|
62
|
-
unchanged.
|
|
63
|
-
|
|
64
|
-
If the application directly requests `https://api.example.com/register`, configure
|
|
65
|
-
that absolute URL instead and configure CORS to allow the page origin, request method,
|
|
66
|
-
and `X-IntelliFend-Token`.
|
|
67
|
-
|
|
68
|
-
A redirect is different from a proxy rewrite. With an HTTP redirect, the server returns
|
|
69
|
-
a `3xx` response and the browser follows its `Location`. Seamless matches the original
|
|
70
|
-
URL passed by application code; it does not separately match the browser's internal
|
|
71
|
-
redirect request. Do not configure only the redirect destination when the application
|
|
72
|
-
initially requests `/api/register`. Avoid redirects for protected mutation endpoints
|
|
73
|
-
when possible, or verify the method, header, and CORS behavior end to end.
|
|
74
|
-
|
|
75
|
-
A path built with an ID or slug (`/api/orders/42`) has no wildcard support — list every
|
|
76
|
-
concrete path, or use Manual mode for that operation.
|
|
77
|
-
|
|
78
|
-
## 3. Send requests normally
|
|
79
|
-
|
|
80
|
-
Application code does not call `getToken()` or construct the header for a
|
|
81
|
-
Seamless-mode endpoint:
|
|
82
|
-
|
|
83
|
-
```javascript
|
|
84
|
-
const response = await fetch('/api/register', {
|
|
85
|
-
method: 'POST',
|
|
86
|
-
headers: {'Content-Type': 'application/json'},
|
|
87
|
-
body: JSON.stringify({email, password}),
|
|
88
|
-
});
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
Browser configuration controls token attachment only. Configure the corresponding
|
|
92
|
-
backend operation independently — `data-protect` creates no backend protection.
|
|
93
|
-
|
|
94
|
-
## What Seamless covers
|
|
95
|
-
|
|
96
|
-
Supported: `fetch` (string, `URL`, and `Request` inputs) and asynchronous
|
|
97
|
-
`XMLHttpRequest`.
|
|
98
|
-
|
|
99
|
-
Do not rely on Seamless and a Manual call site coexisting on the same endpoint. One
|
|
100
|
-
protected operation uses one mode — see the prerequisites in `browser-manual.md`.
|
|
101
|
-
|
|
102
|
-
## What Seamless does not cover
|
|
103
|
-
|
|
104
|
-
Any of these means the request leaves without a token, with no error — which is why
|
|
105
|
-
they are worth checking *before* choosing the mode:
|
|
106
|
-
|
|
107
|
-
- Synchronous XHR.
|
|
108
|
-
- Native form navigation (a plain `<form>` submit).
|
|
109
|
-
- `navigator.sendBeacon`.
|
|
110
|
-
- WebSocket and EventSource.
|
|
111
|
-
- Service-worker-owned requests. Web workers and server-side rendering have their own
|
|
112
|
-
global scope too — in Next.js, Nuxt, Remix and similar, confirm the protected call
|
|
113
|
-
runs in the browser.
|
|
114
|
-
- A `fetch` using `no-cors`, which cannot carry a custom header at all.
|
|
115
|
-
|
|
116
|
-
For an operation on this list, use Manual mode **only if** the application can carry the
|
|
117
|
-
token in a supported header or request-body field. Otherwise the right answer is an
|
|
118
|
-
application-specific integration agreed with IntelliFend — say that plainly rather than
|
|
119
|
-
improvising a carrier.
|
|
120
|
-
|
|
121
|
-
## Cross-origin APIs
|
|
122
|
-
|
|
123
|
-
When the protected endpoint is on another origin, its CORS response must allow the page
|
|
124
|
-
origin, the intended methods, and the `X-IntelliFend-Token` header. Missing that header
|
|
125
|
-
in `Access-Control-Allow-Headers` means the browser strips it and every request reads as
|
|
126
|
-
missing a token.
|
|
127
|
-
|
|
128
|
-
## Verifying Seamless
|
|
129
|
-
|
|
130
|
-
Static checks:
|
|
131
|
-
|
|
132
|
-
1. Exactly one script tag, loaded before application bundles, with valid JSON in
|
|
133
|
-
`data-protect`.
|
|
134
|
-
2. Every listed entry matches a URL the browser actually requests — origin, case, and
|
|
135
|
-
trailing slash included.
|
|
136
|
-
3. Every protected endpoint reaches the network via `fetch` or async XHR from page
|
|
137
|
-
scope.
|
|
138
|
-
|
|
139
|
-
Runtime check: exercise the endpoint
|
|
140
|
-
`X-IntelliFend-Token
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
configured list are unchanged.
|
|
158
|
-
|
|
159
|
-
## CSP and token handling
|
|
160
|
-
|
|
161
|
-
Identical to Manual mode — see the CSP and token-handling sections of
|
|
162
|
-
`browser-manual.md`. The `worker-src 'self' blob:` directive matters just as much here:
|
|
163
|
-
without it, every intercepted request attaches an empty token and the backend blocks
|
|
164
|
-
traffic that looks correctly integrated.
|
|
1
|
+
# Browser SDK — Seamless mode
|
|
2
|
+
|
|
3
|
+
Seamless mode is the recommended browser integration for applications that use `fetch`
|
|
4
|
+
or asynchronous `XMLHttpRequest`. Browser SDK 1.1 matches configured application
|
|
5
|
+
endpoints and adds `X-IntelliFend-Token` automatically, so no call site changes.
|
|
6
|
+
|
|
7
|
+
Prerequisites: a public App Key, the **exact** application API endpoints to protect, and
|
|
8
|
+
backend protection configured for the corresponding operations.
|
|
9
|
+
|
|
10
|
+
## 1. Load the hosted SDK
|
|
11
|
+
|
|
12
|
+
Place the script before any application bundle that can issue a protected request —
|
|
13
|
+
otherwise an early request leaves the page before interception is installed:
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<script
|
|
17
|
+
src="SDK_SCRIPT_URL_FROM_RELEASE_DOCS"
|
|
18
|
+
data-app-key="YOUR_APP_KEY"
|
|
19
|
+
data-protect='["/api/register"]'
|
|
20
|
+
defer
|
|
21
|
+
></script>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`data-protect` is a **JSON array** — note the single quotes around the attribute so the
|
|
25
|
+
inner double quotes survive. Each entry is either a root-relative pathname beginning
|
|
26
|
+
with `/`, or an absolute URL without embedded credentials. Malformed JSON is a configuration
|
|
27
|
+
error — validate the attribute before shipping rather than assuming a parse failure will
|
|
28
|
+
announce itself.
|
|
29
|
+
|
|
30
|
+
Applications with a custom script loader can configure the same behaviour after the
|
|
31
|
+
hosted script loads:
|
|
32
|
+
|
|
33
|
+
```javascript
|
|
34
|
+
IntelliFend.init({
|
|
35
|
+
appKey: 'YOUR_APP_KEY',
|
|
36
|
+
protect: ['/api/register'],
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Use script attributes *or* explicit initialization for initial setup, not both.
|
|
41
|
+
|
|
42
|
+
## 2. Match application endpoints exactly
|
|
43
|
+
|
|
44
|
+
RequestShield compares the **exact origin and exact pathname**. This is where a Seamless
|
|
45
|
+
install either works or quietly does nothing, so resolve it before writing the attribute:
|
|
46
|
+
|
|
47
|
+
- Query strings and fragments are ignored on both sides.
|
|
48
|
+
- **Pathname case and trailing slash are significant.**
|
|
49
|
+
- Root-relative entries resolve against the page origin.
|
|
50
|
+
- Cross-origin entries use HTTPS, except for loopback development.
|
|
51
|
+
- The same endpoint rule applies to every HTTP method.
|
|
52
|
+
|
|
53
|
+
So `/api/register` matches `/api/register?source=campaign`, but it does **not** match
|
|
54
|
+
`/api/Register` or `/api/register/`.
|
|
55
|
+
|
|
56
|
+
The practical consequence: **list the URL the application passes to `fetch` or
|
|
57
|
+
asynchronous `XMLHttpRequest`.** With a normal development proxy, the application
|
|
58
|
+
requests `/api/register` on the frontend origin. The proxy then rewrites and forwards
|
|
59
|
+
that request to an upstream route such as `https://api.example.com/register`. The
|
|
60
|
+
rewrite happens outside the browser and does not change the URL matched by Seamless.
|
|
61
|
+
Configure `/api/register`, and ensure the proxy forwards `X-IntelliFend-Token`
|
|
62
|
+
unchanged.
|
|
63
|
+
|
|
64
|
+
If the application directly requests `https://api.example.com/register`, configure
|
|
65
|
+
that absolute URL instead and configure CORS to allow the page origin, request method,
|
|
66
|
+
and `X-IntelliFend-Token`.
|
|
67
|
+
|
|
68
|
+
A redirect is different from a proxy rewrite. With an HTTP redirect, the server returns
|
|
69
|
+
a `3xx` response and the browser follows its `Location`. Seamless matches the original
|
|
70
|
+
URL passed by application code; it does not separately match the browser's internal
|
|
71
|
+
redirect request. Do not configure only the redirect destination when the application
|
|
72
|
+
initially requests `/api/register`. Avoid redirects for protected mutation endpoints
|
|
73
|
+
when possible, or verify the method, header, and CORS behavior end to end.
|
|
74
|
+
|
|
75
|
+
A path built with an ID or slug (`/api/orders/42`) has no wildcard support — list every
|
|
76
|
+
concrete path, or use Manual mode for that operation.
|
|
77
|
+
|
|
78
|
+
## 3. Send requests normally
|
|
79
|
+
|
|
80
|
+
Application code does not call `getToken()` or construct the header for a
|
|
81
|
+
Seamless-mode endpoint:
|
|
82
|
+
|
|
83
|
+
```javascript
|
|
84
|
+
const response = await fetch('/api/register', {
|
|
85
|
+
method: 'POST',
|
|
86
|
+
headers: {'Content-Type': 'application/json'},
|
|
87
|
+
body: JSON.stringify({email, password}),
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Browser configuration controls token attachment only. Configure the corresponding
|
|
92
|
+
backend operation independently — `data-protect` creates no backend protection.
|
|
93
|
+
|
|
94
|
+
## What Seamless covers
|
|
95
|
+
|
|
96
|
+
Supported: `fetch` (string, `URL`, and `Request` inputs) and asynchronous
|
|
97
|
+
`XMLHttpRequest`.
|
|
98
|
+
|
|
99
|
+
Do not rely on Seamless and a Manual call site coexisting on the same endpoint. One
|
|
100
|
+
protected operation uses one mode — see the prerequisites in `browser-manual.md`.
|
|
101
|
+
|
|
102
|
+
## What Seamless does not cover
|
|
103
|
+
|
|
104
|
+
Any of these means the request leaves without a token, with no error — which is why
|
|
105
|
+
they are worth checking *before* choosing the mode:
|
|
106
|
+
|
|
107
|
+
- Synchronous XHR.
|
|
108
|
+
- Native form navigation (a plain `<form>` submit).
|
|
109
|
+
- `navigator.sendBeacon`.
|
|
110
|
+
- WebSocket and EventSource.
|
|
111
|
+
- Service-worker-owned requests. Web workers and server-side rendering have their own
|
|
112
|
+
global scope too — in Next.js, Nuxt, Remix and similar, confirm the protected call
|
|
113
|
+
runs in the browser.
|
|
114
|
+
- A `fetch` using `no-cors`, which cannot carry a custom header at all.
|
|
115
|
+
|
|
116
|
+
For an operation on this list, use Manual mode **only if** the application can carry the
|
|
117
|
+
token in a supported header or request-body field. Otherwise the right answer is an
|
|
118
|
+
application-specific integration agreed with IntelliFend — say that plainly rather than
|
|
119
|
+
improvising a carrier.
|
|
120
|
+
|
|
121
|
+
## Cross-origin APIs
|
|
122
|
+
|
|
123
|
+
When the protected endpoint is on another origin, its CORS response must allow the page
|
|
124
|
+
origin, the intended methods, and the `X-IntelliFend-Token` header. Missing that header
|
|
125
|
+
in `Access-Control-Allow-Headers` means the browser strips it and every request reads as
|
|
126
|
+
missing a token.
|
|
127
|
+
|
|
128
|
+
## Verifying Seamless
|
|
129
|
+
|
|
130
|
+
Static checks:
|
|
131
|
+
|
|
132
|
+
1. Exactly one script tag, loaded before application bundles, with valid JSON in
|
|
133
|
+
`data-protect`.
|
|
134
|
+
2. Every listed entry matches a URL the browser actually requests — origin, case, and
|
|
135
|
+
trailing slash included.
|
|
136
|
+
3. Every protected endpoint reaches the network via `fetch` or async XHR from page
|
|
137
|
+
scope.
|
|
138
|
+
|
|
139
|
+
Runtime check: exercise the endpoint in an authorized environment and confirm its
|
|
140
|
+
request carries a non-empty `X-IntelliFend-Token` without recording the token value.
|
|
141
|
+
Inspect safe backend decision metrics separately; the negative test in `SKILL.md`
|
|
142
|
+
provides enforcement evidence. The CLI challenge-volume command is unavailable.
|
|
143
|
+
A missing header can indicate a path mismatch or an uncovered transport; compare
|
|
144
|
+
the actual request URL and transport before changing backend code.
|
|
145
|
+
|
|
146
|
+
## Expected result
|
|
147
|
+
|
|
148
|
+
Matching requests carry one non-empty `X-IntelliFend-Token` header; requests outside the
|
|
149
|
+
configured list are unchanged.
|
|
150
|
+
|
|
151
|
+
## CSP and token handling
|
|
152
|
+
|
|
153
|
+
Identical to Manual mode — see the CSP and token-handling sections of
|
|
154
|
+
`browser-manual.md`. The `worker-src 'self' blob:` directive matters just as much here:
|
|
155
|
+
without it, every intercepted request attaches an empty token and the backend blocks
|
|
156
|
+
traffic that looks correctly integrated.
|
|
@@ -1,182 +1,107 @@
|
|
|
1
|
-
# `requestshield` CLI reference
|
|
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
|
-
requestshield keys
|
|
61
|
-
requestshield keys
|
|
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
|
-
Use `script_url` and `token_header` verbatim. Check `available_modes` before committing
|
|
109
|
-
to seamless or manual — a mode absent from that list is not released, and writing an
|
|
110
|
-
integration against it produces code that will not work. Check `supported_languages`
|
|
111
|
-
before promising a backend integration for a stack that is not listed; the browser side
|
|
112
|
-
alone provides no protection, so an unsupported backend means the honest answer is
|
|
113
|
-
"not yet supported here".
|
|
114
|
-
|
|
115
|
-
## Applications
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
requestshield apps list
|
|
119
|
-
requestshield apps get <app-key>
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
**auth.** `apps list` returns the applications the current user can access, each with
|
|
123
|
-
`app_key`, `name`, and `status`. Use it to resolve a human-supplied app name to a key
|
|
124
|
-
rather than asking the user to retype one.
|
|
125
|
-
|
|
126
|
-
`apps get <app-key>` returns `app_id`, `app_name`, and `status`. Status distinguishes a
|
|
127
|
-
key that has never seen traffic (`ready`) from one in normal service (`active`) — which
|
|
128
|
-
is exactly the difference between "the integration is not wired up yet" and "it is
|
|
129
|
-
working", so check it before spending time debugging code.
|
|
130
|
-
|
|
131
|
-
## Credentials
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
requestshield credentials status <app-key>
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
**auth.** Returns metadata only — `provisioned`, `active`, `shared` — and never the
|
|
138
|
-
secret value. Use it to answer "is the secret configured?" without anyone having to
|
|
139
|
-
paste a credential. A key that is `provisioned: false` explains backend failures far
|
|
140
|
-
faster than reading code.
|
|
141
|
-
|
|
142
|
-
## Service and monitoring
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
requestshield server
|
|
146
|
-
requestshield challenge volume <app-key> [--from <time>] [--to <time>] [--granularity <value>]
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
**auth.** `server` reports `healthy` or `degraded`. Check it first when an integration
|
|
150
|
-
that was working starts behaving oddly — a degraded platform explains fail-open
|
|
151
|
-
behaviour on the backend without anything being wrong in the customer's code.
|
|
152
|
-
|
|
153
|
-
`challenge volume` is runtime evidence that the browser/platform half is active. It is
|
|
154
|
-
not proof that the protected backend enforces a blocking decision; the controlled
|
|
155
|
-
negative test in `SKILL.md` provides that evidence. Times are ISO-8601
|
|
156
|
-
(`2026-08-01T00:00:00Z`); `--granularity` takes values such as `hour` or `day`. A
|
|
157
|
-
`challenge_count` of zero after the user has exercised the endpoint means the browser
|
|
158
|
-
half is not firing — that is a browser-side bug, not a backend one, so start with the
|
|
159
|
-
mode's reference file.
|
|
160
|
-
|
|
161
|
-
## Billing
|
|
162
|
-
|
|
163
|
-
```bash
|
|
164
|
-
requestshield get billing
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
**auth.** Current plan and usage for the application. Read-only; surface it when the
|
|
168
|
-
user asks about cost or limits.
|
|
169
|
-
|
|
170
|
-
## Agent integration
|
|
171
|
-
|
|
172
|
-
```bash
|
|
173
|
-
requestshield agent setup
|
|
174
|
-
requestshield agent setup --agent claude
|
|
175
|
-
requestshield agent setup --agent codex
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
Local setup. Installs this skill for the named agent. With no `--agent`, the CLI detects
|
|
179
|
-
which agent is in use. Run it when the user wants the skill available in another repo or
|
|
180
|
-
for the other agent; it is the supported alternative to copying files by hand. It should
|
|
181
|
-
not require a RequestShield App Key or API Secret, and it must not create, rotate, or
|
|
182
|
-
deactivate customer credentials.
|
|
1
|
+
# `requestshield` CLI reference
|
|
2
|
+
|
|
3
|
+
Check `requestshield --version` and `requestshield --help` against this guide.
|
|
4
|
+
An older published version may not contain these commands. Use the CLI for its
|
|
5
|
+
supported application and credential operations; do not invent endpoints for
|
|
6
|
+
unavailable commands.
|
|
7
|
+
|
|
8
|
+
## Authentication and local commands
|
|
9
|
+
|
|
10
|
+
```console
|
|
11
|
+
requestshield signin [--no-open]
|
|
12
|
+
requestshield auth status [--json]
|
|
13
|
+
requestshield signout
|
|
14
|
+
requestshield --help
|
|
15
|
+
requestshield --version
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Sign-in uses the user's browser on the same computer. Let the user complete it;
|
|
19
|
+
never ask for their password, tokens or callback URL. `auth status --json` reads
|
|
20
|
+
local metadata only and does not contact the provider or refresh credentials.
|
|
21
|
+
It returns `profile`, `apiUrl`, `issuer`, `clientId`, `state`, `localOnly: true`
|
|
22
|
+
and applicable `expiresAt`/`scopes`, never tokens or a customer/account identity.
|
|
23
|
+
States are `signed_out`, `valid`, `expired`, `refresh_uncertain`, `config_mismatch`,
|
|
24
|
+
`invalid` and `configuration_error`. Local validity is not provider acceptance.
|
|
25
|
+
Sign-out removes only the selected local session, not the browser session or
|
|
26
|
+
provider grant.
|
|
27
|
+
|
|
28
|
+
## Applications
|
|
29
|
+
|
|
30
|
+
```console
|
|
31
|
+
requestshield apps list [--json] [--limit <1-100>] [--cursor <cursor> | --all]
|
|
32
|
+
requestshield apps get <app-key>
|
|
33
|
+
requestshield apps rename <app-key> --name <name> [--idempotency-key <key>]
|
|
34
|
+
requestshield apps enable <app-key> [--idempotency-key <key>]
|
|
35
|
+
requestshield apps disable <app-key> [--idempotency-key <key>] [--yes]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
These commands require sign-in. Existing-app commands use exact App Keys; names
|
|
39
|
+
are not unique. List defaults to one page. `--all` follows at most 100 pages and
|
|
40
|
+
fails for repeated cursors or unfinished traversal at that bound. It cannot be
|
|
41
|
+
combined with `--cursor`. For name discovery, inspect all necessary pages and
|
|
42
|
+
resolve ambiguity with the user before choosing an App Key.
|
|
43
|
+
|
|
44
|
+
JSON list output is `{data:Application[],nextCursor}`. Detail and rename output
|
|
45
|
+
is `{data:Application}`. Application has exactly `appKey`, `name`, `status`,
|
|
46
|
+
`createdAt`, `updatedAt`. Status is `pending`, `enabled`, `disabled`, `revoked`
|
|
47
|
+
or `attention_required`; it describes configuration, not traffic or enforcement.
|
|
48
|
+
Pending, attention and disabled states do not expose the exact credential state.
|
|
49
|
+
Disable retains the secret; enable requires an active one.
|
|
50
|
+
|
|
51
|
+
## Key and secret management
|
|
52
|
+
|
|
53
|
+
Have the user run commands that print secrets in their own terminal so secret
|
|
54
|
+
values stay out of tool output and transcripts. Give the exact command and
|
|
55
|
+
confirm storage by presence only.
|
|
56
|
+
|
|
57
|
+
```console
|
|
58
|
+
requestshield keys create --app-name <name> [--idempotency-key <key>]
|
|
59
|
+
requestshield keys rotate <app-key> [--idempotency-key <key>] [--yes]
|
|
60
|
+
requestshield keys reveal <app-key> [--yes]
|
|
61
|
+
requestshield keys revoke <app-key> [--idempotency-key <key>] [--yes]
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Create makes a new application and initial secret. Rotate preserves the App Key
|
|
65
|
+
and replaces the secret. Reveal retrieves the current active secret; use it to
|
|
66
|
+
recover a lost issuance response. Exposure requires rotation, not reveal.
|
|
67
|
+
Revoke invalidates the current secret. Create, rotate and reveal can display an
|
|
68
|
+
API secret; the CLI never persists it. Store it in backend secret storage.
|
|
69
|
+
|
|
70
|
+
Create, rename and enable have no prompt. Disable, rotate, revoke and reveal
|
|
71
|
+
require confirmation; `--yes` skips it. These commands can change live state or
|
|
72
|
+
disclose secrets, so ensure the target and action match the user's request.
|
|
73
|
+
|
|
74
|
+
All mutations except reveal accept an idempotency key. A fresh key is generated
|
|
75
|
+
per invocation when omitted and printed to stderr before dispatch so interrupted
|
|
76
|
+
commands can reuse it; JSON stdout is unchanged. There is no automatic mutation retry. On uncertainty,
|
|
77
|
+
repeat the identical request and key printed in the error within seven days.
|
|
78
|
+
A new key is a new operation. After seven days inspect state before acting.
|
|
79
|
+
Create/rotate replay can have `apiSecret: null`; the CLI directs explicit reveal
|
|
80
|
+
without running it. HTTP 202 and `enabled` do not prove global propagation.
|
|
81
|
+
|
|
82
|
+
## Agent setup and updates
|
|
83
|
+
|
|
84
|
+
```console
|
|
85
|
+
requestshield agent setup [--codex | --claude] [--force]
|
|
86
|
+
requestshield update check
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Agent setup copies the skill to `~/.agents/skills/requestshield` for Codex or
|
|
90
|
+
`~/.claude/skills/requestshield` for Claude. With neither flag, it detects the
|
|
91
|
+
agent or asks if both are available. `--force` replaces an existing installation.
|
|
92
|
+
It does not edit repository `AGENTS.md` or customer application code.
|
|
93
|
+
|
|
94
|
+
Production update check queries npm and asks before a global installation.
|
|
95
|
+
Explain that target before accepting an update; it does not update a pinned
|
|
96
|
+
invocation or source checkout. Repository-only QAT/STG runners return local
|
|
97
|
+
source-update guidance without registry access or installation.
|
|
98
|
+
|
|
99
|
+
## Unavailable commands
|
|
100
|
+
|
|
101
|
+
Integration contract, service health, credential-status metadata, challenge
|
|
102
|
+
volume and billing are not implemented CLI capabilities. `contract`,
|
|
103
|
+
`challenge volume` and `get billing` fail with `COMMAND_UNAVAILABLE` before
|
|
104
|
+
configuration, authentication or network access. `server` and
|
|
105
|
+
`credentials status` are unsupported. Use the published SDK documentation for
|
|
106
|
+
the chosen release and safe browser/backend observations for integration checks.
|
|
107
|
+
Do not infer traffic or enforcement from `apps get` status.
|