@atlasnomos/atlas 1.1.2 → 1.1.5
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/atlas.js +19 -5
- package/package.json +1 -1
- package/src/kernel/boot/BootGuard.js +9 -5
package/atlas.js
CHANGED
|
@@ -8,10 +8,8 @@ const path = require('path');
|
|
|
8
8
|
const { ErrorHandler } = require('./src/core/ErrorHandler');
|
|
9
9
|
|
|
10
10
|
// 0. Entry Point Hardening (Anti-Bypass)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
process.exit(1);
|
|
14
|
-
}
|
|
11
|
+
const { validateEntryPoint } = require('./src/kernel/boot/BootGuard');
|
|
12
|
+
validateEntryPoint();
|
|
15
13
|
|
|
16
14
|
// 1. Load Env & Config
|
|
17
15
|
// Priority 1: CWD .env (Project specific)
|
|
@@ -117,7 +115,23 @@ const { ModelsCommand } = require('./src/interface/cli/commands/ModelsCommand');
|
|
|
117
115
|
console.error('\n⚠️ DRY-RUN MODE ACTIVE: No changes will be persisted.\n');
|
|
118
116
|
}
|
|
119
117
|
|
|
120
|
-
|
|
118
|
+
// PHASE 4: Setup Flow Interception
|
|
119
|
+
const command = rawArgs[0] || 'doctor';
|
|
120
|
+
const isSetupCommand = ['init', 'help', '--help', '-h', '--version', '-v'].includes(command);
|
|
121
|
+
|
|
122
|
+
let context;
|
|
123
|
+
if (isSetupCommand) {
|
|
124
|
+
// Use minimal context for setup commands to bypass Ring-1 validation
|
|
125
|
+
context = {
|
|
126
|
+
tierManager: { getTier: () => 'DEV', displayBanner: () => { } },
|
|
127
|
+
trace: { log: () => { } },
|
|
128
|
+
auditSink: { log: () => { } },
|
|
129
|
+
costTracker: { log: () => { } }
|
|
130
|
+
};
|
|
131
|
+
} else {
|
|
132
|
+
// Full kernel boot for governed commands
|
|
133
|
+
context = await bootstrap.boot();
|
|
134
|
+
}
|
|
121
135
|
|
|
122
136
|
const dispatcher = new CommandDispatcher(context);
|
|
123
137
|
|
package/package.json
CHANGED
|
@@ -25,7 +25,8 @@ const { panic } = require('./HardKill');
|
|
|
25
25
|
* All paths are relative to the atlas root directory.
|
|
26
26
|
*/
|
|
27
27
|
const AUTHORIZED_ENTRY_POINTS = Object.freeze([
|
|
28
|
-
'atlas.js'
|
|
28
|
+
'atlas.js',
|
|
29
|
+
'atlas' // Supported for NPM global wrapper
|
|
29
30
|
]);
|
|
30
31
|
|
|
31
32
|
// ═══════════════════════════════════════════════════════════════
|
|
@@ -56,11 +57,14 @@ function validateEntryPoint() {
|
|
|
56
57
|
const expectedPath = path.join(atlasRoot, entryFilename);
|
|
57
58
|
|
|
58
59
|
// Normalize paths for comparison (handle Windows backslashes)
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
const normalizedActual = path.resolve(mainModule.filename);
|
|
61
|
+
const isUnderRoot = normalizedActual.startsWith(atlasRoot);
|
|
62
|
+
|
|
63
|
+
if (!isUnderRoot) {
|
|
64
|
+
panic('BOOT_GUARD: Entry point out of bounds', {
|
|
61
65
|
actual: mainModule.filename,
|
|
62
|
-
|
|
63
|
-
reason: 'Entry point must be
|
|
66
|
+
expectedPrefix: atlasRoot,
|
|
67
|
+
reason: 'Entry point must be within the kernel root directory'
|
|
64
68
|
});
|
|
65
69
|
return false;
|
|
66
70
|
}
|