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,307 +1,299 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: requestshield
|
|
3
|
-
description: Install, verify, troubleshoot, or remove IntelliFend RequestShield bot protection in a customer codebase — the browser SDK in Seamless or Manual mode, plus Java backend enforcement via the Spring Boot 3 starter or the Java core SDK —
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# RequestShield integration
|
|
7
|
-
|
|
8
|
-
Every RequestShield integration has two halves, and the split is the thing to
|
|
9
|
-
understand before writing any code:
|
|
10
|
-
|
|
11
|
-
1. **The browser** obtains a short-lived token and transports it with the protected
|
|
12
|
-
request, as the `X-IntelliFend-Token` header.
|
|
13
|
-
2. **The backend** evaluates that token and enforces the decision before the protected
|
|
14
|
-
operation runs.
|
|
15
|
-
|
|
16
|
-
The browser half is a *transport*, never a gate. A page that obtains tokens whose
|
|
17
|
-
backend never verifies them has zero protection while looking fully integrated — the
|
|
18
|
-
most common way this integration silently fails. Equally, an annotation on a handler
|
|
19
|
-
creates no browser configuration. **Browser configuration and backend protection are
|
|
20
|
-
configured independently, and neither one implies the other.** Land both halves in the
|
|
21
|
-
same change and verify both.
|
|
22
|
-
|
|
23
|
-
Protect the operation that performs the business mutation — registration, sign-in,
|
|
24
|
-
password reset, checkout, form submission — not a read-only route in front of it.
|
|
25
|
-
|
|
26
|
-
## Before touching integration files
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
requestshield --version # is the CLI present?
|
|
30
|
-
requestshield auth status
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
If `requestshield --version` fails,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
the
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
Those commands are the preflight for integration-changing work. For read-only CLI
|
|
44
|
-
questions, go to **Classify the request** and run only the matching command.
|
|
45
|
-
|
|
46
|
-
## Classify the request
|
|
47
|
-
|
|
48
|
-
Only **Install** and **Uninstall** are step-locked sequences. Every other intent is a
|
|
49
|
-
single CLI call or a short answer. Match on what the user wants, not on exact wording.
|
|
50
|
-
|
|
51
|
-
| Intent | Sounds like | Do this |
|
|
52
|
-
| --- | --- | --- |
|
|
53
|
-
| **General info** | "what version", "is there a newer CLI", "am I up to date" | `requestshield --version
|
|
54
|
-
| **Authentication** | "sign me in", or preflight `auth status` came back unauthenticated | Ask the user to run `requestshield signin` in their own terminal, and wait. It is interactive — never automate it, never run it for them, never ask for credentials. Re-run `auth status` once they confirm. |
|
|
55
|
-
| **Key / secret management** | "create an app key", "I need an API Secret", "rotate the secret", "deactivate a key" | **Hand the command over; do not run it.** → "Key and secret management" below. |
|
|
56
|
-
| **Install** | "add RequestShield", "protect /api/register" | `references/integration-planning.md` full flow → **Installing** → **Verifying** → **Negative test**. Do not reorder or skip a step. |
|
|
57
|
-
| **Uninstall** | "remove it", "roll it back" | `references/integration-planning.md` (Detect existing integration only) → **Uninstalling**. |
|
|
58
|
-
| **Verify / troubleshoot** | "is it set up right?", "why is it not blocking?", a reason code | `references/integration-planning.md` (Detect existing integration only) → **Verifying**. For a reason code, also read `references/troubleshooting.md`. |
|
|
59
|
-
| **Challenge volume** | "how much traffic", "how many challenges"
|
|
60
|
-
| **Billing** | "am I being charged", "what plan", "what are my limits" |
|
|
61
|
-
| **Service health** | "is the service up", "is it degraded" |
|
|
62
|
-
| **Agent setup** | "set this up for Codex too", "install the skill for Claude" | Run `requestshield agent setup` for auto-detection, or pass the requested agent: `--
|
|
63
|
-
| **Anything else** | | Look the command up in `references/cli.md`. If it is not there, run `requestshield --help` rather than guessing at a flag. |
|
|
64
|
-
|
|
65
|
-
Full CLI surface, output shapes, and which commands need auth: `references/cli.md`.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
For Install, `references/integration-planning.md` owns the full planning sequence:
|
|
69
|
-
Credentials check, Detect existing integration, Contract check, Gate, Then act on what
|
|
70
|
-
you found, and Choosing the mode. Keep the browser-mode and backend-path decisions
|
|
71
|
-
independent.
|
|
72
|
-
|
|
73
|
-
## Key and secret management
|
|
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
|
-
## Installing
|
|
101
|
-
|
|
102
|
-
For Install, run the full planning flow in `references/integration-planning.md` before
|
|
103
|
-
writing integration code: **Credentials check** → **Detect existing integration** →
|
|
104
|
-
**Contract check** → **Gate** → **Then act on what you found** → **Choosing the mode**.
|
|
105
|
-
It must settle the App Key, the existing-integration state, the contract values, the
|
|
106
|
-
backend path, and the browser mode before step 1 below.
|
|
107
|
-
|
|
108
|
-
1. **Browser side** — add the hosted script once in `<head>`, using the `script_url`
|
|
109
|
-
from
|
|
110
|
-
- Seamless → `references/browser-seamless.md`
|
|
111
|
-
- Manual → `references/browser-manual.md`
|
|
112
|
-
2. **Backend side** — add the dependency, configure `app-key` and `api-secret` from
|
|
113
|
-
environment variables, and enforce the decision before the mutation:
|
|
114
|
-
- Spring Boot 3 starter → `references/backend-spring-boot.md`
|
|
115
|
-
- Java core SDK → `references/backend-java-core.md`
|
|
116
|
-
3. **Cross-origin API**, if the protected endpoint is on another origin — its CORS
|
|
117
|
-
response must allow the page origin, intended methods, and `X-IntelliFend-Token`.
|
|
118
|
-
4. **CSP**, if the app sends one — merge, never replace. See
|
|
119
|
-
`references/browser-manual.md`.
|
|
120
|
-
5. **Verify** — run the checklist below, then the negative test when safe.
|
|
121
|
-
|
|
122
|
-
## Handling the App Key and API Secret
|
|
123
|
-
|
|
124
|
-
These two values have opposite handling rules:
|
|
125
|
-
|
|
126
|
-
- **App Key** is public. It belongs in the browser script tag and backend configuration.
|
|
127
|
-
The same value must appear on both sides or every token fails.
|
|
128
|
-
- **API Secret** is backend-only. It must reach the backend through an environment
|
|
129
|
-
variable or secret manager. Never write it into a source file, a committed `.env`, an
|
|
130
|
-
image layer, a CI config in the repo, or the chat transcript — and never echo it back
|
|
131
|
-
after reading it.
|
|
132
|
-
|
|
133
|
-
You never run the commands that display the API Secret, and you never read it back. The
|
|
134
|
-
hand-off and warning are in **Key and secret management** above. Afterwards refer to it
|
|
135
|
-
only as "the secret you just received".
|
|
136
|
-
|
|
137
|
-
If a secret has already reached a repo, a log, an artifact, or this transcript, the fix
|
|
138
|
-
is `requestshield
|
|
139
|
-
|
|
140
|
-
## Verifying
|
|
141
|
-
|
|
142
|
-
For standalone Verify / Troubleshoot, first run **Detect existing integration only** in
|
|
143
|
-
`references/integration-planning.md`. You are observing which browser mode and backend
|
|
144
|
-
path are in use, not choosing them — **Credentials check**, **Contract check**,
|
|
145
|
-
**Gate**, and **Choosing the mode** belong to the Install flow unless troubleshooting
|
|
146
|
-
evidence specifically points to a credential failure or an unreleased mode.
|
|
147
|
-
|
|
148
|
-
Then the static checks. They are deterministic and catch most real breakage.
|
|
149
|
-
|
|
150
|
-
- Exactly **one** SDK script tag, in `<head>`, loaded before any bundle that can issue a
|
|
151
|
-
protected request, with a real `data-app-key`.
|
|
152
|
-
- Seamless: every protected endpoint appears in `data-protect`, spelled as the exact
|
|
153
|
-
origin and pathname the browser actually requests — case and trailing slash included.
|
|
154
|
-
- Manual: every protected call site obtains a fresh token immediately before the request
|
|
155
|
-
and attaches it, including retry paths.
|
|
156
|
-
- Neither mode applied twice to the same operation.
|
|
157
|
-
- Backend: the dependency resolves, the App Key matches the browser's, the secret comes
|
|
158
|
-
from the environment, and the decision gates the mutation rather than only being
|
|
159
|
-
logged. Exactly one verification path per request.
|
|
160
|
-
- Cross-origin endpoints: CORS allows `X-IntelliFend-Token`.
|
|
161
|
-
- No token or secret in logs, analytics, URLs, or error reporting.
|
|
162
|
-
|
|
163
|
-
Structural correctness is not proof of enforcement. For runtime evidence,
|
|
164
|
-
endpoint
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
- **
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
- **
|
|
274
|
-
|
|
275
|
-
- **
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
`requestshield agent setup` installs this skill for the detected or requested agent.
|
|
301
|
-
Use `--agent codex` or `--agent claude` when the user names the target agent. For Codex
|
|
302
|
-
repositories that also use `AGENTS.md`, the CLI can write the managed block from
|
|
303
|
-
`assets/AGENTS.codex.md` so repo-local guidance points back to the installed skill and
|
|
304
|
-
the same reference files.
|
|
305
|
-
|
|
306
|
-
Agent setup installs guidance only. It does not mint keys, rotate secrets, deactivate
|
|
307
|
-
keys, or edit customer application code.
|
|
1
|
+
---
|
|
2
|
+
name: requestshield
|
|
3
|
+
description: Install, verify, troubleshoot, or remove IntelliFend RequestShield bot protection in a customer codebase — the browser SDK in Seamless or Manual mode, plus Java backend enforcement via the Spring Boot 3 starter or the Java core SDK — using the `requestshield` CLI for sign-in, applications and credentials, with SDK documentation and runtime observations for integration checks. Use this skill whenever the user mentions RequestShield, IntelliFend, `X-IntelliFend-Token`, `IntelliFend.getToken()`, `data-protect`, `@RequestShieldProtected`, App Key or API Secret setup, or asks to protect an endpoint such as registration, sign-in, password reset, checkout, or form submission from bots, scripted abuse, or credential stuffing — even when they never name the product. Also use it before hand-editing any file that already contains a RequestShield script tag, `verify()` call, or protection annotation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# RequestShield integration
|
|
7
|
+
|
|
8
|
+
Every RequestShield integration has two halves, and the split is the thing to
|
|
9
|
+
understand before writing any code:
|
|
10
|
+
|
|
11
|
+
1. **The browser** obtains a short-lived token and transports it with the protected
|
|
12
|
+
request, as the `X-IntelliFend-Token` header.
|
|
13
|
+
2. **The backend** evaluates that token and enforces the decision before the protected
|
|
14
|
+
operation runs.
|
|
15
|
+
|
|
16
|
+
The browser half is a *transport*, never a gate. A page that obtains tokens whose
|
|
17
|
+
backend never verifies them has zero protection while looking fully integrated — the
|
|
18
|
+
most common way this integration silently fails. Equally, an annotation on a handler
|
|
19
|
+
creates no browser configuration. **Browser configuration and backend protection are
|
|
20
|
+
configured independently, and neither one implies the other.** Land both halves in the
|
|
21
|
+
same change and verify both.
|
|
22
|
+
|
|
23
|
+
Protect the operation that performs the business mutation — registration, sign-in,
|
|
24
|
+
password reset, checkout, form submission — not a read-only route in front of it.
|
|
25
|
+
|
|
26
|
+
## Before touching integration files
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
requestshield --version # is the CLI present?
|
|
30
|
+
requestshield auth status --json # local session metadata, no provider check
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
If `requestshield --version` fails, explain that CLI account/app operations need
|
|
35
|
+
an installed compatible version. Do not substitute invented HTTP calls. SDK URLs,
|
|
36
|
+
headers, modes and backend requirements come from the customer documentation for
|
|
37
|
+
the chosen SDK release; the integration-contract CLI command is unavailable.
|
|
38
|
+
|
|
39
|
+
If local status is `signed_out`, ask the user to complete `requestshield signin`
|
|
40
|
+
themselves. Never ask for credentials. `valid` is a local state only; an expired
|
|
41
|
+
session may refresh during the next authenticated command.
|
|
42
|
+
|
|
43
|
+
Those commands are the preflight for integration-changing work. For read-only CLI
|
|
44
|
+
questions, go to **Classify the request** and run only the matching command.
|
|
45
|
+
|
|
46
|
+
## Classify the request
|
|
47
|
+
|
|
48
|
+
Only **Install** and **Uninstall** are step-locked sequences. Every other intent is a
|
|
49
|
+
single CLI call or a short answer. Match on what the user wants, not on exact wording.
|
|
50
|
+
|
|
51
|
+
| Intent | Sounds like | Do this |
|
|
52
|
+
| --- | --- | --- |
|
|
53
|
+
| **General info** | "what version", "is there a newer CLI", "am I up to date" | Use `requestshield --version`. For an explicitly requested update check, explain that production `update check` can offer a global npm installation; accept it only within the user’s requested scope. |
|
|
54
|
+
| **Authentication** | "sign me in", or preflight `auth status` came back unauthenticated | Ask the user to run `requestshield signin` in their own terminal, and wait. It is interactive — never automate it, never run it for them, never ask for credentials. Re-run `auth status` once they confirm. |
|
|
55
|
+
| **Key / secret management** | "create an app key", "I need an API Secret", "rotate the secret", "deactivate a key" | **Hand the command over; do not run it.** → "Key and secret management" below. |
|
|
56
|
+
| **Install** | "add RequestShield", "protect /api/register" | `references/integration-planning.md` full flow → **Installing** → **Verifying** → **Negative test**. Do not reorder or skip a step. |
|
|
57
|
+
| **Uninstall** | "remove it", "roll it back" | `references/integration-planning.md` (Detect existing integration only) → **Uninstalling**. |
|
|
58
|
+
| **Verify / troubleshoot** | "is it set up right?", "why is it not blocking?", a reason code | `references/integration-planning.md` (Detect existing integration only) → **Verifying**. For a reason code, also read `references/troubleshooting.md`. |
|
|
59
|
+
| **Challenge volume** | "how much traffic", "how many challenges" | Explain that the CLI analytics command is unavailable. Use existing authorized monitoring; do not infer volume from app status. |
|
|
60
|
+
| **Billing** | "am I being charged", "what plan", "what are my limits" | Explain that billing is unavailable in this CLI; use the customer’s established billing/support channel. |
|
|
61
|
+
| **Service health** | "is the service up", "is it degraded" | No service-health CLI command exists. Inspect authorized health/monitoring evidence without exposing credentials. |
|
|
62
|
+
| **Agent setup** | "set this up for Codex too", "install the skill for Claude" | Run `requestshield agent setup` for auto-detection, or pass the requested agent: `--codex` or `--claude`. This installs agent guidance; it does not mint keys or edit customer application code. |
|
|
63
|
+
| **Anything else** | | Look the command up in `references/cli.md`. If it is not there, run `requestshield --help` rather than guessing at a flag. |
|
|
64
|
+
|
|
65
|
+
Full CLI surface, output shapes, and which commands need auth: `references/cli.md`.
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
For Install, `references/integration-planning.md` owns the full planning sequence:
|
|
69
|
+
Credentials check, Detect existing integration, Contract check, Gate, Then act on what
|
|
70
|
+
you found, and Choosing the mode. Keep the browser-mode and backend-path decisions
|
|
71
|
+
independent.
|
|
72
|
+
|
|
73
|
+
## Key and secret management
|
|
74
|
+
|
|
75
|
+
Commands that display API secrets should run in the user's terminal so their
|
|
76
|
+
values never enter the agent's tool output or conversation. State-changing
|
|
77
|
+
commands must match the user's requested application and action.
|
|
78
|
+
|
|
79
|
+
```console
|
|
80
|
+
requestshield keys create --app-name <name>
|
|
81
|
+
requestshield keys rotate <app-key>
|
|
82
|
+
requestshield keys reveal <app-key>
|
|
83
|
+
requestshield keys revoke <app-key>
|
|
84
|
+
requestshield apps disable <app-key>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Create makes a new application. Rotate keeps the App Key and replaces its secret.
|
|
88
|
+
Reveal retrieves the current active secret when a prior response was lost; an
|
|
89
|
+
exposed secret instead requires rotation. Revoke invalidates the secret, while
|
|
90
|
+
application disable retains it. Acceptance is asynchronous, not proof of immediate
|
|
91
|
+
propagation. Explain the impact and storage requirement before the user runs a
|
|
92
|
+
command, then confirm secret presence only. Never ask them to paste a secret back.
|
|
93
|
+
|
|
94
|
+
Create/rename/enable do not prompt. Disable/rotate/revoke/reveal require confirmation
|
|
95
|
+
or `--yes`. Mutations other than reveal accept `--idempotency-key`; uncertain results
|
|
96
|
+
must be retried with identical arguments and the same key within seven days, never
|
|
97
|
+
a fresh key. A replay may return `apiSecret: null`; use explicit reveal rather than
|
|
98
|
+
automatically creating or rotating again. See `references/cli.md`.
|
|
99
|
+
|
|
100
|
+
## Installing
|
|
101
|
+
|
|
102
|
+
For Install, run the full planning flow in `references/integration-planning.md` before
|
|
103
|
+
writing integration code: **Credentials check** → **Detect existing integration** →
|
|
104
|
+
**Contract check** → **Gate** → **Then act on what you found** → **Choosing the mode**.
|
|
105
|
+
It must settle the App Key, the existing-integration state, the contract values, the
|
|
106
|
+
backend path, and the browser mode before step 1 below.
|
|
107
|
+
|
|
108
|
+
1. **Browser side** — add the hosted script once in `<head>`, using the `script_url`
|
|
109
|
+
from the published customer documentation for that SDK release, then follow the chosen browser reference:
|
|
110
|
+
- Seamless → `references/browser-seamless.md`
|
|
111
|
+
- Manual → `references/browser-manual.md`
|
|
112
|
+
2. **Backend side** — add the dependency, configure `app-key` and `api-secret` from
|
|
113
|
+
environment variables, and enforce the decision before the mutation:
|
|
114
|
+
- Spring Boot 3 starter → `references/backend-spring-boot.md`
|
|
115
|
+
- Java core SDK → `references/backend-java-core.md`
|
|
116
|
+
3. **Cross-origin API**, if the protected endpoint is on another origin — its CORS
|
|
117
|
+
response must allow the page origin, intended methods, and `X-IntelliFend-Token`.
|
|
118
|
+
4. **CSP**, if the app sends one — merge, never replace. See
|
|
119
|
+
`references/browser-manual.md`.
|
|
120
|
+
5. **Verify** — run the checklist below, then the negative test when safe.
|
|
121
|
+
|
|
122
|
+
## Handling the App Key and API Secret
|
|
123
|
+
|
|
124
|
+
These two values have opposite handling rules:
|
|
125
|
+
|
|
126
|
+
- **App Key** is public. It belongs in the browser script tag and backend configuration.
|
|
127
|
+
The same value must appear on both sides or every token fails.
|
|
128
|
+
- **API Secret** is backend-only. It must reach the backend through an environment
|
|
129
|
+
variable or secret manager. Never write it into a source file, a committed `.env`, an
|
|
130
|
+
image layer, a CI config in the repo, or the chat transcript — and never echo it back
|
|
131
|
+
after reading it.
|
|
132
|
+
|
|
133
|
+
You never run the commands that display the API Secret, and you never read it back. The
|
|
134
|
+
hand-off and warning are in **Key and secret management** above. Afterwards refer to it
|
|
135
|
+
only as "the secret you just received".
|
|
136
|
+
|
|
137
|
+
If a secret has already reached a repo, a log, an artifact, or this transcript, the fix
|
|
138
|
+
is `requestshield keys rotate <app-key>`, run by the user.
|
|
139
|
+
|
|
140
|
+
## Verifying
|
|
141
|
+
|
|
142
|
+
For standalone Verify / Troubleshoot, first run **Detect existing integration only** in
|
|
143
|
+
`references/integration-planning.md`. You are observing which browser mode and backend
|
|
144
|
+
path are in use, not choosing them — **Credentials check**, **Contract check**,
|
|
145
|
+
**Gate**, and **Choosing the mode** belong to the Install flow unless troubleshooting
|
|
146
|
+
evidence specifically points to a credential failure or an unreleased mode.
|
|
147
|
+
|
|
148
|
+
Then the static checks. They are deterministic and catch most real breakage.
|
|
149
|
+
|
|
150
|
+
- Exactly **one** SDK script tag, in `<head>`, loaded before any bundle that can issue a
|
|
151
|
+
protected request, with a real `data-app-key`.
|
|
152
|
+
- Seamless: every protected endpoint appears in `data-protect`, spelled as the exact
|
|
153
|
+
origin and pathname the browser actually requests — case and trailing slash included.
|
|
154
|
+
- Manual: every protected call site obtains a fresh token immediately before the request
|
|
155
|
+
and attaches it, including retry paths.
|
|
156
|
+
- Neither mode applied twice to the same operation.
|
|
157
|
+
- Backend: the dependency resolves, the App Key matches the browser's, the secret comes
|
|
158
|
+
from the environment, and the decision gates the mutation rather than only being
|
|
159
|
+
logged. Exactly one verification path per request.
|
|
160
|
+
- Cross-origin endpoints: CORS allows `X-IntelliFend-Token`.
|
|
161
|
+
- No token or secret in logs, analytics, URLs, or error reporting.
|
|
162
|
+
|
|
163
|
+
Structural correctness is not proof of enforcement. For runtime evidence,
|
|
164
|
+
exercise the endpoint in an authorized environment and inspect the browser request
|
|
165
|
+
and backend decision without recording tokens. The CLI challenge-volume command
|
|
166
|
+
is unavailable, and application status does not establish traffic. Report static
|
|
167
|
+
checks, observed requests and backend enforcement separately.
|
|
168
|
+
|
|
169
|
+
### The negative test — the only proof of enforcement
|
|
170
|
+
|
|
171
|
+
Neither static checks nor observed browser traffic can prove the backend refuses a
|
|
172
|
+
tokenless mutation. The proof is a request the backend should reject.
|
|
173
|
+
|
|
174
|
+
Before running it, establish:
|
|
175
|
+
|
|
176
|
+
1. The backend under test can reach its configured verification service and safe
|
|
177
|
+
metrics show a non-degraded control request. A platform-wide health report alone
|
|
178
|
+
would not establish that this backend’s local circuit has closed.
|
|
179
|
+
2. The endpoint's effective mode is `BLOCK`, not `MONITOR`. Include any method-level
|
|
180
|
+
override when resolving the effective mode. `MONITOR` allows every request by design.
|
|
181
|
+
3. A valid control request is available. Its authentication, session, CSRF state, route,
|
|
182
|
+
method, and body must remain valid during the comparison.
|
|
183
|
+
4. Establish a way to observe degradation for the backend instance and App Key under
|
|
184
|
+
test. For the Spring Boot starter, use the `intellifend.requestshield.requests` metric and distinguish
|
|
185
|
+
`outcome=allowed, reason=ok` from `outcome=degraded, reason=service_unavailable`. For
|
|
186
|
+
the Java core SDK, use existing safe metrics or logs derived from `isDegraded()` and
|
|
187
|
+
`getReason().getCode()`. Never log the raw token, API Secret, session, or CSRF value.
|
|
188
|
+
|
|
189
|
+
**Confirm with the user before running this anywhere shared.** It exercises a real
|
|
190
|
+
mutation, so use a local or staging environment, or an endpoint whose write can be
|
|
191
|
+
undone. Do not fire it at production to "just check", and do not invent a body that
|
|
192
|
+
could create a real account.
|
|
193
|
+
|
|
194
|
+
First, send the control request through the normal integrated path with a fresh
|
|
195
|
+
RequestShield token. Confirm that it succeeds, reaches the intended mutation, and records
|
|
196
|
+
a non-degraded `ok` decision at the backend. A successful response produced by degraded
|
|
197
|
+
fail-open is not a valid control. Use a new token for every control attempt because
|
|
198
|
+
RequestShield tokens are single-use.
|
|
199
|
+
|
|
200
|
+
Then repeat the same request while preserving its valid authentication, session, CSRF
|
|
201
|
+
state, route, method, body, and other relevant headers. Remove only
|
|
202
|
+
`X-IntelliFend-Token`. Send it through a client that bypasses the Browser SDK so Seamless
|
|
203
|
+
mode cannot attach another token:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
curl -i -X POST https://<host>/api/register \
|
|
207
|
+
-H '<the same valid authentication and CSRF context>' \
|
|
208
|
+
-H 'Content-Type: application/json' \
|
|
209
|
+
-d '{ ...the same valid test body... }'
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Attribute the result to RequestShield rather than treating every 4xx as a pass.
|
|
213
|
+
Authentication, authorization, CSRF, and request validation can independently return a
|
|
214
|
+
401, 403, or 400 before the protected mutation.
|
|
215
|
+
|
|
216
|
+
- **Spring Boot 3 starter:** pass only when the response is HTTP 403 with
|
|
217
|
+
`CHALLENGE_FAILED` and reason `missing_token`, and the handler produced no side effect.
|
|
218
|
+
- **Java core SDK:** read the handler before testing. Confirm that its
|
|
219
|
+
`!result.isAllowed()` branch rejects before the mutation, then verify that the
|
|
220
|
+
observed rejection corresponds to RequestShield's `missing_token` decision and
|
|
221
|
+
produced no side effect.
|
|
222
|
+
- **Any unrelated or unattributable 4xx:** inconclusive, not a pass. Fix the control
|
|
223
|
+
request or add safe RequestShield-specific observability before drawing a conclusion.
|
|
224
|
+
- **Any backend-specific degraded evidence, including `service_unavailable`:**
|
|
225
|
+
inconclusive. The SDK intentionally allows the request under its availability policy;
|
|
226
|
+
restore the backend's Challenge Server connectivity, wait for its circuit to recover,
|
|
227
|
+
and repeat with a new control token.
|
|
228
|
+
|
|
229
|
+
A `2xx`, or evidence that the mutation happened, is a confirmed missing-token
|
|
230
|
+
enforcement bypass only when backend-specific degradation has been ruled out for that
|
|
231
|
+
request. If backend-specific degradation evidence is absent or cannot be checked,
|
|
232
|
+
report the test as inconclusive—not as proof that enforcement is absent. When degradation
|
|
233
|
+
is ruled out, treat the bypass as the finding and go to `references/troubleshooting.md`.
|
|
234
|
+
|
|
235
|
+
## Uninstalling
|
|
236
|
+
|
|
237
|
+
Run `references/integration-planning.md` Detect existing integration only before this
|
|
238
|
+
section. Remove only what RequestShield introduced, and confirm the list with the user
|
|
239
|
+
first:
|
|
240
|
+
|
|
241
|
+
1. The script tag, including `data-protect` and any other RequestShield attributes.
|
|
242
|
+
2. Manual-mode `getToken()` calls and the header lines they feed — leave the surrounding
|
|
243
|
+
request intact.
|
|
244
|
+
3. The backend dependency, client configuration, and the enforcement: `verify()` calls
|
|
245
|
+
or `@RequestShieldProtected` annotations.
|
|
246
|
+
4. RequestShield entries in the CSP header and in CORS allowed headers — leave every
|
|
247
|
+
other source and header in place.
|
|
248
|
+
5. Configuration keys and environment variable references.
|
|
249
|
+
|
|
250
|
+
Application disable is a separate action: `requestshield apps disable <app-key>`.
|
|
251
|
+
Perform or hand it off only when the user requested that live-state change; removing
|
|
252
|
+
integration code does not itself authorize revocation or disable.
|
|
253
|
+
|
|
254
|
+
## Non-negotiables
|
|
255
|
+
|
|
256
|
+
These separate an integration that protects traffic from one that only looks like it:
|
|
257
|
+
|
|
258
|
+
- **Enforcement lives in the backend.** Application code in the browser must never
|
|
259
|
+
decide to allow, block, retry around, or interpret a token.
|
|
260
|
+
- **Browser configuration and backend protection are independent.** Neither implies the
|
|
261
|
+
other.
|
|
262
|
+
- **One browser mode and one backend path are selected independently.** Seamless is not
|
|
263
|
+
Spring Boot, and Manual is not Java core. Either browser mode may pair with either
|
|
264
|
+
supported backend path.
|
|
265
|
+
- **One token per protected request; a new token before every retry.** Tokens are
|
|
266
|
+
single-use; replaying one returns `token_replayed` and blocks the request.
|
|
267
|
+
- **One verification per request.** Never combine `@RequestShieldProtected` with a
|
|
268
|
+
manual `RequestShieldClient.verify()` on the same handler.
|
|
269
|
+
- **Forward a non-empty token unchanged.** Do not trim, re-encode, inspect, cache,
|
|
270
|
+
persist, log, or place it in a URL.
|
|
271
|
+
- When `getToken()` returns an empty string in Manual mode, omit the header and let the
|
|
272
|
+
backend apply its configured policy.
|
|
273
|
+
- **The API Secret stays at the backend.** Never put it in browser code,
|
|
274
|
+
client-visible responses, source control, logs, build artifacts, or chat transcripts.
|
|
275
|
+
- **Keep displayed secrets out of tool output.** Hand create/rotate/reveal to the
|
|
276
|
+
user and verify by presence only. Match other live-state changes to user intent.
|
|
277
|
+
|
|
278
|
+
## Reference files
|
|
279
|
+
|
|
280
|
+
| File | Read it when |
|
|
281
|
+
| --- | --- |
|
|
282
|
+
| `references/cli.md` | Any CLI invocation — exact syntax, output shape, auth requirements |
|
|
283
|
+
| `references/integration-planning.md` | Credentials check, existing-integration detection, the contract check, backend gating (Java version, Spring Boot 3 MVC vs WebFlux, other frameworks), and browser-mode selection |
|
|
284
|
+
| `references/browser-manual.md` | Installing or auditing Manual mode; CSP rules |
|
|
285
|
+
| `references/browser-seamless.md` | Installing or auditing Seamless mode; matching and coverage limits |
|
|
286
|
+
| `references/backend-spring-boot.md` | Backend work on Spring Boot 3 MVC — the annotation path |
|
|
287
|
+
| `references/backend-java-core.md` | Backend work on any other Java 17 backend — the `verify()` path |
|
|
288
|
+
| `references/troubleshooting.md` | A block, a degraded result, or a reason code to explain |
|
|
289
|
+
|
|
290
|
+
## For agent setup
|
|
291
|
+
|
|
292
|
+
`requestshield agent setup` installs this skill for the detected or requested agent.
|
|
293
|
+
Use `--codex` or `--claude` when the user names the target agent. Setup installs
|
|
294
|
+
into the agent’s personal skill directory; it does not edit repository `AGENTS.md`.
|
|
295
|
+
`assets/AGENTS.codex.md` is an optional template for a separately requested
|
|
296
|
+
repository instruction change.
|
|
297
|
+
|
|
298
|
+
Agent setup installs guidance only. It does not mint keys, rotate secrets, deactivate
|
|
299
|
+
keys, or edit customer application code.
|