total-recall-brain 3.30.2 → 3.31.2
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/bin/total-recall.mjs +2 -1
- package/frontend/dist/assets/index-BUEZPLim.js +5742 -0
- package/frontend/dist/assets/index-FOJG4jQh.js +5742 -0
- package/frontend/dist/index.html +1 -1
- package/frontend/package.json +1 -1
- package/package.json +1 -1
- package/scaffold/.agent/skills/total-recall/SKILL.md +8 -11
- package/src/cli/config.mjs +2 -1
- package/src/cli/deploy-ui.mjs +5 -4
- package/src/cli/deploy.mjs +3 -2
- package/src/cli/edit.mjs +206 -0
- package/src/cli/help.mjs +1 -1
- package/src/cli/init.mjs +7 -6
- package/src/cli/reset-password.mjs +2 -1
- package/src/cli/uninstall.mjs +2 -1
- package/src/core/project-brain.mjs +2 -1
- package/src/core/secrets-store.mjs +5 -4
- package/src/core/secure-file.mjs +71 -0
- package/src/core/webauthn-store.mjs +2 -1
- package/src/server/auth.mjs +3 -2
- package/src/server/index.mjs +2 -1
- package/src/server/routes/collab.mjs +7 -3
- package/src/server/routes/config.mjs +4 -3
package/src/server/index.mjs
CHANGED
|
@@ -18,6 +18,7 @@ import path from 'node:path';
|
|
|
18
18
|
import { fileURLToPath } from 'node:url';
|
|
19
19
|
import zlib from 'node:zlib';
|
|
20
20
|
import fs from 'node:fs';
|
|
21
|
+
import { writeFileSecure } from '../core/secure-file.mjs';
|
|
21
22
|
import {
|
|
22
23
|
apiRateLimiter,
|
|
23
24
|
corsOptions,
|
|
@@ -1078,7 +1079,7 @@ if (HOST !== '127.0.0.1' && HOST !== '0.0.0.0') {
|
|
|
1078
1079
|
wizardCfg['cfg-dash-url'] = `${tunnelUrl}/dashboard`;
|
|
1079
1080
|
wizardCfg['cfg-health-url'] = `${tunnelUrl}/health`;
|
|
1080
1081
|
|
|
1081
|
-
|
|
1082
|
+
writeFileSecure(configFile, JSON.stringify(wizardCfg, null, 2), { encoding: 'utf8', mode: 0o600 });
|
|
1082
1083
|
logger.info('server', `Updated wizard-config.json with active Quick Tunnel URL: ${tunnelUrl}`);
|
|
1083
1084
|
} else {
|
|
1084
1085
|
logger.warn('server', 'Could not allocate Quick Tunnel URL. Please check logs in brainDir/logs/cloudflared.log');
|
|
@@ -6,6 +6,7 @@ import bcrypt from 'bcrypt';
|
|
|
6
6
|
import jwt from 'jsonwebtoken';
|
|
7
7
|
import { WebSocket } from 'ws';
|
|
8
8
|
import { brainDir as configBrainDir } from '../../core/config.mjs';
|
|
9
|
+
import { chmodSecure, writeFileSecure } from '../../core/secure-file.mjs';
|
|
9
10
|
|
|
10
11
|
// Setup database paths in brainDir
|
|
11
12
|
const DATA_DIR = path.join(configBrainDir, 'collab');
|
|
@@ -22,10 +23,13 @@ export function resolveJwtSecret(env = process.env, secretFile = JWT_SECRET_FILE
|
|
|
22
23
|
if (env.JWT_SECRET) return env.JWT_SECRET;
|
|
23
24
|
try {
|
|
24
25
|
const existing = fs.readFileSync(secretFile, 'utf8').trim();
|
|
25
|
-
if (existing.length >= 32)
|
|
26
|
+
if (existing.length >= 32) {
|
|
27
|
+
chmodSecure(secretFile);
|
|
28
|
+
return existing;
|
|
29
|
+
}
|
|
26
30
|
} catch { /* not created yet */ }
|
|
27
31
|
const generated = crypto.randomBytes(48).toString('base64url');
|
|
28
|
-
|
|
32
|
+
writeFileSecure(secretFile, generated, { encoding: 'utf8' });
|
|
29
33
|
return generated;
|
|
30
34
|
}
|
|
31
35
|
const JWT_SECRET = resolveJwtSecret();
|
|
@@ -44,7 +48,7 @@ function readJsonFile(filePath, defaultData = []) {
|
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
function writeJsonFile(filePath, data) {
|
|
47
|
-
|
|
51
|
+
writeFileSecure(filePath, JSON.stringify(data, null, 2), { encoding: 'utf8' });
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
// ─── Database Helpers ────────────────────────────────────────────────────────
|
|
@@ -15,6 +15,7 @@ import yaml from 'yaml';
|
|
|
15
15
|
import { requireAuth, requireScope, loadSecurityConfig } from '../auth.mjs';
|
|
16
16
|
import { BRAIN_DIR, CONFIG_DIR, AGENT_DIR, serverError, badRequest } from './_shared.mjs';
|
|
17
17
|
import { loadRuntimeConfig } from '../../core/runtime.mjs';
|
|
18
|
+
import { writeFileSecure } from '../../core/secure-file.mjs';
|
|
18
19
|
|
|
19
20
|
const router = Router();
|
|
20
21
|
|
|
@@ -152,10 +153,10 @@ router.post('/api/config-json', requireAuth, requireScope('config:write'), async
|
|
|
152
153
|
}
|
|
153
154
|
|
|
154
155
|
if (security) {
|
|
155
|
-
|
|
156
|
+
writeFileSecure(securityPath, yaml.stringify(security), { encoding: 'utf8', mode: 0o600 });
|
|
156
157
|
}
|
|
157
158
|
if (budget) {
|
|
158
|
-
|
|
159
|
+
writeFileSecure(budgetPath, yaml.stringify(budget), { encoding: 'utf8', mode: 0o600 });
|
|
159
160
|
}
|
|
160
161
|
if (brain) {
|
|
161
162
|
let existingBrain = {};
|
|
@@ -167,7 +168,7 @@ router.post('/api/config-json', requireAuth, requireScope('config:write'), async
|
|
|
167
168
|
nextBrain.token = existingBrain.token;
|
|
168
169
|
}
|
|
169
170
|
delete nextBrain.has_token;
|
|
170
|
-
|
|
171
|
+
writeFileSecure(brainPath, JSON.stringify(nextBrain, null, 2), { encoding: 'utf8', mode: 0o600 });
|
|
171
172
|
}
|
|
172
173
|
if (secrets) {
|
|
173
174
|
// Only accept real secret values — ignore masked placeholders from GET /api/config-json.
|