From c6caf8428ae9e2d6f736248f12071009f9c7d8ff Mon Sep 17 00:00:00 2001 From: Androtim <143963999+Androtim@users.noreply.github.com> Date: Sat, 4 Jul 2026 00:01:31 +0200 Subject: [PATCH 1/5] chore: stop tracking Claude's machine-local settings The file carries machine-specific permission rules (including the deploy host) that don't belong in a public repo. Co-Authored-By: Claude Fable 5 --- .claude/settings.local.json | 28 ---------------------------- .gitignore | 4 +++- 2 files changed, 3 insertions(+), 29 deletions(-) delete mode 100644 .claude/settings.local.json diff --git a/.claude/settings.local.json b/.claude/settings.local.json deleted file mode 100644 index ea4ed9f3..00000000 --- a/.claude/settings.local.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "permissions": { - "allow": [ - "Bash(mkdir:*)", - "Bash(npm run dev:*)", - "Bash(rm:*)", - "Bash(npm install:*)", - "Bash(pkill:*)", - "Bash(true)", - "Bash(grep:*)", - "Bash(npm run server:*)", - "Bash(curl:*)", - "Bash(timeout:*)", - "Bash(git init:*)", - "Bash(git add:*)", - "Bash(gh repo create:*)", - "Bash(gh auth:*)", - "Bash(kill:*)", - "Bash(chmod:*)", - "Bash(npm run kill-port:*)", - "Bash(git push:*)", - "Bash(git merge:*)", - "Bash(git rebase:*)", - "Bash(gh pr:*)" - ], - "deny": [] - } -} \ No newline at end of file diff --git a/.gitignore b/.gitignore index d0015328..7dfb6e47 100644 --- a/.gitignore +++ b/.gitignore @@ -78,4 +78,6 @@ sessions/ # Python (if any scripts) __pycache__/ *.py[cod] -*$py.class \ No newline at end of file +*$py.class +# Claude Code local settings (machine-specific permissions) +.claude/settings.local.json From da7743bb8c78303908bfc5feb8bb3f01ca79d9f5 Mon Sep 17 00:00:00 2001 From: Androtim <143963999+Androtim@users.noreply.github.com> Date: Sat, 4 Jul 2026 00:02:05 +0200 Subject: [PATCH 2/5] feat(ui): quiet the theme The default look leaned on the recognizable template stack: violet on purple-navy, blurred orbs, glassmorphism, gradient text and buttons, glow shadows, 16px radius on everything. Now: neutral night-sky base, coral kept as the one accent (it's the beacon), violet demoted to a muted sapphire, solid bordered cards, flat buttons, one faint horizon glow instead of floating orbs, and calmer error/loading screens. All via token values, so user customization and presets keep working. Co-Authored-By: Claude Fable 5 --- client/src/App.jsx | 28 ++++------ client/src/components/Appearance.jsx | 4 +- client/src/components/Layout.jsx | 13 ++--- client/src/index.css | 83 ++++++++++------------------ client/src/lib/themes.js | 74 ++++++++++++------------- client/src/pages/Files.jsx | 2 +- client/src/pages/Home.jsx | 11 ++-- client/tailwind.config.js | 12 +--- 8 files changed, 92 insertions(+), 135 deletions(-) diff --git a/client/src/App.jsx b/client/src/App.jsx index ce09af6f..9cf0c597 100644 --- a/client/src/App.jsx +++ b/client/src/App.jsx @@ -25,12 +25,11 @@ function ProtectedRoute({ children }) { if (loading) { return ( -
-
-
- +
+
+
-

+

Lighting the beacon…

