wawesome 0.8.0 → 0.10.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 +148 -5
- package/dist/index.mjs +700 -116
- 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
|
|
|
@@ -427,6 +501,41 @@ That is deliberate — the line that keeps a job off the internet is one line, a
|
|
|
427
501
|
quietly honoured its deletion would put the job back on the open internet with nothing said. Every
|
|
428
502
|
deploy prints the visibility it landed, beside the URL or in place of it.
|
|
429
503
|
|
|
504
|
+
### A domain of your own
|
|
505
|
+
|
|
506
|
+
Add `"domain"` and your App answers at a name you own, beside the address it already has:
|
|
507
|
+
|
|
508
|
+
```json
|
|
509
|
+
{
|
|
510
|
+
"app": "my-app",
|
|
511
|
+
"function": "api",
|
|
512
|
+
"entry": "src/index.ts",
|
|
513
|
+
"domain": "shop.client.com"
|
|
514
|
+
}
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
The deploy attaches it and prints two DNS records to add at your registrar. The TXT record proves you
|
|
518
|
+
own the name, which is what issues the certificate. The CNAME points traffic here, and you add that
|
|
519
|
+
one once the certificate is issued, so a site that is already live never spends a minute answering on
|
|
520
|
+
a certificate that is not there yet.
|
|
521
|
+
|
|
522
|
+
Your deploy waits for neither. It attaches the domain, prints the records and finishes, and every
|
|
523
|
+
later deploy states where the domain got to: not verified, ownership verified, certificate issued, or
|
|
524
|
+
serving. A domain that is already serving is a line saying so and nothing else.
|
|
525
|
+
|
|
526
|
+
A custom domain is granted from the Solo plan upwards, one per App. On a plan that grants none, the
|
|
527
|
+
deploy prints the refusal and lands everything else it was doing.
|
|
528
|
+
|
|
529
|
+
The address derived from your workspace slug keeps serving after you attach a domain. Both names
|
|
530
|
+
answer, so webhooks and integrations already pointed at the old one keep working.
|
|
531
|
+
|
|
532
|
+
An apex domain — `client.com` with no `www` — attaches like any other name. Whether a CNAME may sit at
|
|
533
|
+
your zone root is your DNS provider's rule, and where it cannot, attach `www.client.com` and configure
|
|
534
|
+
the redirect at the provider.
|
|
535
|
+
|
|
536
|
+
Deleting the line detaches nothing. Detaching takes a live site dark, which is not something a deploy
|
|
537
|
+
should infer from a deleted line.
|
|
538
|
+
|
|
430
539
|
### Reserved headers
|
|
431
540
|
|
|
432
541
|
`x-wawesome-*` belongs to the platform in both directions. It is stripped off the request before your
|
|
@@ -497,6 +606,40 @@ export WAWESOME_GATEWAY_URL="http://localhost:3000"
|
|
|
497
606
|
npx wawesome login --gateway http://localhost:3000
|
|
498
607
|
```
|
|
499
608
|
|
|
609
|
+
A successful login records the gateway it used, and every later command goes there, because a token is only valid at
|
|
610
|
+
the gateway that issued it. `login` itself ignores that record and reads only the three overrides above, so a bare
|
|
611
|
+
`npx wawesome login` with none of them set goes to `https://api.wawesome.io`. `npx wawesome logout` clears the recorded
|
|
612
|
+
gateway along with the credentials.
|
|
613
|
+
|
|
614
|
+
---
|
|
615
|
+
|
|
616
|
+
## 🤖 Deploying from CI
|
|
617
|
+
|
|
618
|
+
A **deploy credential** is what deploys without a person at a keyboard. Your workspace mints one, and the CLI reads it
|
|
619
|
+
from a single environment variable — there is no login, and no credentials file is involved at any point:
|
|
620
|
+
|
|
621
|
+
```bash
|
|
622
|
+
export WAWESOME_DEPLOY_CREDENTIAL="wawe_..."
|
|
623
|
+
export WAWESOME_GATEWAY_URL="https://api.wawesome.io"
|
|
624
|
+
|
|
625
|
+
npx wawesome deploy
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
The workspace is resolved from the credential itself, so nothing in your pipeline has to carry a workspace identifier.
|
|
629
|
+
The variable name is prefixed and has no shorter alias, so it cannot collide with another tool's CI variable.
|
|
630
|
+
|
|
631
|
+
While it is set:
|
|
632
|
+
|
|
633
|
+
- it wins over any `~/.wawesome/credentials.json` on the machine, so a runner with a stale cached home directory still
|
|
634
|
+
deploys as the credential rather than as whoever last logged in there;
|
|
635
|
+
- nothing is written to disk, and the secret stays in the environment where you put it;
|
|
636
|
+
- a refusal says which of four things happened — the credential is unknown, revoked, expired, or does not carry what the
|
|
637
|
+
command needs — instead of asking you to sign in again, which a pipeline cannot do;
|
|
638
|
+
- `login` and `logout` refuse, because neither would change what the next command authenticates as;
|
|
639
|
+
- `credentials` is refused by the platform, because minting, listing and revoking are closed to
|
|
640
|
+
credentials whatever they carry;
|
|
641
|
+
- `whoami` names the credential by its prefix, so you can match it against the one in your CI settings.
|
|
642
|
+
|
|
500
643
|
---
|
|
501
644
|
|
|
502
645
|
## 🔒 Security & Secrets
|