wawesome 0.7.0 → 0.9.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 +113 -5
- package/dist/index.mjs +757 -187
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -116,6 +116,9 @@ npx wawesome deploy
|
|
|
116
116
|
| `npx wawesome env list` | View environment variables for the current app |
|
|
117
117
|
| `npx wawesome env set <key> <val>` | Set an environment variable (add `--secret` for write-only) |
|
|
118
118
|
| `npx wawesome env rm <key>` | Delete an environment variable |
|
|
119
|
+
| `npx wawesome credentials` | List deploy credentials — name, prefix, capabilities, Apps, last use |
|
|
120
|
+
| `npx wawesome credentials mint <name>` | Mint a deploy credential and print its secret, once |
|
|
121
|
+
| `npx wawesome credentials revoke <name>`| Revoke a deploy credential by name or prefix |
|
|
119
122
|
|
|
120
123
|
---
|
|
121
124
|
|
|
@@ -279,6 +282,74 @@ npx wawesome cron history my-function --state failed
|
|
|
279
282
|
|
|
280
283
|
---
|
|
281
284
|
|
|
285
|
+
## 🔑 Deploy Credentials
|
|
286
|
+
|
|
287
|
+
A deploy credential is what a CI pipeline or an agent authenticates with, where there is nobody at a
|
|
288
|
+
keyboard to log in. It belongs to the workspace rather than to you: it keeps working after you leave,
|
|
289
|
+
and revoking it does not end your own session. Once you have one, [Deploying from CI](#-deploying-from-ci)
|
|
290
|
+
is what to do with it.
|
|
291
|
+
|
|
292
|
+
Minting, listing and revoking are the workspace owner's, and are closed to deploy credentials
|
|
293
|
+
themselves whatever they carry — a leaked credential cannot mint another. So these three run on your
|
|
294
|
+
ordinary `npx wawesome login` session.
|
|
295
|
+
|
|
296
|
+
### Mint one
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
npx wawesome credentials mint ci-pipeline
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
The secret is printed once and never again — the platform stores a digest of it, so no later read can
|
|
303
|
+
rebuild it. It goes to stdout on a line of its own and everything else the command prints goes to
|
|
304
|
+
stderr, so a redirect catches the secret and not one character besides:
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
npx wawesome credentials mint ci-pipeline > secret.txt
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
A credential carries `deploy`, reaches every App in the workspace, and expires in ninety days unless
|
|
311
|
+
you say otherwise:
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
# reads logs and cannot deploy, restricted to one App, never expires
|
|
315
|
+
npx wawesome credentials mint agent -c logs:read -a prod --expires never
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
| Flag | Meaning |
|
|
319
|
+
|:---------------------|:------------------------------------------------------------------------------|
|
|
320
|
+
| `-c, --capability` | `deploy`, `logs:read`, or both. Repeatable or comma-separated. Default `deploy` |
|
|
321
|
+
| `-a, --app` | Restrict to these Apps, by slug. Repeatable. Default: every App in the workspace |
|
|
322
|
+
| `--expires` | Days, or `never`. Default: 90 |
|
|
323
|
+
|
|
324
|
+
An App named in a restriction does not have to exist yet — a pipeline whose first deploy creates the
|
|
325
|
+
App it was minted for is the ordinary case. A restriction bounds what a credential can disturb, not
|
|
326
|
+
what it can read: a Function deployed into one App still reads the whole workspace's environment at
|
|
327
|
+
runtime.
|
|
328
|
+
|
|
329
|
+
### List them
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
npx wawesome credentials
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
Name, displayable prefix, capabilities, Apps, last use and expiry — never the secret, which the
|
|
336
|
+
platform no longer holds. `LAST USED` lags by a few minutes and reads `never` for a credential
|
|
337
|
+
nothing has ever presented, which is a better reason to revoke one than any calendar date.
|
|
338
|
+
|
|
339
|
+
### Revoke one
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
npx wawesome credentials revoke ci-pipeline
|
|
343
|
+
npx wawesome credentials revoke wawe_ab3k9x --yes
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
By name or by displayable prefix, whole or partial. It asks before it does it, `--yes` is the answer
|
|
347
|
+
where nobody is at the keyboard, and a prefix naming more than one credential is refused rather than
|
|
348
|
+
guessed at. A revocation lands on the very next request presenting the secret, and nothing un-revokes
|
|
349
|
+
it.
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
282
353
|
## ⚙️ Configuration & Custom Gateway
|
|
283
354
|
|
|
284
355
|
### `wawesome-function.json`
|
|
@@ -340,11 +411,14 @@ Two rules to know about:
|
|
|
340
411
|
**HTML is refused at deploy time.** Your Function renders its own markup, and a document served from
|
|
341
412
|
your App's own origin is the sharpest same-origin vector a static file has.
|
|
342
413
|
|
|
343
|
-
**An SVG is served
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
414
|
+
**An SVG is served inert.** The rule behind the refusal above is that nothing you deploy as a file
|
|
415
|
+
becomes a page on your App's own origin, and an SVG opened directly in a browser would — it runs
|
|
416
|
+
script, and it renders whatever HTML a `<foreignObject>` holds. It is served rather than refused
|
|
417
|
+
because making it inert costs the file nothing: an `<img src="logo.svg">` never ran that script and
|
|
418
|
+
is never checked against the policy, so your drawings render as they always did. Every SVG and XML
|
|
419
|
+
file carries `Content-Security-Policy: script-src 'none'; sandbox`, and only navigating straight to
|
|
420
|
+
one loses anything — such a file is sandboxed onto an origin of its own, so its links no longer
|
|
421
|
+
navigate and a page embedding it through `<object>` or `<iframe>` cannot reach into its DOM.
|
|
348
422
|
|
|
349
423
|
### Schedules
|
|
350
424
|
|
|
@@ -497,6 +571,40 @@ export WAWESOME_GATEWAY_URL="http://localhost:3000"
|
|
|
497
571
|
npx wawesome login --gateway http://localhost:3000
|
|
498
572
|
```
|
|
499
573
|
|
|
574
|
+
A successful login records the gateway it used, and every later command goes there, because a token is only valid at
|
|
575
|
+
the gateway that issued it. `login` itself ignores that record and reads only the three overrides above, so a bare
|
|
576
|
+
`npx wawesome login` with none of them set goes to `https://api.wawesome.io`. `npx wawesome logout` clears the recorded
|
|
577
|
+
gateway along with the credentials.
|
|
578
|
+
|
|
579
|
+
---
|
|
580
|
+
|
|
581
|
+
## 🤖 Deploying from CI
|
|
582
|
+
|
|
583
|
+
A **deploy credential** is what deploys without a person at a keyboard. Your workspace mints one, and the CLI reads it
|
|
584
|
+
from a single environment variable — there is no login, and no credentials file is involved at any point:
|
|
585
|
+
|
|
586
|
+
```bash
|
|
587
|
+
export WAWESOME_DEPLOY_CREDENTIAL="wawe_..."
|
|
588
|
+
export WAWESOME_GATEWAY_URL="https://api.wawesome.io"
|
|
589
|
+
|
|
590
|
+
npx wawesome deploy
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
The workspace is resolved from the credential itself, so nothing in your pipeline has to carry a workspace identifier.
|
|
594
|
+
The variable name is prefixed and has no shorter alias, so it cannot collide with another tool's CI variable.
|
|
595
|
+
|
|
596
|
+
While it is set:
|
|
597
|
+
|
|
598
|
+
- it wins over any `~/.wawesome/credentials.json` on the machine, so a runner with a stale cached home directory still
|
|
599
|
+
deploys as the credential rather than as whoever last logged in there;
|
|
600
|
+
- nothing is written to disk, and the secret stays in the environment where you put it;
|
|
601
|
+
- a refusal says which of four things happened — the credential is unknown, revoked, expired, or does not carry what the
|
|
602
|
+
command needs — instead of asking you to sign in again, which a pipeline cannot do;
|
|
603
|
+
- `login` and `logout` refuse, because neither would change what the next command authenticates as;
|
|
604
|
+
- `credentials` is refused by the platform, because minting, listing and revoking are closed to
|
|
605
|
+
credentials whatever they carry;
|
|
606
|
+
- `whoami` names the credential by its prefix, so you can match it against the one in your CI settings.
|
|
607
|
+
|
|
500
608
|
---
|
|
501
609
|
|
|
502
610
|
## 🔒 Security & Secrets
|