Limit what a tracker can make the page do, recommend anti-framing headers

A tracker message over 64 KiB isn't parsed, before acceptance it rejects
the tracker like a failure reason. Beyond 20 messages per 10 s the rest is
dropped, so a tracker can't keep the page parsing and decrypting. What a
tracker makes a socket log goes through one note: each line once, at most
10 per socket. The log keeps the last 1000 lines in a shallow ref and says
how many went.

index.html sets Referrer-Policy itself, the README recommends the headers a
<meta> can't set: frame-ancestors, X-Frame-Options and nosniff.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
SchluffeandClaude Opus 5.5 committed 2026-10-30 00:29:23 +01:00
1 parent b102e55495
commit 7f4811485a
7 files changed
+151 -31

No files matched your search

+14 -4
View File
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, reactive, ref, watch } from 'vue';
import { computed, reactive, ref, shallowRef, triggerRef, watch } from 'vue';
import {
answerOffer,
type Check,
@@ -91,7 +91,12 @@ const receiveCode = ref('');
const check = ref<Check>();
const confirmed = ref(false);
const log = ref<string[]>([]);
// Changed in place and triggered, a deep ref would make each line cost every line kept.
const log = shallowRef<string[]>([]);
// Lines kept, the oldest go first and dropped counts them. A session logs a few dozen, a tracker or
// peer that sends garbage could add lines until the tab freezes.
const MAX_LOG = 1000;
const dropped = ref(0);
// Of the session, shown in the card of its side.
const error = ref('');
const status = ref<{ phase: Phase; text: string }>();
@@ -100,7 +105,12 @@ const phase = computed(() => (error.value ? 'error' : status.value?.phase));
// Shared by both sides, each adds its own progress.
const events: Omit<Events, 'progress'> = {
log: (message) => log.value.push(`${new Date().toISOString().slice(11, 23)} ${message}`),
log: (message) => {
const lines = log.value;
lines.push(`${new Date().toISOString().slice(11, 23)} ${message}`);
if (lines.length > MAX_LOG) dropped.value += lines.splice(0, lines.length - MAX_LOG).length;
triggerRef(log);
},
error: (message) => {
events.log(message);
error.value = message;
@@ -522,7 +532,7 @@ const saltLocked = computed(
<details>
<summary>Log</summary>
<pre id="log">{{ log.join('\n') }}</pre>
<pre id="log">{{ dropped ? `${dropped} earlier lines dropped\n` : '' }}{{ log.join('\n') }}</pre>
</details>
</main>