From d56b3b069782585a6edcc9c608236361c2644a51 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 8 Nov 2026 14:18:33 +0000 Subject: envelope: a signed value names its swarm Review 3.1, part of finding 12: a signed value's payload bound path, user, time and prev, but not the swarm. A user with the same name and key in two swarms could have an envelope replayed from one into the other, wherever the path holds no envelope yet (prev ""). The payload now names the swarm (`swarm`), and a node takes an envelope only for its own. /auth/whoami says the swarm, and continuum-signed and the example in api.md sign it. Wire version 44: nodes before this refuse such envelopes, and those after refuse the old ones. --- scripts/continuum-signed | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/continuum-signed b/scripts/continuum-signed index dc5bd75..6dd1f4c 100755 --- a/scripts/continuum-signed +++ b/scripts/continuum-signed @@ -96,10 +96,12 @@ write() { cv1.*) prev=$(printf %s "$current" | sha256sum | cut -d' ' -f1) ;; *) prev= ;; esac + swarm=$(curl -sf -H "Authorization: Bearer $CONTINUUM_TOKEN" "$url/auth/whoami" | + jq -r .swarm) || die "no swarm from $url" # The exact bytes signed and sent: one line of JSON, no newline. - jq -cnj --arg path "$1" --argjson value "$2" --arg user "$user" \ + jq -cnj --arg swarm "$swarm" --arg path "$1" --argjson value "$2" --arg user "$user" \ --argjson at "$(date +%s)000" --arg prev "$prev" \ - '{path: ($path | split("/")), value: $value, user: $user, at: $at, prev: $prev}' \ + '{swarm: $swarm, path: ($path | split("/")), value: $value, user: $user, at: $at, prev: $prev}' \ >"$work/payload" || die "not JSON: $2" sign "$work/payload" continuum-value { cat "$work/payload"; echo; cat "$work/payload.sig"; } | -- cgit v1.3.1