Repository navigation
Description
Partial SEO updates can never verify: the client and server sign different canonical payloads
RelayClient.heartbeat_seo (client) builds the request body with only the fields the caller supplies, then signs:
if seo_url is not None:
body["seo_url"] = seo_url
if seo_description is not None:
body["seo_description"] = seo_description
...
body["signature"] = identity.sign_hex(
self.build_seo_signature_payload(
identity.agent_id,
body.get("seo_url", "") or "", # "" when not supplied
body.get("seo_description", "") or "", # "" when not supplied
ts_value, nonce,
)
)The server (atlas/beacon_chat.py, relay_heartbeat_seo) deliberately supports partial updates and rebuilds the payload from merged values:
target_seo_url = seo_url if seo_url_present else current_seo_url
target_seo_description = seo_description if seo_description_present else current_seo_description
sig_payload = build_relay_seo_signature_payload(
agent_id, target_seo_url, target_seo_description, ts_value, nonce,
)
sig_ok = verify_ed25519(stored_pubkey_hex, signature_hex, sig_payload)So when an agent updates only its description and has a stored seo_url, the client signs seo_url: "" while the server verifies against the stored URL. The canonical bytes differ, verify_ed25519 returns False, and the server answers 400 Invalid Ed25519 signature. The same happens for a URL-only update once a description is stored.
Practical effect: once an agent has one SEO field set, the other can never be updated on its own; the caller must re-send both fields on every change. A fresh agent with both stored fields empty works, which is why this is easy to miss.
Reproduction
This runs the two real payload builders from the repository — build_relay_seo_signature_payload from atlas/beacon_chat.py and build_seo_signature_payload from beacon_skill/transports/relay.py — and replays each side's own field-selection logic. No keys, network, or signature forgery: it only compares the two byte strings the client and server would each use.
import ast
import json
from urllib.request import urlopen
SERVER_URL = 'https://raw.githubusercontent.com/Scottcjn/beacon-skill/main/atlas/beacon_chat.py'
CLIENT_URL = 'https://raw.githubusercontent.com/Scottcjn/beacon-skill/main/beacon_skill/transports/relay.py'
def load_function(url, name, extra_globals=None):
source = urlopen(url, timeout=40).read().decode()
tree = ast.parse(source)
node = next(n for n in ast.walk(tree) if isinstance(n, ast.FunctionDef) and n.name == name)
namespace = {'json': json}
if extra_globals:
namespace.update(extra_globals)
exec(compile(ast.fix_missing_locations(ast.Module(body=[node], type_ignores=[])), url, 'exec'), namespace)
return namespace[name]
server_payload = load_function(SERVER_URL, 'build_relay_seo_signature_payload')
client_payload = load_function(CLIENT_URL, 'build_seo_signature_payload')
agent_id = 'fixture-agent'
ts_value = 1791000000
nonce = 'seo-1791000000000'
# The agent already has a stored seo_url from an earlier successful update.
stored_seo_url = 'https://fixture.example/'
stored_seo_description = ''
# Partial update: the caller changes ONLY the description (seo_url=None),
# which the server explicitly supports via the *_present flags.
requested_seo_url = None
requested_seo_description = 'Updated description for my agent profile'
# --- Server side (verbatim logic from relay_heartbeat_seo) ---
target_seo_url = requested_seo_url if requested_seo_url is not None else stored_seo_url
target_seo_description = (requested_seo_description if requested_seo_description is not None
else stored_seo_description)
server_bytes = server_payload(agent_id, target_seo_url, target_seo_description, ts_value, nonce)
# --- Client side (verbatim logic from RelayClient.heartbeat_seo) ---
body = {'agent_id': agent_id, 'status': 'alive'}
if requested_seo_url is not None:
body['seo_url'] = requested_seo_url
if requested_seo_description is not None:
body['seo_description'] = requested_seo_description
client_bytes = client_payload(
agent_id,
body.get('seo_url', '') or '',
body.get('seo_description', '') or '',
ts_value,
nonce,
)
# Control: a full update where both fields are supplied in the request.
full_request_url = 'https://fixture.example/new'
full_request_description = 'Updated description for my agent profile'
full_client = client_payload(agent_id, full_request_url, full_request_description, ts_value, nonce)
full_server = server_payload(agent_id, full_request_url, full_request_description, ts_value, nonce)
print(json.dumps({
'scenario': 'partial update: description supplied, seo_url omitted',
'stored_seo_url_used_by_server': target_seo_url,
'client_signed_seo_url': body.get('seo_url', '') or '',
'client_payload': client_bytes.decode(),
'server_payload': server_bytes.decode(),
'payloads_identical': client_bytes == server_bytes,
'control_full_update_payloads_identical': full_client == full_server,
}, indent=2))Output:
{
"scenario": "partial update: description supplied, seo_url omitted",
"stored_seo_url_used_by_server": "https://fixture.example/",
"client_signed_seo_url": "",
"client_payload": "{\"agent_id\":\"fixture-agent\",\"nonce\":\"seo-1791000000000\",\"seo_description\":\"Updated description for my agent profile\",\"seo_url\":\"\",\"ts\":1791000000}",
"server_payload": "{\"agent_id\":\"fixture-agent\",\"nonce\":\"seo-1791000000000\",\"seo_description\":\"Updated description for my agent profile\",\"seo_url\":\"https://fixture.example/\",\"ts\":1791000000}",
"payloads_identical": false,
"control_full_update_payloads_identical": true
}
The control case confirms the canonical form itself is fine: when both fields are supplied in the request, the client and server payloads are byte-identical. The mismatch appears only when a field is omitted from the request but already stored.
Suggested fix: either have the client send the currently stored value for any field it omits (and document that contract), or have the server verify against the values the client could have signed, or drop the signature requirement when only one field changes and enforce attribution another way. Whichever route, client and server must agree on one canonical rule for partial updates.
Scope note: this is a fail-closed rejection of legitimate updates. No signature was forged or bypassed, and no live agent or relay was touched.
Duplicate screening: beacon-skill "heartbeat_seo" and beacon-skill "build_seo_signature_payload" returned 0. Issue #137 ("Subtask: signed SEO heartbeat updates with change log for public backlink fields") is the closed feature request that introduced this signing path; it does not report the partial-update mismatch.
AI assistance disclosure: source inspection, local reproduction and report preparation were AI-assisted.
Activity