instar 1.3.2011 → 1.3.2013
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/commands/server.d.ts.map +1 -1
- package/dist/commands/server.js +19 -3
- package/dist/commands/server.js.map +1 -1
- package/dist/data/standards-guard-index.json +1 -1
- package/dist/data/standards-guard-index.meta.json +2 -2
- package/dist/data/standards-registry.meta.json +1 -1
- package/dist/native/InstarWedgeCanary.app/Contents/MacOS/InstarWedgeCanary +0 -0
- package/dist/native/instar-desktop-host +0 -0
- package/package.json +1 -1
- package/playbook-scripts/playbook-hmac.py +28 -5
- package/src/data/builtin-manifest.json +3 -3
- package/src/data/standards-guard-index.json +1 -1
- package/src/data/standards-guard-index.meta.json +2 -2
- package/src/data/standards-registry.meta.json +1 -1
- package/upgrades/1.3.2012.md +22 -0
- package/upgrades/1.3.2013.md +23 -0
- package/upgrades/side-effects/sec171-playbook-hmac-stdin.md +26 -0
- package/upgrades/side-effects/whatsapp-typed-path-tags.md +29 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"generatedFrom": "source-tree",
|
|
4
4
|
"registrySha256": "11e2a45ab1345e2ded6499404ee9962e4e48bcfed4677a4d31dac4492565d2fa",
|
|
5
|
-
"packageVersion": "1.3.
|
|
5
|
+
"packageVersion": "1.3.2013",
|
|
6
6
|
"guards": [
|
|
7
7
|
{
|
|
8
8
|
"ref": "docs/audits/phase-b/f10-triage.md",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"sha256": "
|
|
2
|
+
"sha256": "4a8d19e0f9284988042d65a60642f58f9b938e03f8f71600d900b1c803f47334",
|
|
3
3
|
"registrySha256": "11e2a45ab1345e2ded6499404ee9962e4e48bcfed4677a4d31dac4492565d2fa",
|
|
4
|
-
"packageVersion": "1.3.
|
|
4
|
+
"packageVersion": "1.3.2013"
|
|
5
5
|
}
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -88,14 +88,37 @@ def get_key(version=None):
|
|
|
88
88
|
return bytes.fromhex(stdout)
|
|
89
89
|
|
|
90
90
|
|
|
91
|
+
# `security -i` reads at most 4096 bytes per line. A longer line is not refused: it is split, the first part
|
|
92
|
+
# runs as its own command and stores a truncated item, and only the rest fails (measured on macOS, SEC-155).
|
|
93
|
+
KEYCHAIN_STDIN_MAX_LINE = 4096
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def _keychain_add_line(service, account, secret):
|
|
97
|
+
"""The one `security -i` input line that adds the key, never trusting any app (-T "").
|
|
98
|
+
|
|
99
|
+
SEC-171: the key goes on standard input, hex-encoded behind -X (the same bytes -w stored), never in the
|
|
100
|
+
process arguments, which `ps` shows to every account on the Mac.
|
|
101
|
+
"""
|
|
102
|
+
for name in (service, account):
|
|
103
|
+
if not name or any(c in name for c in '"\\$`') or any(ord(c) < 32 or ord(c) == 127 for c in name):
|
|
104
|
+
raise ValueError("keychain name cannot be passed safely")
|
|
105
|
+
line = f'add-generic-password -s "{service}" -a "{account}" -X "{secret.encode("utf-8").hex()}" -T ""\n'
|
|
106
|
+
if len(line.encode("utf-8")) > KEYCHAIN_STDIN_MAX_LINE:
|
|
107
|
+
raise ValueError("key too long for a safe stdin write")
|
|
108
|
+
return line
|
|
109
|
+
|
|
110
|
+
|
|
91
111
|
def store_key(key_hex, version):
|
|
92
112
|
account = f"{KEYCHAIN_ACCOUNT_PREFIX}{version}"
|
|
93
113
|
_run_security_cmd(["delete-generic-password", "-s", KEYCHAIN_SERVICE, "-a", account])
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
114
|
+
try:
|
|
115
|
+
line = _keychain_add_line(KEYCHAIN_SERVICE, account, key_hex)
|
|
116
|
+
except ValueError as e:
|
|
117
|
+
print(f"Error storing key: {e}", file=sys.stderr)
|
|
118
|
+
sys.exit(1)
|
|
119
|
+
proc = subprocess.run(["/usr/bin/security", "-i"], input=line, capture_output=True, text=True)
|
|
120
|
+
if proc.returncode != 0:
|
|
121
|
+
print(f"Error storing key: {proc.stderr.strip()}", file=sys.stderr)
|
|
99
122
|
sys.exit(1)
|
|
100
123
|
|
|
101
124
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./builtin-manifest.schema.json",
|
|
3
3
|
"schemaVersion": 1,
|
|
4
|
-
"generatedAt": "2026-11-
|
|
5
|
-
"instarVersion": "1.3.
|
|
4
|
+
"generatedAt": "2026-11-24T20:48:01.086Z",
|
|
5
|
+
"instarVersion": "1.3.2013",
|
|
6
6
|
"entryCount": 210,
|
|
7
7
|
"entries": {
|
|
8
8
|
"hook:session-start": {
|
|
@@ -1444,7 +1444,7 @@
|
|
|
1444
1444
|
"type": "playbook-script",
|
|
1445
1445
|
"domain": "context",
|
|
1446
1446
|
"sourcePath": "playbook-scripts/playbook-hmac.py",
|
|
1447
|
-
"contentHash": "
|
|
1447
|
+
"contentHash": "952ba35a89e18b8bfb43241510b793d1f951372d3167434df93154a515a1634b",
|
|
1448
1448
|
"since": "2025-01-01"
|
|
1449
1449
|
},
|
|
1450
1450
|
"playbook-script:playbook-lifecycle.py": {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"generatedFrom": "source-tree",
|
|
4
4
|
"registrySha256": "11e2a45ab1345e2ded6499404ee9962e4e48bcfed4677a4d31dac4492565d2fa",
|
|
5
|
-
"packageVersion": "1.3.
|
|
5
|
+
"packageVersion": "1.3.2013",
|
|
6
6
|
"guards": [
|
|
7
7
|
{
|
|
8
8
|
"ref": "docs/audits/phase-b/f10-triage.md",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"sha256": "
|
|
2
|
+
"sha256": "4a8d19e0f9284988042d65a60642f58f9b938e03f8f71600d900b1c803f47334",
|
|
3
3
|
"registrySha256": "11e2a45ab1345e2ded6499404ee9962e4e48bcfed4677a4d31dac4492565d2fa",
|
|
4
|
-
"packageVersion": "1.3.
|
|
4
|
+
"packageVersion": "1.3.2013"
|
|
5
5
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Upgrade Guide — vNEXT
|
|
2
|
+
|
|
3
|
+
<!-- assembled-by: assemble-next-md -->
|
|
4
|
+
<!-- bump: patch -->
|
|
5
|
+
|
|
6
|
+
## What Changed
|
|
7
|
+
|
|
8
|
+
SEC-149. Telegram, Slack, iMessage and the lifeline pass person-supplied text through `escapeTypedPathTags` (`src/core/inboundMedia.ts`), so a typed `[image:/abs/path]` (or `document`, `video`, `voice`, `file`) reaches a session as inert `[typed image: ...]` instead of a live media tag the session reads as a file to open. WhatsApp did not. `wireWhatsAppRouting` (`src/commands/server.ts`) now escapes the message text where it enters, which covers injection into a live session, the bootstrap of a respawned one and a new spawn. It also removes square brackets from the sender's profile name once at entry (live injection already did), so a name like `[image:/path]` cannot become a live tag in a new session's first prompt. WhatsApp's own placeholders `[Image]`, `[Video]`, `[Sticker]` and `[Location]` are unchanged; `[Document: <name>]`, whose file name the sender chooses, now reads `[typed Document: <name>]`.
|
|
9
|
+
|
|
10
|
+
## What to Tell Your User
|
|
11
|
+
|
|
12
|
+
- **Safer WhatsApp messages**: "A WhatsApp message that just types out a file path can no longer make me open that file. Real photos and documents work as before."
|
|
13
|
+
|
|
14
|
+
## Summary of New Capabilities
|
|
15
|
+
|
|
16
|
+
| Capability | How to Use |
|
|
17
|
+
|-----------|-----------|
|
|
18
|
+
| Typed path tags in WhatsApp text made inert | Automatic |
|
|
19
|
+
|
|
20
|
+
## Evidence
|
|
21
|
+
|
|
22
|
+
- `tests/unit/whatsapp-typed-path-tags.test.ts` (new, 2): the WhatsApp routing escapes the text before any session sees it; a typed tag is made inert; WhatsApp's placeholders stay readable.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Upgrade Guide — vNEXT
|
|
2
|
+
|
|
3
|
+
<!-- assembled-by: assemble-next-md -->
|
|
4
|
+
<!-- bump: patch -->
|
|
5
|
+
|
|
6
|
+
## What Changed
|
|
7
|
+
|
|
8
|
+
SEC-171. `playbook-scripts/playbook-hmac.py` stored its HMAC signing key in the macOS keychain with `security add-generic-password ... -w <key>`. That put the key in the process arguments, which `ps` shows to every account on the Mac. It now sends the command to `security -i` on standard input, with the key hex-encoded behind `-X`. That is the approach SEC-155 used for the agent's other keychain writes. The stored bytes and the "trust no app" setting (`-T ""`) are unchanged, so reading the key works as before. A line too long for `security -i` to read whole is refused rather than split into a truncated item. A failed write still fails the command.
|
|
9
|
+
|
|
10
|
+
## What to Tell Your User
|
|
11
|
+
|
|
12
|
+
- **Signing key kept private**: "The key I use to sign my playbook no longer shows up in the list of running programs when I save it."
|
|
13
|
+
|
|
14
|
+
## Summary of New Capabilities
|
|
15
|
+
|
|
16
|
+
| Capability | How to Use |
|
|
17
|
+
|-----------|-----------|
|
|
18
|
+
| Playbook key stored via standard input | Automatic |
|
|
19
|
+
|
|
20
|
+
## Evidence
|
|
21
|
+
|
|
22
|
+
- `tests/unit/sec171-playbook-hmac-stdin.test.ts`: the real `store_key` runs with `subprocess.run` replaced by a recorder. The add goes to `security -i` with the exact stdin line and the key never appears as an argument. A failed write exits 1. An over-long line is refused before any add. Unsafe names are refused.
|
|
23
|
+
- A live run on a Mac with an unused key version stored the item and then deleted it.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Side effects: playbook-hmac.py stores its key via `security -i` standard input (SEC-171)
|
|
2
|
+
|
|
3
|
+
In plain words: `store_key` passed the playbook HMAC key as `-w <key>`, so it sat in process arguments that `ps` shows to every account on the Mac. It now goes on standard input to `security -i`, hex-encoded behind `-X`, the approach SEC-155 used for the agent's other keychain writes.
|
|
4
|
+
|
|
5
|
+
Tier 1 by size, security-sensitive: an independent second-pass review is attached below. Size: one function in `playbook-scripts/playbook-hmac.py` plus a new helper, and 1 new unit test file.
|
|
6
|
+
|
|
7
|
+
## What changes for running agents
|
|
8
|
+
- **`store_key`** still deletes the old item first. It then builds `add-generic-password -s "playbook-hmac" -a "playbook-hmac-v<N>" -X "<hex of the key text>" -T ""` with `_keychain_add_line` and runs `/usr/bin/security -i` with that line as input. The stored bytes are the key's hex text, exactly what `-w` stored, so `get_key()` (`find-generic-password -w`) reads the same value. `-T ""` (no app trusted) is unchanged, and a live probe confirmed `security -i` accepts it.
|
|
9
|
+
- **Guards.** A line over 4096 bytes is refused before any add, because `security -i` splits a longer line and stores a truncated item (measured for SEC-155). A real key is 64 hex characters, giving a line of about 200 bytes. Names containing a quote, backslash, `$`, backtick or control character are refused, though the service and account names are fixed.
|
|
10
|
+
- **Failure.** A non-zero exit still prints `Error storing key` and exits 1, as before.
|
|
11
|
+
|
|
12
|
+
## Signal vs authority
|
|
13
|
+
Not applicable: this changes how a key reaches the keychain, not who may act.
|
|
14
|
+
|
|
15
|
+
## Second-pass review
|
|
16
|
+
**Reviewer:** independent Claude Sonnet subagent (fresh context, read-only, given the finding and the diff), 2026-11-22. Verdict: CONCUR. No argument secret remains in `playbook-scripts`; the only `-w` left is the read in `get_key()`. Byte parity holds, so `bytes.fromhex` still works. The blocked characters and the produced line match the test exactly. Failure behavior is preserved. It ran the 4 tests and all pass. The harness uses only the standard library and never touches a keychain.
|
|
17
|
+
|
|
18
|
+
## Rollback
|
|
19
|
+
Revert the commit. Stored items are unchanged.
|
|
20
|
+
|
|
21
|
+
## Tests
|
|
22
|
+
- `tests/unit/sec171-playbook-hmac-stdin.test.ts` (new, 4 cases): the real module runs in an isolated Python with `subprocess.run` replaced by a recorder. The delete and then `security -i` are called with the exact input line and the key never appears as an argument. A failed write exits 1. An over-long key is refused before any add. Unsafe names are refused. It passes here.
|
|
23
|
+
- Live on this Mac: `store_key` with an unused version (999) stored the item, which was found and then deleted.
|
|
24
|
+
|
|
25
|
+
## Class-Closure Declaration
|
|
26
|
+
- `unbounded-self-action`: closure n/a. The same single keychain write per call.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Side effects: WhatsApp text gets typed path-tag escaping (SEC-149)
|
|
2
|
+
|
|
3
|
+
In plain words: a typed file-path tag in a WhatsApp message is shown to the session as ordinary text, as on the other channels.
|
|
4
|
+
|
|
5
|
+
Tier 1. Size: 1 source file (`src/commands/server.ts`, `wireWhatsAppRouting`), 1 new test file.
|
|
6
|
+
|
|
7
|
+
## What changes
|
|
8
|
+
- `const text = escapeTypedPathTags(msg.content)` at the start of the WhatsApp handler; every later use (injection, respawn bootstrap, spawn) reads the escaped text.
|
|
9
|
+
- WhatsApp backends never deliver real media as a path tag (Baileys builds `[Image]`, `[Video]`, `[Document: <name>]`, `[Sticker]`, `[Location]`; the Business API forwards only text and captions), so nothing real is lost. The document placeholder becomes `[typed Document: <name>]`, which is correct: its name is sender-chosen.
|
|
10
|
+
- The function is idempotent, so text already escaped elsewhere is unchanged.
|
|
11
|
+
- The sender's profile name is cleaned once at entry (square brackets removed), so the new-spawn bootstrap, which used it raw, matches live injection.
|
|
12
|
+
- Not changed: iMessage sender names, and `MessageBridge`'s copy of WhatsApp text into a Telegram topic (traced only partly by the reviewer); both belong with the injection-hygiene work.
|
|
13
|
+
|
|
14
|
+
## Signal vs authority
|
|
15
|
+
Escapes untrusted text; refuses nothing.
|
|
16
|
+
|
|
17
|
+
## Rollback
|
|
18
|
+
Revert the commit.
|
|
19
|
+
|
|
20
|
+
## Tests
|
|
21
|
+
- `whatsapp-typed-path-tags` (new, 2): pass.
|
|
22
|
+
|
|
23
|
+
## Second-pass review
|
|
24
|
+
|
|
25
|
+
**Reviewer:** independent Claude reviewer subagent. Round 1 was blocking on one gap in the same function: the new-spawn bootstrap put the sender's profile name in raw. Fixed by cleaning the name once at entry, with a test. The text escaping itself was confirmed to reach live inject, respawn and new spawn, and nothing legitimate breaks.
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## Repair after Local Verify (2026-11-23)
|
|
29
|
+
The full run failed three cases in `tests/e2e/whatsapp-message-routing-e2e.test.ts`. Those cases read only the first 2000 characters of `wireWhatsAppRouting`, and this change's comment block pushed the calls they look for past that window. The cleanup now lives in a small helper, `whatsAppInboundText`, just above the function, and the function calls it in one line. Behaviour is unchanged, and the unit test checks the helper and the call order. The branch was also brought up to date with main.
|