Skip to content

Commit 4a56f8e

Browse files
authored
fix(skill) harden xurl SKILL.md against secret leakage (#34)
1 parent 595ed07 commit 4a56f8e

1 file changed

Lines changed: 26 additions & 27 deletions

File tree

SKILL.md

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,42 @@ description: A curl-like CLI tool for making authenticated requests to the X (Tw
1111

1212
## Prerequisites
1313

14+
This skill requires the `xurl` CLI utility: <https://github.com/xdevplatform/xurl>.
15+
1416
Before using any command you must be authenticated. Run `xurl auth status` to check.
1517

18+
### Secret Safety (Mandatory)
19+
20+
- Never read, print, parse, summarize, upload, or send `~/.xurl` (or copies of it) to the LLM context.
21+
- Never ask the user to paste credentials/tokens into chat.
22+
- The user must fill `~/.xurl` with required secrets manually on their own machine.
23+
- Do not recommend or execute auth commands with inline secrets in agent/LLM sessions.
24+
- Warn that using CLI secret options in agent sessions can leak credentials (prompt/context, logs, shell history).
25+
- Never use `--verbose` / `-v` in agent/LLM sessions; it can expose sensitive headers/tokens in output.
26+
- Sensitive flags that must never be used in agent commands: `--bearer-token`, `--consumer-key`, `--consumer-secret`, `--access-token`, `--token-secret`, `--client-id`, `--client-secret`.
27+
- To verify whether at least one app with credentials is already registered, run: `xurl auth status`.
28+
1629
### Register an app (recommended)
1730

18-
```bash
19-
# Register your X API app credentials (stored in ~/.xurl)
20-
xurl auth apps add my-app --client-id YOUR_CLIENT_ID --client-secret YOUR_CLIENT_SECRET
31+
App credential registration must be done manually by the user outside the agent/LLM session.
32+
After credentials are registered, authenticate with:
2133

22-
# Then authenticate
34+
```bash
2335
xurl auth oauth2
2436
```
2537

26-
You can register multiple apps and switch between them:
38+
For multiple pre-configured apps, switch between them:
2739
```bash
28-
xurl auth apps add prod-app --client-id PROD_ID --client-secret PROD_SECRET
29-
xurl auth apps add dev-app --client-id DEV_ID --client-secret DEV_SECRET
3040
xurl auth default prod-app # set default app
3141
xurl auth default prod-app alice # set default app + user
3242
xurl --app dev-app /2/users/me # one-off override
3343
```
3444

3545
### Other auth methods
3646

37-
```bash
38-
# OAuth 1.0a
39-
xurl auth oauth1 \
40-
--consumer-key KEY --consumer-secret SECRET \
41-
--access-token TOKEN --token-secret SECRET
42-
43-
# App‑only bearer token
44-
xurl auth app --bearer-token TOKEN
45-
```
47+
Examples with inline secret flags are intentionally omitted. If OAuth1 or app-only auth is needed, the user must run those commands manually outside agent/LLM context.
4648

47-
Tokens are persisted to `~/.xurl` in YAML format. Each app has its own isolated tokens. Once authenticated, every command below will auto‑attach the right `Authorization` header.
49+
Tokens are persisted to `~/.xurl` in YAML format. Each app has its own isolated tokens. Do not read this file through the agent/LLM. Once authenticated, every command below will auto‑attach the right `Authorization` header.
4850

4951
---
5052

@@ -83,9 +85,9 @@ Tokens are persisted to `~/.xurl` in YAML format. Each app has its own isolated
8385
| Upload media | `xurl media upload path/to/file.mp4` |
8486
| Media status | `xurl media status MEDIA_ID` |
8587
| **App Management** | |
86-
| Register app | `xurl auth apps add NAME --client-id ID --client-secret SEC` |
88+
| Register app | Manual, outside agent (do not pass secrets via agent) |
8789
| List apps | `xurl auth apps list` |
88-
| Update app creds | `xurl auth apps update NAME --client-id ID` |
90+
| Update app creds | Manual, outside agent (do not pass secrets via agent) |
8991
| Remove app | `xurl auth apps remove NAME` |
9092
| Set default (interactive) | `xurl auth default` |
9193
| Set default (command) | `xurl auth default APP_NAME [USERNAME]` |
@@ -248,7 +250,7 @@ These flags work on every command:
248250
| `--app` | | Use a specific registered app for this request (overrides default) |
249251
| `--auth` | | Force auth type: `oauth1`, `oauth2`, or `app` |
250252
| `--username` | `-u` | Which OAuth2 account to use (if you have multiple) |
251-
| `--verbose` | `-v` | Print full request/response headers |
253+
| `--verbose` | `-v` | Forbidden in agent/LLM sessions (can leak auth headers/tokens) |
252254
| `--trace` | `-t` | Add `X-B3-Flags: 1` trace header |
253255

254256
---
@@ -360,11 +362,8 @@ xurl timeline -n 20
360362

361363
### Set up multiple apps
362364
```bash
363-
# Register two apps
364-
xurl auth apps add prod --client-id PROD_ID --client-secret PROD_SECRET
365-
xurl auth apps add staging --client-id STG_ID --client-secret STG_SECRET
366-
367-
# Authenticate users on each
365+
# App credentials must already be configured manually outside agent/LLM context.
366+
# Authenticate users on each pre-configured app
368367
xurl auth default prod
369368
xurl auth oauth2 # authenticates on prod app
370369

@@ -392,7 +391,7 @@ xurl --app staging /2/users/me # one-off request against staging
392391
- **Rate limits:** The X API enforces rate limits per endpoint. If you get a 429 error, wait and retry. Write endpoints (post, reply, like, repost) have stricter limits than read endpoints.
393392
- **Scopes:** OAuth 2.0 tokens are requested with broad scopes. If you get a 403 on a specific action, your token may lack the required scope — re‑run `xurl auth oauth2` to get a fresh token.
394393
- **Token refresh:** OAuth 2.0 tokens auto‑refresh when expired. No manual intervention needed.
395-
- **Multiple apps:** Register multiple apps with `xurl auth apps add`. Each app has its own isolated credentials and tokens. Switch with `xurl auth default` or `--app`.
394+
- **Multiple apps:** Each app has its own isolated credentials and tokens. Configure credentials manually outside agent/LLM context, then switch with `xurl auth default` or `--app`.
396395
- **Multiple accounts:** You can authenticate multiple OAuth 2.0 accounts per app and switch between them with `--username` / `-u` or set a default with `xurl auth default APP USER`.
397396
- **Default user:** When no `-u` flag is given, xurl uses the default user for the active app (set via `xurl auth default`). If no default user is set, it uses the first available token.
398-
- **Token storage:** `~/.xurl` is YAML. Each app stores its own credentials and tokens.
397+
- **Token storage:** `~/.xurl` is YAML. Each app stores its own credentials and tokens. Never read or send this file to LLM context.

0 commit comments

Comments
 (0)