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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: gate the GitHub repo archive, flag and Actions-secret routes behind host control (#9013)
[._.]/ Adam Eivy6feb300923f8
diff --git a/server/lib/hostControlRoutes.js b/server/lib/hostControlRoutes.jsindex d8e2b9aa03..1eb921b483 100644--- a/server/lib/hostControlRoutes.js+++ b/server/lib/hostControlRoutes.js@@ -77,7 +77,12 @@* `*name` (the rest of the path). Matching is case-insensitive and ignores one* trailing slash, exactly as Express routing does, so a request cannot reach a* listed handler by a spelling this list does not match.- */+ *+ * GitHub routes (#9013): `POST /api/github/repos/sync` is left open — it runs+ * a read-only `gh repo list`, caching the result locally the same as every+ * other read-only GET route. Mutable routes (`PUT` flags/secrets, `POST`+ * archive/unarchive, `POST` secret sync) execute `gh` with the user's GitHub+ * account and change external state; they require operator authority.import { isPlainObject } from './objects.js';import { escapeRegExp } from './textUtils.js';@@ -272,6 +277,14 @@ export const HOST_CONTROL_ROUTES = Object.freeze(['POST /api/settings/features/eidoverse/install','PUT /api/settings/features/eidoverse/source',+ // GitHub actions (#9013): mutating routes run `gh` with the user's GitHub+ // account and change external state. Syncing repos is read-only.+ 'PUT /api/github/repos/:fullName',+ 'POST /api/github/repos/:fullName/archive',+ 'POST /api/github/repos/:fullName/unarchive',+ 'PUT /api/github/secrets/:name',+ 'POST /api/github/secrets/:name/sync',+// Self-update (#8742): runs git + npm and restarts the process, or `gh repo// sync` against the fork. `check` and `ignore`/DELETE-`ignore` only read or// record a preference — left open.diff --git a/server/routes/hostControlFamilies.test.js b/server/routes/hostControlFamilies.test.jsindex a8c7da910d..44dce5bbc8 100644--- a/server/routes/hostControlFamilies.test.js+++ b/server/routes/hostControlFamilies.test.js@@ -34,6 +34,14 @@ const loops = vi.hoisted(() => ({}));vi.mock('../services/loops.js', () => loops);+const github = vi.hoisted(() => ({+ updateRepoFlags: vi.fn(),+ setRepoArchived: vi.fn(),+ setSecret: vi.fn(),+ syncSecretToRepos: vi.fn(),+}));+vi.mock('../services/github.js', () => github);+const installer = vi.hoisted(() => ({getProviderRuntime: vi.fn(),getProviderRuntimeStatus: vi.fn(),@@ -50,6 +58,7 @@ import { authGate, hostControlBodyGate, hostControlRouteGate } from '../servicesimport featureAgentsRoutes from './featureAgents.js';import loopsRoutes from './loops.js';import { createPortOSProviderRoutes } from './providers.js';+import githubRoutes from './github.js';// Stand-ins for the two policy-store handlers: the gate, not the store, is// under test, and a handler that never runs is the proof nothing was written.@@ -72,6 +81,7 @@ const buildGatedApp = (remoteAddress) => {app.use('/api/feature-agents', featureAgentsRoutes);app.use('/api/loops', loopsRoutes);app.use('/api/providers', createPortOSProviderRoutes({ services: { providers: {} }, routes: { providers: Router() } }));+ app.use('/api/github', githubRoutes);app.put('/api/settings', settingsWrite);app.put('/api/cos/config', cosConfigWrite);app.post('/api/voice/studio/setup', mediaHostAction);@@ -105,6 +115,11 @@ const REFUSED_WRITES = [['post', '/api/providers/runtimes/install?runtime=codex', {}],['post', '/api/voice/studio/setup', {}],['post', '/api/apps/example-app/launch-videos/publish', {}],+ ['put', '/api/github/repos/example.com%2Fexample', { flags: ['archived'] }],+ ['post', '/api/github/repos/example.com%2Fexample/archive', {}],+ ['post', '/api/github/repos/example.com%2Fexample/unarchive', {}],+ ['put', '/api/github/secrets/EXAMPLE_SECRET', { value: 'secret-value' }],+ ['post', '/api/github/secrets/EXAMPLE_SECRET/sync', {}],['put', '/api/settings', { harnesses: { claude: { enabled: true } } }],['put', '/api/cos/config', { avatarStyle: 'svg', maxConcurrentAgents: 9 }],];@@ -116,6 +131,10 @@ describe('host-control gate on agent, loop, provider and policy writes (#8721)',featureAgents.stopFeatureAgent.mockResolvedValue({ id: 'agent-1', status: 'stopped' });loops.triggerLoop.mockResolvedValue({ id: 'loop-1' });loops.stopLoop.mockResolvedValue({ id: 'loop-1', status: 'stopped' });+ github.updateRepoFlags.mockResolvedValue({ archived: false });+ github.setRepoArchived.mockResolvedValue({ archived: true });+ github.setSecret.mockResolvedValue({ success: true });+ github.syncSecretToRepos.mockResolvedValue({ synced: true });});it('refuses a remote password-free caller, direct or proxied, before anything runs or is written', async () => {@@ -130,6 +149,10 @@ describe('host-control gate on agent, loop, provider and policy writes (#8721)',expect(loops.triggerLoop).not.toHaveBeenCalled();expect(installer.getProviderRuntimeStatus).not.toHaveBeenCalled();expect(installer.spawnRuntimeInstaller).not.toHaveBeenCalled();+ expect(github.updateRepoFlags).not.toHaveBeenCalled();+ expect(github.setRepoArchived).not.toHaveBeenCalled();+ expect(github.setSecret).not.toHaveBeenCalled();+ expect(github.syncSecretToRepos).not.toHaveBeenCalled();expect(settingsWrite).not.toHaveBeenCalled();expect(cosConfigWrite).not.toHaveBeenCalled();expect(mediaHostAction).not.toHaveBeenCalled();