@@ -53,19 +52,16 @@ class ErrorBoundary extends React.Component { render() { if (this.state.hasError) { return ( -
-
-
- +
+
+
+
-

Critical System Error

-

{this.state.error?.message || 'Kernel panic detected.'}

-
diff --git a/client/src/components/Appearance.jsx b/client/src/components/Appearance.jsx index 14a084e2..2e2f6795 100644 --- a/client/src/components/Appearance.jsx +++ b/client/src/components/Appearance.jsx @@ -1,10 +1,10 @@ import { useState, useEffect } from 'react' import { useTheme } from '../context/ThemeContext' import { TOKENS } from '../lib/themes' -import { Sparkles, SlidersHorizontal, Code2, Sun, Moon, Check, Copy, AlertTriangle, Zap, Save, Undo2 } from 'lucide-react' +import { Palette, SlidersHorizontal, Code2, Sun, Moon, Check, Copy, AlertTriangle, Zap, Save, Undo2 } from 'lucide-react' const MODES = [ - { id: 'easy', label: 'Easy', icon: Sparkles, hint: 'Presets & basics' }, + { id: 'easy', label: 'Easy', icon: Palette, hint: 'Presets & basics' }, { id: 'advanced', label: 'Advanced', icon: SlidersHorizontal, hint: 'Fine-tune tokens' }, { id: 'tinkerer', label: 'Tinkerer', icon: Code2, hint: 'Full control' }, ] diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsx index 359e824e..219be1e4 100644 --- a/client/src/components/Layout.jsx +++ b/client/src/components/Layout.jsx @@ -45,8 +45,6 @@ export default function Layout({ children }) { if (isAuthPage) { return (
-
-
{/* Selected File List / Progress */} -
-
- Sending - {selectedFiles.length} file(s) +
+
+ Sending + {selectedFiles.length} file(s)
{selectedFiles.map((file, i) => { const progress = uploadProgress[file.name] || 0 return ( -
+
- +
-

{file.name}

-

{formatFileSize(file.size)}

+

{file.name}

+

{formatFileSize(file.size)}

{progress > 0 && ( - {progress}% + {progress}% )}
{progress > 0 && ( -
+
)} @@ -197,22 +199,22 @@ export default function FileShare() { className="space-y-6" > {/* Connection coordinates header */} -
+
-

Share code

-

{shareCode}

+

Share code

+

{shareCode}

-
+
Connected
{receiverStatus === 'error' && ( -
- +
+
-

Connection failed

-

+

Connection failed

+

{joinError || "Couldn't establish a direct connection. The sender may be offline, or the network is too restrictive."}

@@ -220,35 +222,35 @@ export default function FileShare() { )} {receiverStatus === 'connecting' && ( -
- -

Connecting to the sender…

-

Setting up a direct connection

+
+ +

Connecting to the sender…

+

Setting up a direct connection

)} {receiverStatus === 'ready' && pendingFiles.length > 0 && ( -
+
-

Files ready

-

Accept to start downloading

+

Files ready

+

Accept to start downloading

{pendingFiles.map((file, i) => ( -
+
- - {file.name} + + {file.name}
- {formatFileSize(file.size)} + {formatFileSize(file.size)}
))}
{selectedFile && ( -
+
-

{selectedFile.name}

-

{formatFileSize(selectedFile.size)}

+

{selectedFile.name}

+

{formatFileSize(selectedFile.size)}

- +
{!isSharing && ( @@ -166,15 +166,15 @@ export default function VideoFileSharing({ socket, roomId, isHost, onVideoReady, {isSharing && (
-
- -

+

+ +

{status === 'streaming' ? 'Streaming to the party' : 'Ready — waiting for others'}

@@ -184,30 +184,30 @@ export default function VideoFileSharing({ socket, roomId, isHost, onVideoReady, )}
) : isHost ? ( -
- -

+

+ +

Switch to "File" mode
to share a video

) : (
{participantStatus === 'idle' && ( -
- -

+

+ +

Waiting for the host to share a video…

)} {participantStatus === 'pending' && pendingFileInfo && ( -
- -

The host wants to share a video

-
-

{pendingFileInfo.name}

-

{formatFileSize(pendingFileInfo.size)}

+
+ +

The host wants to share a video

+
+

{pendingFileInfo.name}

+

{formatFileSize(pendingFileInfo.size)}

@@ -217,16 +217,16 @@ Switch to "File" mode
to share a video )} {participantStatus === 'connecting' && ( -
-
+
+

Connecting…

)} {participantStatus === 'ready' && (
- -

+ +

Streaming — playing now

@@ -234,9 +234,9 @@ Streaming — playing now {participantStatus === 'error' && (
- -

Couldn't connect

-

The direct connection couldn't be established. This can happen on restrictive networks.

+ +

Couldn't connect

+

The direct connection couldn't be established. This can happen on restrictive networks.

{pendingHostId && ( @@ -248,10 +248,10 @@ Streaming — playing now
)} -
-

+

+

Encrypted peer-to-peer · starts playing as it streams
- MP4, WebM, MOV + MP4, WebM, MOV

diff --git a/client/src/components/VoicePanel.jsx b/client/src/components/VoicePanel.jsx index abbfbc30..15a9f9bd 100644 --- a/client/src/components/VoicePanel.jsx +++ b/client/src/components/VoicePanel.jsx @@ -15,11 +15,11 @@ export default function VoicePanel({ socket, roomId }) { const peerEntries = Object.entries(peers) return ( -
+
- - + + {joined ? peerEntries.length === 0 ? 'Voice: alone in here' @@ -33,7 +33,7 @@ export default function VoicePanel({ socket, roomId }) { @@ -59,7 +59,7 @@ export default function VoicePanel({ socket, roomId }) {
{joined && peerEntries.length > 0 && ( -
+
{peerEntries.filter(([, p]) => p.stream).length} connected
)} From 710df84180312b4d3370b7d00106e977c0233bcb Mon Sep 17 00:00:00 2001 From: Androtim <143963999+Androtim@users.noreply.github.com> Date: Sat, 4 Jul 2026 00:02:05 +0200 Subject: [PATCH 4/5] feat(ui): own favicon instead of the Vite default Co-Authored-By: Claude Fable 5 --- client/index.html | 2 +- client/public/favicon.svg | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 client/public/favicon.svg diff --git a/client/index.html b/client/index.html index a747158e..44ae045a 100644 --- a/client/index.html +++ b/client/index.html @@ -2,7 +2,7 @@ - + Beacon diff --git a/client/public/favicon.svg b/client/public/favicon.svg new file mode 100644 index 00000000..a784c658 --- /dev/null +++ b/client/public/favicon.svg @@ -0,0 +1,6 @@ + + + + + + From 3fdb03bfad4d64ffde12bc0894578216807adbe6 Mon Sep 17 00:00:00 2001 From: Androtim <143963999+Androtim@users.noreply.github.com> Date: Sat, 4 Jul 2026 00:14:28 +0200 Subject: [PATCH 5/5] test(p2p): regression coverage for hostile-peer receiver defenses Two loopback tests drive the real receiver with a malicious sender: a manifest whose totalChunks doesn't match its size is rejected before any store is allocated, and a chunk written past totalChunks is dropped while the legitimate chunks still complete at the true size. Locks in the PR #43 fixes. Co-Authored-By: Claude Fable 5 --- tests/e2e/hostile-peer.spec.ts | 126 +++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 tests/e2e/hostile-peer.spec.ts diff --git a/tests/e2e/hostile-peer.spec.ts b/tests/e2e/hostile-peer.spec.ts new file mode 100644 index 00000000..ff6c8d89 --- /dev/null +++ b/tests/e2e/hostile-peer.spec.ts @@ -0,0 +1,126 @@ +import { test, expect } from '@playwright/test' + +// Regression tests for the receiver-side defenses against a hostile sending +// peer (see the P2P hardening in client/src/lib/p2p/transfer.js and +// streaming.js). Each test drives the REAL receiver with a hand-rolled +// malicious sender over a loopback RTCPeerConnection pair — no UI — and +// asserts the receiver rejects the abuse instead of acting on it. + +test('receiver rejects a manifest whose chunk geometry does not match its size', async ({ page }) => { + await page.goto('/') + + const outcome = await page.evaluate(async () => { + const { createReceiver } = await import('/src/lib/p2p/transfer.js') + + const a = new RTCPeerConnection() + const b = new RTCPeerConnection() + a.onicecandidate = (e) => e.candidate && b.addIceCandidate(e.candidate) + b.onicecandidate = (e) => e.candidate && a.addIceCandidate(e.candidate) + const sendCh = a.createDataChannel('transfer') + const remote: Promise = new Promise((res) => { b.ondatachannel = (e) => res(e.channel) }) + await a.setLocalDescription() + await b.setRemoteDescription(a.localDescription!) + await b.setLocalDescription() + await a.setRemoteDescription(b.localDescription!) + const recvCh = await remote + await new Promise((res) => { sendCh.readyState === 'open' ? res() : (sendCh.onopen = () => res()) }) + + let errored = false + let resumeSeen = false + recvCh.onmessage = (e) => { if (typeof e.data === 'string' && JSON.parse(e.data).t === 'resume') resumeSeen = true } + + const transferId = 'mal-manifest' + createReceiver({ + channel: recvCh, + transferId, + onError: () => { errored = true }, + }) + + // A tiny file (1 chunk) but a totalChunks claiming 1,000,000 — the geometry + // an attacker would use to write chunks at huge offsets. + sendCh.send(JSON.stringify({ + t: 'manifest', id: transferId, + files: [{ i: 0, name: 'evil.bin', size: 100, type: 'application/octet-stream', chunkSize: 65536, totalChunks: 1_000_000 }], + })) + await new Promise((r) => setTimeout(r, 300)) + a.close(); b.close() + return { errored, resumeSeen } + }) + + expect(outcome.errored).toBe(true) // receiver flagged the manifest + expect(outcome.resumeSeen).toBe(false) // and never answered with a resume (never allocated a store) +}) + +test('receiver drops a chunk written past the declared totalChunks', async ({ page }) => { + await page.goto('/') + + const outcome = await page.evaluate(async () => { + const { createReceiver, cleanupTransfer, CHUNK_SIZE } = await import('/src/lib/p2p/transfer.js') + + const a = new RTCPeerConnection() + const b = new RTCPeerConnection() + a.onicecandidate = (e) => e.candidate && b.addIceCandidate(e.candidate) + b.onicecandidate = (e) => e.candidate && a.addIceCandidate(e.candidate) + const sendCh = a.createDataChannel('transfer') + sendCh.binaryType = 'arraybuffer' + const remote: Promise = new Promise((res) => { b.ondatachannel = (e) => res(e.channel) }) + await a.setLocalDescription() + await b.setRemoteDescription(a.localDescription!) + await b.setLocalDescription() + await a.setRemoteDescription(b.localDescription!) + const recvCh = await remote + await new Promise((res) => { sendCh.readyState === 'open' ? res() : (sendCh.onopen = () => res()) }) + + const transferId = 'mal-oob-' + Math.random().toString(36).slice(2) + // A legitimate 2-chunk file. + const size = CHUNK_SIZE + 100 + const totalChunks = 2 + let completedSize = -1 + let errored = false + let errMsg = '' + let done = false + + await new Promise((resolve) => { + createReceiver({ + channel: recvCh, + transferId, + onFileComplete: (file: File) => { completedSize = file.size; done = true; resolve() }, + // Ignore the channel-close error that fires after we tear the pair down. + onError: (e: Error) => { if (done) return; errored = true; errMsg = String(e?.message ?? e); resolve() }, + }) + + // createReceiver owns recvCh.onmessage; we only drive the sender side. + sendCh.onmessage = (e) => { + if (typeof e.data !== 'string') return + const msg = JSON.parse(e.data) + if (msg.t !== 'resume') return + // Send an out-of-range chunk FIRST (index 999 » totalChunks) — must be ignored. + const oob = new Uint8Array(8 + 10) + new DataView(oob.buffer).setUint32(0, 0, true) + new DataView(oob.buffer).setUint32(4, 999, true) + sendCh.send(oob) + // Then the two real chunks in order. + for (let i = 0; i < totalChunks; i++) { + const bytes = i === 0 ? CHUNK_SIZE : 100 + const frame = new Uint8Array(8 + bytes) + const dv = new DataView(frame.buffer) + dv.setUint32(0, 0, true) + dv.setUint32(4, i, true) + sendCh.send(frame) + } + } + sendCh.send(JSON.stringify({ + t: 'manifest', id: transferId, + files: [{ i: 0, name: 'ok.bin', size, type: 'application/octet-stream', chunkSize: CHUNK_SIZE, totalChunks }], + })) + }) + + a.close(); b.close() + await cleanupTransfer(transferId).catch(() => {}) + return { completedSize, size, errored, errMsg } + }) + + // The out-of-range chunk was ignored; the file still completes at its true size. + expect(outcome.errored, `unexpected error: ${outcome.errMsg}`).toBe(false) + expect(outcome.completedSize).toBe(outcome.size) +})