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

fix: require operator authority to install a cover font (#12493)

[._.]/ Adam Eivy2bdaee9a1197
diff --git a/docs/API.md b/docs/API.md
index 9d80183f63..7ce8d2f498 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -606,6 +606,7 @@ leaves finished ones alone. Agents outside PortOS call these with `node scripts/
| GET | `/music-video/:id/publish/promotion-plan` | A music video's open promotion steps |
| POST | `/music-video/:id/publish/promotion-plan` | Plan its promotion with one provider call `{ goal?, audience?, days?, providerId?, model? }` and schedule the steps |
| POST | `/music-video/:id/publish/:target/preview` | What Fill draft would post for one platform (same body as prepare) → `{ ready, parts }` or `{ ready: false, problem }` |
+| POST | `/music-video/publish/cover-fonts` | Upload a cover lettering font. Host-control gated: the file is installed into a host-wide font folder (macOS `Library/Fonts/PortOS`), so a remote caller on a password-free install is refused; local connections, operator sessions and `PORTOS_API_TOKEN` agents are allowed. Listing and serving (`GET`) and delete stay open |
### Notifications
diff --git a/server/lib/hostControlRoutes.js b/server/lib/hostControlRoutes.js
index 0b46cab431..c557976acf 100644
--- a/server/lib/hostControlRoutes.js
+++ b/server/lib/hostControlRoutes.js
@@ -836,6 +836,10 @@ export const HOST_CONTROL_ROUTES = Object.freeze([
'POST /api/music-video/:id/publish-kit/cover-art/design',
'POST /api/music-video/:id/publish-kit/cover-art/generate',
'POST /api/music-video/:id/publish/promotion-plan',
+ // Cover font upload copies the file into a host-wide font folder that every
+ // application loads (macOS Library/Fonts/PortOS), so it is host control, not
+ // a data upload. Listing, serving and deleting cover fonts stay open.
+ 'POST /api/music-video/publish/cover-fonts',
'POST /api/meatspace/post/score-llm',
'POST /api/meatspace/post/rhetoric/evaluate',
'POST /api/meatspace/post/drill-cache/fill',
diff --git a/server/lib/hostControlRoutes.test.js b/server/lib/hostControlRoutes.test.js
index f8385dd542..385acb651a 100644
--- a/server/lib/hostControlRoutes.test.js
+++ b/server/lib/hostControlRoutes.test.js
@@ -586,6 +586,22 @@ describe('Pipeline authoring remainder policy (#10907)', () => {
});
});
+describe('Music Video cover font install policy (#12493)', () => {
+ it('gates the host-wide font install and keeps cover font list, file and delete open', () => {
+ const mounted = new Set(getApiRouteCatalog().routes.map(({ method, path }) => method + ' ' + path));
+ const upload = 'POST /api/music-video/publish/cover-fonts';
+ expect(mounted.has(upload)).toBe(true);
+ expect(isHostControlRoute('POST', '/api/music-video/publish/cover-fonts')).toBe(true);
+ for (const [method, path] of [
+ ['GET', '/api/music-video/publish/cover-fonts'],
+ ['GET', '/api/music-video/publish/cover-fonts/:fontId/file'],
+ ['DELETE', '/api/music-video/publish/cover-fonts/:fontId'],
+ ]) {
+ expect(isHostControlRoute(method, path), `${method} ${path}`).toBe(false);
+ }
+ });
+});
+
describe('Music Video agent workflow policy (#9869)', () => {
it('gates mounted agent workflows and keeps record, cancellation and contained rendering contracts', () => {
const protectedRoutes = [
diff --git a/server/routes/hostControlMediaProcessing.test.js b/server/routes/hostControlMediaProcessing.test.js
index c6a06c933b..89f7237e9a 100644
--- a/server/routes/hostControlMediaProcessing.test.js
+++ b/server/routes/hostControlMediaProcessing.test.js
@@ -14,6 +14,7 @@ const effects = vi.hoisted(() => ({
startLyricAlign: vi.fn(async () => ({ jobId: 'align-1' })),
probeLoraEffect: vi.fn(async () => ({ status: 'active' })),
renderTimelineProject: vi.fn(async () => ({ jobId: 'render-1' })),
+ addCoverFont: vi.fn(async () => ({ id: 'font-1' })),
}));
vi.mock('../services/auth.js', () => ({
@@ -92,6 +93,14 @@ vi.mock('../services/musicVideo/vocalSeparation.js', () => ({
attachVocalSeparationSseClient: vi.fn(() => true),
}));
+vi.mock('../services/musicVideo/coverFonts.js', () => ({
+ addCoverFont: effects.addCoverFont,
+ coverFontPath: vi.fn(async () => null),
+ listCoverFonts: vi.fn(async () => []),
+ removeCoverFont: vi.fn(async () => ({ ok: true })),
+ MAX_COVER_FONT_BYTES: 8 * 1024 * 1024,
+}));
+
vi.mock('../services/musicVideo/lyricAlignJob.js', () => ({
startLyricAlign: effects.startLyricAlign,
cancelLyricAlign: vi.fn(() => true),
@@ -218,6 +227,19 @@ describe('media process execution operator authority', () => {
expect(effect).toHaveBeenCalledTimes(2);
});
+ it('gates the cover font install (host-wide font folder) while local and operator callers reach the handler (#12493)', async () => {
+ const path = '/api/music-video/publish/cover-fonts';
+ const remote = await post(appFor(), path, {});
+ expect([remote.status, remote.body.code]).toEqual([403, 'HOST_CONTROL_FORBIDDEN']);
+ // Past the gate, the upload middleware rejects a JSON body (not multipart).
+ const local = await post(appFor('127.0.0.1'), path, {});
+ expect([local.status, local.body.code]).toEqual([400, 'INVALID_CONTENT_TYPE']);
+ state.enabled = true;
+ const operator = await post(appFor(), path, {}, { Authorization: 'Bearer example-session' });
+ expect([operator.status, operator.body.code]).toEqual([400, 'INVALID_CONTENT_TYPE']);
+ expect(effects.addCoverFont).not.toHaveBeenCalled();
+ });
+
it('keeps timeline render available to local and operator callers', async () => {
const [path, body, effect] = routes.at(-1);
const resLocal = await post(appFor('127.0.0.1'), path, body);