fix(security): W4-E1 approvals admin-session only, shared redact table, TMDB key redaction, prod mock gate
- POST /approvals and PATCH /approvals/{id} require a console admin session
(EndpointDef auth:"session"); API keys incl. admin scope get 403, so an
organize.execute key can no longer approve its own plan (S1)
- tests for single-use approval checks: expired, revision/payload hash
mismatch, consumed, revoked, pending/rejected, plan mismatch; re-approve
after plan change succeeds once and cannot be replayed (S4)
- one redact key table in @umt/contracts shared by server logger and agent
redactForModel: rsskey, torrent_pass, authkey, downhash, c_secure_pass,
passkey variants, x-api-key, cookie headers, nested objects/arrays (S2)
- TMDB network errors: message and cause redacted via redactUrl (S3)
- web Agent ?mock=1 only in DEV builds or when pi.provider is fake (S7)
- EndpointDef auth annotations for /auth/*, asserted against
PUBLIC_AUTH_PATHS (S10); doc drift fixes (S11)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
79cdd26457
commit
f48e1aac96
25 files changed
+825
-235
No files matched your search
@@ -74,3 +74,25 @@ describe("buildSystemPrompt", () => {
|
||||
expect(p).toContain("- 只给方案,不执行");
|
||||
});
|
||||
});
|
||||
|
||||
describe("redactForModel:站点凭证键全集(与服务端 logger 同一键表)", () => {
|
||||
it("rsskey / torrent_pass / authkey / downhash / c_secure_pass / passkey 变体 / x-api-key / cookie", () => {
|
||||
const input = {
|
||||
rsskey: "S1",
|
||||
torrent_pass: "S2",
|
||||
authKey: "S3",
|
||||
downhash: "S4",
|
||||
c_secure_pass: "S5",
|
||||
"Pass-Key": "S6",
|
||||
"x-api-key": "S7",
|
||||
Cookie: "S8",
|
||||
nested: [{ pass_key: "S9" }],
|
||||
url: "https://x/rss?rsskey=S10&torrent_pass=S11&authkey=S12&downhash=S13&c_secure_pass=S14&PassKey=S15",
|
||||
usage: { totalTokens: 10 },
|
||||
};
|
||||
const out = JSON.stringify(redactForModel(input));
|
||||
expect(out).not.toMatch(/S\d+"/);
|
||||
expect(out).not.toMatch(/=S\d+/);
|
||||
expect(out).toContain('"totalTokens":10');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user