Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion scripts/nemoclaw-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ if [ "$(id -u)" -ne 0 ]; then
echo "[gateway] Running as non-root (uid=$(id -u)) — privilege separation disabled"
export HOME=/sandbox
if ! verify_config_integrity; then
echo "[SECURITY WARNING] Config integrity check failed — proceeding anyway (non-root mode)"
echo "[SECURITY] Config integrity check failed — refusing to start (non-root mode)"
exit 1
fi
write_auth_profile

Expand Down
20 changes: 20 additions & 0 deletions test/nemoclaw-start.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,24 @@ describe("nemoclaw-start non-root fallback", () => {
expect(src).toMatch(/touch \/tmp\/gateway\.log/);
expect(src).toMatch(/nohup "\$OPENCLAW" gateway run >\/tmp\/gateway\.log 2>&1 &/);
});

it("exits on config integrity failure in non-root mode", () => {
const src = fs.readFileSync(START_SCRIPT, "utf-8");

// Non-root block must call verify_config_integrity and exit 1 on failure
expect(src).toMatch(
/if ! verify_config_integrity; then\s+.*exit 1/s,
);
// Must not contain the old "proceeding anyway" fallback
expect(src).not.toMatch(/proceeding anyway/i);
});

it("calls verify_config_integrity in both root and non-root paths", () => {
const src = fs.readFileSync(START_SCRIPT, "utf-8");

// The function must be called at least twice: once in the non-root
// if-block and once in the root path below it.
const calls = src.match(/verify_config_integrity/g) || [];
expect(calls.length).toBeGreaterThanOrEqual(3); // definition + 2 call sites
});
});
Loading