aegisone 1.0.23 → 1.0.25
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 +2 -2
- package/package.json +1 -4
- package/scripts/predist.mjs +1 -1
- package/src/permissions.js +1 -1
- package/vendor/cli/bin/aegiscode.js +915 -2
- package/vendor/cli/package.json +1 -6
- package/vendor/cli/src/app.js +1 -1
- package/vendor/cli/src/autonomous.js +515 -1
- package/vendor/cli/src/caps.js +879 -1
- package/vendor/cli/src/chatflow.js +1 -1
- package/vendor/cli/src/commands.js +1 -1
- package/vendor/cli/src/engine.js +1 -1
- package/vendor/cli/src/gate.js +55 -1
- package/vendor/cli/src/history.js +1 -1
- package/vendor/cli/src/limits.js +190 -1
- package/vendor/cli/src/mcp.js +694 -1
- package/vendor/cli/src/models.js +1 -1
- package/vendor/cli/src/overlays.js +1 -1
- package/vendor/cli/src/permissions.js +290 -1
- package/vendor/cli/src/provenance.js +182 -2
- package/vendor/cli/src/provenance.lock.json +2 -2
- package/vendor/cli/vendor/client/aegis.js +1 -1
- package/vendor/cli/vendor/client/attest.js +1 -1
- package/vendor/cli/vendor/client/byok-catalog.js +1 -1
- package/vendor/cli/vendor/client/catalog-client.js +3 -0
- package/vendor/cli/vendor/client/conversation-export.js +3 -0
- package/vendor/cli/vendor/client/drive-upload.js +1 -1
- package/vendor/cli/vendor/client/session-store.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/attachments.js +3 -0
- package/vendor/cli/vendor/desktop/lib/local/claude-pro.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/context.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/engine.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/exec-plan.js +3 -0
- package/vendor/cli/vendor/desktop/lib/local/local.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/prompt.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/session-rounds.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/shell.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/spill.js +3 -0
- package/vendor/cli/vendor/desktop/lib/local/tools.js +1 -1
- package/vendor/cli/vendor/one/src/permissions.js +1 -1
- package/vendor/desktop/lib/auto.js +1 -1
- package/vendor/desktop/lib/google-connect.js +1 -1
- package/vendor/desktop/lib/local/attachments.js +3 -0
- package/vendor/desktop/lib/local/claude-pro.js +1 -1
- package/vendor/desktop/lib/local/context.js +1 -1
- package/vendor/desktop/lib/local/engine.js +1 -1
- package/vendor/desktop/lib/local/exec-plan.js +3 -0
- package/vendor/desktop/lib/local/local.js +1 -1
- package/vendor/desktop/lib/local/prompt.js +1 -1
- package/vendor/desktop/lib/local/session-rounds.js +1 -1
- package/vendor/desktop/lib/local/shell.js +1 -1
- package/vendor/desktop/lib/local/spill.js +3 -0
- package/vendor/desktop/lib/local/tools.js +1 -1
- package/vendor/desktop/main.js +1 -1
- package/vendor/desktop/package.json +3 -5
- package/vendor/desktop/preload.js +1 -1
- package/vendor/desktop/renderer/app.js +1 -1
- package/vendor/desktop/renderer/budget.js +1 -1
- package/vendor/desktop/renderer/fingerprint.js +2 -2
- package/vendor/desktop/renderer/index.html +44 -4
- package/vendor/desktop/renderer/quick.html +4 -1
- package/vendor/desktop/renderer/quick.js +1 -1
- package/vendor/desktop/renderer/stream-policy.js +1 -1
- package/vendor/desktop/renderer/style.css +124 -0
- package/vendor/desktop/vendor/aegis.js +1 -1
- package/vendor/desktop/vendor/attest.js +1 -1
- package/vendor/desktop/vendor/byok-catalog.js +1 -1
- package/vendor/desktop/vendor/catalog-client.js +3 -0
- package/vendor/desktop/vendor/conversation-export.js +3 -0
- package/vendor/desktop/vendor/drive-upload.js +1 -1
- package/vendor/desktop/vendor/session-store.js +1 -1
package/vendor/cli/src/limits.js
CHANGED
|
@@ -1,3 +1,192 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* limits — the second gate. This is the one that does not explain itself.
|
|
10
|
+
*
|
|
11
|
+
* `src/provenance.js` is the gate that speaks: it compares this install to a
|
|
12
|
+
* manifest and tells you, by name, when the two disagree. Anyone assembling a
|
|
13
|
+
* modified build reads that output once and knows exactly which file to edit
|
|
14
|
+
* next. Speaking is the defect.
|
|
15
|
+
*
|
|
16
|
+
* This module is the same question asked with nothing to read. It derives a
|
|
17
|
+
* single digest from the safety files *as one closed set* — changing any one of
|
|
18
|
+
* them changes the whole — and compares that to a value sealed into this file.
|
|
19
|
+
* When it does not match:
|
|
20
|
+
*
|
|
21
|
+
* - it prints one bland line naming no file, no category and no remedy, and
|
|
22
|
+
* - it refuses the privileged subcommands outright (`gate`, `provenance`,
|
|
23
|
+
* `mcp`), so the gate's own key management is unavailable to the build that
|
|
24
|
+
* failed the check, and
|
|
25
|
+
* - it marks the process `AEGIS_REDUCED_MODE=1` for modules that opt in.
|
|
26
|
+
*
|
|
27
|
+
* Nothing in the package maps ids back to paths. The paths here are base64 and
|
|
28
|
+
* the sealed digest is XORed with a derived pad. That is obfuscation, not
|
|
29
|
+
* cryptography, and this file does not pretend otherwise: whoever holds the
|
|
30
|
+
* bytes can read it. The cost being raised is the cost of *noticing* — there is
|
|
31
|
+
* no runtime switch to disable it, no manifest telling you what is covered, and
|
|
32
|
+
* no self-describing failure to imitate. The map lives only in
|
|
33
|
+
* `tools/provenance.mjs`, which is a development tool and is not what ships.
|
|
34
|
+
*
|
|
35
|
+
* ## Why `armed()` exists, and why it is called from four files
|
|
36
|
+
*
|
|
37
|
+
* A check that is invoked from exactly one place is removed by deleting one
|
|
38
|
+
* line, and the entry point that invoked it is the file a manipulator is
|
|
39
|
+
* already editing. So the question is not asked only from `bin/aegiscode.js`:
|
|
40
|
+
* every module that OWNS one of the privileges this set protects asks it for
|
|
41
|
+
* itself — `gate.js` before it loads the gate, `mcp.js` before it touches a
|
|
42
|
+
* host's configuration, `autonomous.js` before it runs a queue with nobody
|
|
43
|
+
* watching, `permissions.js` before it resolves a skip. Deleting the call from
|
|
44
|
+
* the entry point stops the earliest refusal and leaves four behind, each of
|
|
45
|
+
* which lives in a file the digest above covers — so silencing them is not one
|
|
46
|
+
* edit but five, across five files, any one of which the other four notice.
|
|
47
|
+
*
|
|
48
|
+
* That is a real cost imposed on a careless patch and no obstacle at all to a
|
|
49
|
+
* deliberate one, and the difference is stated here rather than implied.
|
|
50
|
+
*
|
|
51
|
+
* A tree that is mid-edit trips this on purpose. Re-sealing is deliberate and
|
|
52
|
+
* manual: `node tools/provenance.mjs seal --write`. There is no environment
|
|
53
|
+
* variable that turns this off, because a gate with a documented off switch is
|
|
54
|
+
* a gate the manipulator reads about in the same file as the gate.
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
const { createHash } = require('node:crypto');
|
|
58
|
+
const { existsSync, readFileSync } = require('node:fs');
|
|
59
|
+
const path = require('node:path');
|
|
60
|
+
|
|
61
|
+
const PACKAGE_ROOT = path.join(__dirname, '..');
|
|
62
|
+
|
|
63
|
+
/** Domain separator, so this digest cannot be confused with the manifest's. */
|
|
64
|
+
const SALT = 'aegiscode-interlock-v1';
|
|
65
|
+
/** Pad derivation, so the sealed value is not a plain digest of the set. */
|
|
66
|
+
const PAD = 'aegis-interlock-pad-v1';
|
|
67
|
+
|
|
68
|
+
const sha256 = (data) => createHash('sha256').update(data).digest('hex');
|
|
69
|
+
const PAD_HEX = sha256(PAD);
|
|
70
|
+
|
|
71
|
+
/** Nibble-wise XOR against the derived pad; self-inverse. */
|
|
72
|
+
function unmask(sealed) {
|
|
73
|
+
let out = '';
|
|
74
|
+
for (let i = 0; i < sealed.length; i++) {
|
|
75
|
+
const a = parseInt(sealed[i], 16);
|
|
76
|
+
const b = parseInt(PAD_HEX[i % PAD_HEX.length], 16);
|
|
77
|
+
if (Number.isNaN(a) || Number.isNaN(b)) return null;
|
|
78
|
+
out += (a ^ b).toString(16);
|
|
79
|
+
}
|
|
80
|
+
return out;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The sealed set, base64 so a `cat` of this file is not a table of contents.
|
|
85
|
+
* Order is part of the digest: reordering is as detectable as editing.
|
|
86
|
+
* This file is deliberately NOT in its own set — the seal lives here, so
|
|
87
|
+
* including it would make the digest self-referential and unstable. It is
|
|
88
|
+
* covered by the published manifest instead (see src/provenance.js).
|
|
89
|
+
*/
|
|
90
|
+
const UNITS = Object.freeze([
|
|
91
|
+
{ id: 'p1', rel: Buffer.from('YmluL2FlZ2lzY29kZS5qcw==', 'base64').toString('utf8') },
|
|
92
|
+
{ id: 'p2', rel: Buffer.from('c3JjL3Byb3ZlbmFuY2UuanM=', 'base64').toString('utf8') },
|
|
93
|
+
{ id: 'p3', rel: Buffer.from('c3JjL2dhdGUuanM=', 'base64').toString('utf8') },
|
|
94
|
+
{ id: 'p4', rel: Buffer.from('c3JjL3Blcm1pc3Npb25zLmpz', 'base64').toString('utf8') },
|
|
95
|
+
{ id: 'p5', rel: Buffer.from('c3JjL2NhcHMuanM=', 'base64').toString('utf8') },
|
|
96
|
+
{ id: 'p6', rel: Buffer.from('c3JjL2F1dG9ub21vdXMuanM=', 'base64').toString('utf8') },
|
|
97
|
+
{ id: 'p8', rel: Buffer.from('c3JjL21jcC5qcw==', 'base64').toString('utf8') },
|
|
98
|
+
]);
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The masked digest of the sealed set. Rewritten ONLY by
|
|
102
|
+
* `node tools/provenance.mjs seal --write`, never by hand.
|
|
103
|
+
*/
|
|
104
|
+
const SEALED = 'fb13ddc9265efccef276c50f41117d00560dbc3f2ad7edc32c5daf1e59266b0f';
|
|
105
|
+
|
|
106
|
+
/** Subcommands that a build failing this check does not get to run. */
|
|
107
|
+
const PRIVILEGED = Object.freeze(['gate', 'provenance', 'mcp']);
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Ask the question. Never throws — a check that can break the program it is
|
|
111
|
+
* checking is a check an attacker would rather have present.
|
|
112
|
+
*
|
|
113
|
+
* @returns {{ tripped: boolean, code: string|null, units: number }}
|
|
114
|
+
*/
|
|
115
|
+
function check() {
|
|
116
|
+
const parts = [];
|
|
117
|
+
for (const unit of UNITS) {
|
|
118
|
+
const abs = path.join(PACKAGE_ROOT, unit.rel);
|
|
119
|
+
if (!existsSync(abs)) return { tripped: true, code: 'p1', units: UNITS.length };
|
|
120
|
+
try {
|
|
121
|
+
parts.push(sha256(readFileSync(abs)));
|
|
122
|
+
} catch {
|
|
123
|
+
return { tripped: true, code: 'p1', units: UNITS.length };
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const combined = sha256(`${SALT}\n${parts.join('\n')}`);
|
|
127
|
+
const sealed = typeof SEALED === 'string' ? SEALED.trim() : '';
|
|
128
|
+
if (sealed.length !== 64) return { tripped: true, code: 'p2', units: UNITS.length };
|
|
129
|
+
const expected = unmask(sealed);
|
|
130
|
+
if (expected !== combined) return { tripped: true, code: 'p3', units: UNITS.length };
|
|
131
|
+
return { tripped: false, code: null, units: UNITS.length };
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** The only sentence a failing build says about itself. Blunt, not a manual. */
|
|
135
|
+
function line(state) {
|
|
136
|
+
if (!state || !state.tripped) return null;
|
|
137
|
+
return `aegiscode: reduced mode (${state.code}) — this build is not the one that was published.\n`;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Ask once, remember the answer, and print the one bland line on the way.
|
|
142
|
+
*
|
|
143
|
+
* This is the entry point the modules that OWN a privilege call for themselves
|
|
144
|
+
* (see the header): `gate.js`, `mcp.js`, `autonomous.js`, `permissions.js`. It
|
|
145
|
+
* exists so the question is asked at each privilege rather than only once, at
|
|
146
|
+
* the top, in the file a manipulator is already editing.
|
|
147
|
+
*
|
|
148
|
+
* The answer is memoised for one process, and only so that four callers produce
|
|
149
|
+
* one sentence instead of four. It is NOT a cache an attacker can prime: the
|
|
150
|
+
* first caller computes it from the bytes on disk, and every later caller gets
|
|
151
|
+
* that verdict.
|
|
152
|
+
*
|
|
153
|
+
* It cannot throw — a gate that can break the program it guards is a gate an
|
|
154
|
+
* attacker would rather have present (see `check`).
|
|
155
|
+
*
|
|
156
|
+
* @returns {boolean} true when this build is not the published one.
|
|
157
|
+
*/
|
|
158
|
+
let ARMED = null;
|
|
159
|
+
function armed() {
|
|
160
|
+
if (ARMED !== null) return ARMED;
|
|
161
|
+
let state;
|
|
162
|
+
try {
|
|
163
|
+
state = check();
|
|
164
|
+
} catch {
|
|
165
|
+
state = { tripped: true, code: 'p2', units: UNITS.length };
|
|
166
|
+
}
|
|
167
|
+
ARMED = Boolean(state.tripped);
|
|
168
|
+
if (ARMED) {
|
|
169
|
+
// The mark is the mechanism; the line is only its announcement.
|
|
170
|
+
process.env.AEGIS_REDUCED_MODE = '1';
|
|
171
|
+
const said = line(state);
|
|
172
|
+
if (said) process.stderr.write(said);
|
|
173
|
+
}
|
|
174
|
+
return ARMED;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function isPrivileged(command) {
|
|
178
|
+
return PRIVILEGED.includes(command);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** A refused subcommand exits non-zero and says nothing further. */
|
|
182
|
+
function refuse() {
|
|
183
|
+
return 1;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** The seal writer's half of the contract; the tool owns the mapping. */
|
|
187
|
+
function sealOf(files) {
|
|
188
|
+
const parts = files.map((abs) => sha256(readFileSync(abs)));
|
|
189
|
+
return sha256(`${SALT}\n${parts.join('\n')}`);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
module.exports = { UNITS, PRIVILEGED, SALT, PAD, check, armed, line, isPrivileged, refuse, sealOf, mask: (hex) => unmask(hex) };
|