Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

Reconcile Brain capture gating with the repo-intake authority suite (#11036)

Adam Eivyff1d9f898780
diff --git a/server/lib/hostControlRoutes.js b/server/lib/hostControlRoutes.js
index d810590665..ac055413e8 100644
--- a/server/lib/hostControlRoutes.js
+++ b/server/lib/hostControlRoutes.js
@@ -769,9 +769,10 @@ export const HOST_CONTROL_ROUTES = Object.freeze([
// `scan-report` and link CRUD only read or record; nothing runs. The one
// exception is a repository URL that auto-clones: POST /api/brain/links
// (unless `autoClone: false`) and a bare-repo-URL POST /api/brain/capture
- // start a clone and may arm post-clone scan/study agents, so those two are
- // gated per request in their handlers (`assertHostControl`, #11037) rather
- // than listed here — a plain bookmark stays open.
+ // start a clone and may arm post-clone scan/study agents. Links are gated per
+ // request in their handler (`assertHostControl`, #11037) so a plain bookmark
+ // stays open; capture is listed below whole (#11036) because it can also
+ // dispatch classification.
'POST /api/brain/links/:id/clone',
'POST /api/brain/links/:id/pull',
'POST /api/brain/links/:id/open-folder',
diff --git a/server/routes/hostControlBrainRepoIntake.test.js b/server/routes/hostControlBrainRepoIntake.test.js
index 0f880c626b..ca00ebcce1 100644
--- a/server/routes/hostControlBrainRepoIntake.test.js
+++ b/server/routes/hostControlBrainRepoIntake.test.js
@@ -187,11 +187,19 @@ describe('automatic repository intake operator authority (#11037)', () => {
expect(response.body.cloneStatus).toBe('none');
expect(response.body.repoIntake).toBeUndefined();
}
- const capture = await post(appFor(), ['/api/brain/capture', { text: 'https://example.com/article-two' }]);
- expect(capture.status).toBe(200);
await settle();
- expect(store.links.size).toBe(3);
+ expect(store.links.size).toBe(2);
expect(clone.cloneRepo).not.toHaveBeenCalled();
expect(clone.runRepoIntake).not.toHaveBeenCalled();
});
+
+ // Capture is gated whole (#11036): even a plain note can dispatch the
+ // classifier, so a remote password-free caller is refused before any record.
+ it('refuses a plain capture from a remote password-free caller before any record or clone', async () => {
+ const capture = await post(appFor(), ['/api/brain/capture', { text: 'https://example.com/article-two' }]);
+ expect([capture.status, capture.body.code]).toEqual([403, 'HOST_CONTROL_FORBIDDEN']);
+ await settle();
+ expect(store.links.size).toBe(0);
+ expect(clone.cloneRepo).not.toHaveBeenCalled();
+ });
});