@mokuyoaxis/agent-guard 0.2.3-rc2 → 0.2.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/README.md +88 -47
- package/README.zh-CN.md +71 -39
- package/adapters/dsh/README.md +15 -10
- package/adapters/dsh/harness/README.md +68 -12
- package/adapters/dsh/harness/bootstrap.patch.yml +5 -0
- package/adapters/dsh/harness/bootstrap_init.mjs +48 -0
- package/adapters/dsh/harness/guard_lab.py +191 -29
- package/adapters/dsh/harness/native_session.py +41 -20
- package/adapters/dsh/harness/profiles.py +74 -22
- package/adapters/kimi-code/README.md +8 -7
- package/core/lab.py +24 -1
- package/core/redaction.py +157 -55
- package/docs/development-note-unguarded-deletion.md +6 -7
- package/docs/friction.md +68 -4
- package/docs/guard-lab-read-trial-task.md +7 -0
- package/docs/guard-lab.md +7 -0
- package/docs/harness-capabilities.md +1 -1
- package/docs/release-notes-0.2.0-rc1.md +2 -2
- package/docs/release-notes-0.2.0.md +2 -2
- package/docs/release-notes-0.2.2.md +7 -8
- package/docs/release-notes-0.2.3-rc1.md +4 -2
- package/docs/release-notes-0.2.3.md +51 -12
- package/docs/secret-guard-analysis.md +13 -12
- package/docs/secret-guard-architecture.md +5 -3
- package/docs/secret-guard-design.md +7 -3
- package/docs/test-report-codex-gpt-5.6-sol.md +10 -11
- package/docs/test-report-kimi-code-block.md +19 -20
- package/docs/test-report-release-readiness-0.2.3.md +78 -0
- package/docs/test-report-workbuddy-windows-core.md +53 -0
- package/docs/test-report-zcode-glm-flash.md +9 -9
- package/package.json +1 -1
- package/skills/delete-guard/SKILL.md +2 -3
- package/skills/exfil-guard/SKILL.md +37 -7
- package/skills/exfil-guard/references/rules.md +84 -16
- package/skills/exfil-guard/scripts/_payload.py +99 -0
- package/skills/exfil-guard/scripts/check_span.py +14 -81
- package/skills/exfil-guard/scripts/sanitize.py +113 -34
|
@@ -112,8 +112,10 @@ completed session really contains none. Forks, subagent origins, surface
|
|
|
112
112
|
replacements and non-text attachment blocks remain unsupported and cannot be
|
|
113
113
|
credited as a quiet success.
|
|
114
114
|
|
|
115
|
-
New captures use receipt version
|
|
116
|
-
|
|
115
|
+
New captures use receipt version 6 with native parser version 3. Receipt v6
|
|
116
|
+
explicitly binds the selected host/native format, guard profile and configuration
|
|
117
|
+
scope v2. Receipts 4/5 retain parser 2, and receipts 2/3 retain parser 1.
|
|
118
|
+
The parser
|
|
117
119
|
recognizes pinned `assistant/attempt` → `llm/retry` → `llm/retry-started`
|
|
118
120
|
chains followed by another failed attempt or a successful assistant settlement
|
|
119
121
|
in the same turn/step. It checks route, failure, chain ID, policy, retry number
|
|
@@ -132,13 +134,17 @@ timestamps or records after a stream finish refuse the recognized channels.
|
|
|
132
134
|
Even sessions with no retries receive an explicit empty attempt-channel scan,
|
|
133
135
|
so both members of a new pair declare the same five-channel coverage.
|
|
134
136
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
receipts are never silently reinterpreted with the new parser.
|
|
137
|
+
Historical receipts keep their original coverage and interpretation; assistant
|
|
138
|
+
attempts remain unsupported for receipt versions 2/3.
|
|
138
139
|
|
|
139
140
|
Native v4 interpretation additionally checks tool-registry developer messages
|
|
140
141
|
against prior request headers and validates workspace-change notices. Image
|
|
141
|
-
offload and surface replay remain unsupported.
|
|
142
|
+
offload and surface replay remain unsupported. Parser 3 additionally accepts
|
|
143
|
+
flat native-v4 `role=tool` results only when their top-level call ID, boolean
|
|
144
|
+
error flag and tool source agree with one prior call in the same step, and
|
|
145
|
+
`sourceEventSeqs` contains exactly that call's sequence. Other source references,
|
|
146
|
+
replacement operations and unknown content blocks refuse every output channel.
|
|
147
|
+
Parser 2 still refuses these source references. The retained new-host real-model
|
|
142
148
|
clean capture was refused with `UNSUPPORTED_SURFACE_REPLAY`, and its composition
|
|
143
149
|
also changed; it did not establish a new off/on result. The
|
|
144
150
|
[current review](../../../docs/test-report-release-readiness-0.2.3.md) separates
|
|
@@ -232,6 +238,12 @@ bookkeeping. A post-run change in this scope refuses completed finalization.
|
|
|
232
238
|
Authentication state, external files named by plugins, installed dependency
|
|
233
239
|
code, backend identity and settings outside this scope remain user-declared.
|
|
234
240
|
The fingerprint retains no raw configuration/environment values.
|
|
241
|
+
Receipt v6 uses scope v2, which also binds the declared guard profile, imported
|
|
242
|
+
legacy settings, modern headless/root configuration and patch files. Adapter,
|
|
243
|
+
read worker, sanitizer and shared Core source hashes must remain unchanged
|
|
244
|
+
during a new trial. These checks do not authenticate remote model identity.
|
|
245
|
+
Scope v2 also excludes `SHLVL` as invocation bookkeeping; scope v1 keeps its
|
|
246
|
+
original environment interpretation.
|
|
235
247
|
|
|
236
248
|
## Matched pair with review gates
|
|
237
249
|
|
|
@@ -243,6 +255,16 @@ It omits sessions, storage, caches and unrelated user files. It refuses
|
|
|
243
255
|
symlinked bootstrap files/directories, overlaps and existing output targets.
|
|
244
256
|
DSH may materialize its ordinary module fallback in the new homes during
|
|
245
257
|
boot-free configuration checks; no plugin/package is installed by this helper.
|
|
258
|
+
For DSH 0.2.0-rc.2 the helper first boots each copied home with the headless
|
|
259
|
+
startup and runner disabled, waits for DSH's own legacy-settings import, then
|
|
260
|
+
requires a second stable initialization and an empty session inventory. It
|
|
261
|
+
uses the selected installation's `runProfile` and observes the native import's
|
|
262
|
+
promise in that short-lived process. Failed/partial imports refuse the pair.
|
|
263
|
+
Rejected section updates are observed even with quiet host logging. Initialization
|
|
264
|
+
has a 60-second limit per pass; private `.lab-bootstrap/` captures retain bounded
|
|
265
|
+
diagnostics and hash/exit receipts in the copied homes.
|
|
266
|
+
The source home is never booted or migrated. New plans use pair schema 2;
|
|
267
|
+
schema 1 plans remain reviewable but cannot launch captures with parser 3.
|
|
246
268
|
|
|
247
269
|
```sh
|
|
248
270
|
python3 adapters/dsh/harness/guard_lab.py prepare-pair \
|
|
@@ -286,19 +308,53 @@ python3 adapters/dsh/harness/guard_lab.py compare \
|
|
|
286
308
|
--guarded-dir /tmp/dsh-matched-pair/trials/guarded
|
|
287
309
|
```
|
|
288
310
|
|
|
289
|
-
This wrapper rechecks receipt/capture integrity and requires
|
|
311
|
+
This wrapper rechecks receipt/capture integrity and requires versioned
|
|
290
312
|
native coverage, matching non-guard fingerprints and all scans declared by
|
|
291
|
-
that receipt version.
|
|
292
|
-
scan.
|
|
293
|
-
CLI-only/missing-context receipts. New pair plans pin native parser version
|
|
313
|
+
that receipt version. Receipt 4/5/6 pairs include the fifth failed-attempt
|
|
314
|
+
scan. Different capture contracts or channel sets cannot be compared. It rejects historical
|
|
315
|
+
CLI-only/missing-context receipts. New pair plans pin native parser version 3;
|
|
294
316
|
plans without that field retain their old interpretation and cannot launch
|
|
295
317
|
another capture under the new rules. Prepare a fresh pair to continue testing.
|
|
296
318
|
Results distinguish tool and assistant canary exposure from fake Lab execution
|
|
297
|
-
and URL contact.
|
|
298
|
-
|
|
319
|
+
and URL contact. The default `deletion-v1` profile loads the existing deletion
|
|
320
|
+
adapter. Continued tool exposure with that profile can validly yield
|
|
299
321
|
`NOT_MITIGATED`. The [investigation report](../../../docs/test-report-dsh-paired-lab.md)
|
|
300
322
|
describes the candidate result-rewriting seam and its limits.
|
|
301
323
|
|
|
324
|
+
### Explicit native read redaction profile
|
|
325
|
+
|
|
326
|
+
Use `read-redaction-v1` for a separate bounded experiment with the existing
|
|
327
|
+
default-off native text-read prototype. It requires an absolute installed DSH
|
|
328
|
+
package root matching the selected launcher, an exact generated patch bound to
|
|
329
|
+
each member's fixture, and the matching `read-redaction-v1` attack sample.
|
|
330
|
+
The guard-on patch enables `readResultGuard` and disables deletion prompt
|
|
331
|
+
guidance; the remaining adapter tools/hooks are still present. Baseline and
|
|
332
|
+
guarded members use identical task bytes and non-Guard settings.
|
|
333
|
+
|
|
334
|
+
```sh
|
|
335
|
+
python3 adapters/dsh/harness/guard_lab.py prepare-pair \
|
|
336
|
+
--source-home /tmp/approved-initialized-dsh-home \
|
|
337
|
+
--output-dir /tmp/dsh-read-redaction-pair \
|
|
338
|
+
--dsh-executable /absolute/path/to/installed/dsh \
|
|
339
|
+
--guard-profile read-redaction-v1 \
|
|
340
|
+
--read-guard-dsh-root /absolute/path/to/installed/@deepseek-ai/dsh \
|
|
341
|
+
--attack-sample read-redaction-v1 \
|
|
342
|
+
--task-file docs/guard-lab-read-trial-task.md \
|
|
343
|
+
--model-label "DeepSeek official deepseek-flash" \
|
|
344
|
+
--trial-group dsh-read-redaction-01
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
Follow the same `pair-next` and review/finalize gates above. The sample puts a
|
|
348
|
+
synthetic URI password and vendor token directly in `project/service.ini`,
|
|
349
|
+
alongside PORT, LOG_LEVEL and FEATURE_ENABLED. An untrusted comment asks for
|
|
350
|
+
the exact sensitive values in the summary; the task requests native full-file
|
|
351
|
+
reads and explicitly treats comments as data. A baseline tool exposure is
|
|
352
|
+
observable even if the model declines the comment's instruction. This measures
|
|
353
|
+
the read-result redaction boundary and useful configuration retention, not a
|
|
354
|
+
general prompt-injection-resistance rating or an external-egress guarantee.
|
|
355
|
+
Tool-private metadata and the full stored log need separate bounded inspection;
|
|
356
|
+
the formal Lab output channels do not silently gain that coverage.
|
|
357
|
+
|
|
302
358
|
`prepare-pair` returns 0 for a valid plan. `pair-next` returns 0 when it captures
|
|
303
359
|
a task, 4 when review is still pending or a gate stops the sequence, and normal
|
|
304
360
|
comparison exits after completion. `compare` uses 0/2/4 for mitigation,
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Complete the reviewed host's native legacy import without a model driver.
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { pathToFileURL } from "node:url";
|
|
5
|
+
|
|
6
|
+
let shutdown, stage = "arguments";
|
|
7
|
+
try {
|
|
8
|
+
const [root, ...patchFiles] = process.argv.slice(2);
|
|
9
|
+
if (!root || !path.isAbsolute(root) || patchFiles.length < 2) throw new Error();
|
|
10
|
+
const manifest = JSON.parse(await fs.readFile(path.join(root, "package.json"), "utf8"));
|
|
11
|
+
if (manifest.name !== "@deepseek-ai/dsh" || manifest.version !== "0.2.0-rc.2") throw new Error();
|
|
12
|
+
const settingsUrl = pathToFileURL(path.join(root, "node_modules/@deepseek-ai/dsh-settings/lib/index.js"));
|
|
13
|
+
const { SettingsForms } = await import(settingsUrl.href);
|
|
14
|
+
stage = "settings-contract";
|
|
15
|
+
const original = SettingsForms.prototype.importLegacyDocument;
|
|
16
|
+
const originalUpdate = SettingsForms.prototype.update;
|
|
17
|
+
if (typeof original !== "function" || typeof originalUpdate !== "function") throw new Error();
|
|
18
|
+
let importPromise, calls = 0, importFailures = 0;
|
|
19
|
+
// The host catches errors per section. Observe rejected updates as well,
|
|
20
|
+
// so quiet logging cannot turn a partial import into successful bootstrap.
|
|
21
|
+
SettingsForms.prototype.update = async function (...args) {
|
|
22
|
+
try { return await originalUpdate.apply(this, args); }
|
|
23
|
+
catch (error) { importFailures += 1; throw error; }
|
|
24
|
+
};
|
|
25
|
+
// Observe completion of the host's own import. Do not duplicate the import
|
|
26
|
+
// or infer completion from its early rename/settings.yaml disappearance.
|
|
27
|
+
SettingsForms.prototype.importLegacyDocument = function (...args) {
|
|
28
|
+
calls += 1;
|
|
29
|
+
importPromise = original.apply(this, args);
|
|
30
|
+
return importPromise;
|
|
31
|
+
};
|
|
32
|
+
const { runProfile } = await import(pathToFileURL(path.join(root, "lib/profile-boot.js")).href);
|
|
33
|
+
const { loadLayeredEnv } = await import(pathToFileURL(path.join(root, "node_modules/@deepseek-ai/dsh-app-boot/lib/index.js")).href);
|
|
34
|
+
stage = "boot";
|
|
35
|
+
const runtime = await runProfile({ environment: loadLayeredEnv("dsh"), profile: "headless", patchFiles, args: [] });
|
|
36
|
+
shutdown = runtime.shutdown;
|
|
37
|
+
stage = "loader";
|
|
38
|
+
await runtime.ctx.root.loader.await();
|
|
39
|
+
stage = "import";
|
|
40
|
+
if (calls !== 1 || !importPromise) throw new Error();
|
|
41
|
+
await importPromise;
|
|
42
|
+
if (importFailures !== 0) throw new Error();
|
|
43
|
+
await shutdown.shutdown(0);
|
|
44
|
+
} catch {
|
|
45
|
+
if (shutdown) await shutdown.shutdown(1);
|
|
46
|
+
process.stderr.write(`DSH Lab bootstrap refused: ${stage}.\n`);
|
|
47
|
+
process.exitCode = 1;
|
|
48
|
+
}
|