@sjawhar/pi-envoy 17.31.2 → 17.31.3

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/dist/envoy.js CHANGED
@@ -47722,7 +47722,7 @@ var import_nats2 = __toESM(require_mod4(), 1);
47722
47722
 
47723
47723
  // package.json
47724
47724
  var name = "@sjawhar/pi-envoy";
47725
- var version2 = "17.31.2";
47725
+ var version2 = "17.31.3";
47726
47726
  var package_default = {
47727
47727
  name,
47728
47728
  version: version2,
@@ -74,12 +74,6 @@ agent-secrets LEGION_SLACK_BOT_TOKEN -- \
74
74
  sh -c 'printf "Authorization: Bearer %s" "$LEGION_SLACK_BOT_TOKEN" | curl -sS -H @- https://slack.com/api/auth.test'
75
75
  ```
76
76
 
77
- The repository uses the same form for a GitHub App token in `docs/deployment.md`:
78
-
79
- ```sh
80
- agent-secrets LEGION_IMPLEMENT_APP --reason=… -- sh -c 'printf %s "$LEGION_IMPLEMENT_APP"'
81
- ```
82
-
83
77
  ## A secret behind the airlock
84
78
 
85
79
  Your deployment can hold a secret's value back and give your command a stand-in. You see it in the
@@ -130,13 +124,42 @@ Your transcript keeps everything a command prints.
130
124
 
131
125
  - Never echo or print the value, and never run `curl -v`, `curl --trace` or a shell with `set -x`
132
126
  around it: each of those writes the header, and so the value, to your output.
133
- - Check a value's shape by its length and its prefix alone. For a secret behind the airlock, that
134
- reads the placeholder's shape and not the value's:
127
+ - Check a plain value's shape by its length and its prefix alone:
135
128
 
136
129
  ```sh
137
130
  agent-secrets NAME --reason 'check the shape of this credential' -- sh -c 'echo "${#NAME}"; case "$NAME" in ghp_*) echo prefix-ok;; *) echo prefix-no;; esac'
138
131
  ```
139
132
 
133
+ - A value may be a JSON document, with the credential one level down or deeper: a GitHub App
134
+ secret asked for without `--github-token` is the JSON object of installations, and its tokens
135
+ are inside it. Check a JSON value's shape by its key paths and the length of each leaf, and
136
+ never by printing a leaf. A probe that masks one key prints every other key's value, the
137
+ nested ones too, so print no value at all, masked or not. These print the key paths, then each
138
+ leaf's path with its length. For a value that is not JSON, jq exits 5 and writes
139
+ `jq: error (at <unknown>): the value is not JSON` to stderr (jaq writes
140
+ `Error: "the value is not JSON"`), and nothing of the value: `try … catch` keeps jq's own parse
141
+ error out, which quotes the text (`… (while parsing '<the value>')`):
142
+
143
+ ```sh
144
+ agent-secrets NAME --reason 'check the shape of this credential' -- \
145
+ jq -n 'env.NAME | try fromjson catch error("the value is not JSON") | [paths(type != "object" and type != "array") | join(".")]'
146
+ agent-secrets NAME --reason 'check the shape of this credential' -- \
147
+ jq -n 'env.NAME | try fromjson catch error("the value is not JSON") | [paths(type != "object" and type != "array") as $p | {path: ($p | join(".")), length: (getpath($p) | tostring | length)}]'
148
+ ```
149
+
150
+ - Take a credential out of a JSON value inside the command, and pass it on there without
151
+ printing it. `jq -e` exits 1 when the path holds nothing, so the command stops rather than
152
+ sending an empty credential:
153
+
154
+ ```sh
155
+ agent-secrets NAME --reason '…' -- sh -c '
156
+ token=$(printf %s "$NAME" | jq -er ".path.to.token" 2>/dev/null) || { echo "no token at .path.to.token" >&2; exit 1; }
157
+ curl -sS -H "Authorization: Bearer $token" https://api.example.com/'
158
+ ```
159
+
160
+ For a GitHub App secret, `--github-owner <account> --github-token` hands the command that one
161
+ account's token under the secret's name, with no JSON to take apart.
162
+ - For a secret behind the airlock, every one of these reads the placeholder and not the value.
140
163
  - Compare two values only as equal or not equal. Never print, slice or diff their characters.
141
164
 
142
165
  ## Read the answer, not the status alone
@@ -104,7 +104,7 @@ Every topic starts with `notifications.`.
104
104
  Envoy also subscribes you to the lifecycle subject `pr.<n>`, which NATS `>` alone does not match, because `>` needs one or more trailing tokens.
105
105
 
106
106
  - Read the `warnings` that `envoy_subscribe` returns, and confirm the active topics with `envoy_list`.
107
- A warning names the spelling Envoy publishes, or a token that is not a GitHub topic kind; fix the topic it names.
107
+ A warning names the spelling Envoy publishes, a token that is not a GitHub topic kind, or a pull request's bare subject `pr.<n>` that no topic of yours extends to its reviews; fix the topic it names.
108
108
  "No GitHub event ... in the stream's retention window" means nothing came from that repository in the last 72 hours:
109
109
  check that the GitHub App that sends Envoy its webhooks is installed on that repository before you rely on a wake.
110
110
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-envoy",
3
- "version": "17.31.2",
3
+ "version": "17.31.3",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "omp": {