SeaWolf-AI commited on
Commit
e1de877
·
verified ·
1 Parent(s): 43e8dc0

Audit view: hide record hashes for other players too

Browse files
Files changed (2) hide show
  1. live_apps.js +2 -1
  2. server.py +1 -0
live_apps.js CHANGED
@@ -607,7 +607,8 @@ async function verifyLines(lines) {
607
  const chain = m.get('chain'), prev = m.get('prev'), seq = m.get('seq');
608
  m.delete('chain');
609
  const want = await sha256hex((prev ?? '') + canon(m));
610
- if (!m.get('args_hidden') && want !== chain) errs.push({k, seq:seq && seq.__num, msg:'hash mismatch'});
 
611
  if (prevChain != null && prev !== prevChain) errs.push({k, seq:seq && seq.__num, msg:'prev does not link to previous chain'});
612
  prevChain = chain;
613
  }
 
607
  const chain = m.get('chain'), prev = m.get('prev'), seq = m.get('seq');
608
  m.delete('chain');
609
  const want = await sha256hex((prev ?? '') + canon(m));
610
+ if (m.get('args_hidden')) { prevChain = null; continue; } // hidden records are verified by the server
611
+ if (want !== chain) errs.push({k, seq:seq && seq.__num, msg:'hash mismatch'});
612
  if (prevChain != null && prev !== prevChain) errs.push({k, seq:seq && seq.__num, msg:'prev does not link to previous chain'});
613
  prevChain = chain;
614
  }
server.py CHANGED
@@ -92,6 +92,7 @@ class H(SimpleHTTPRequestHandler):
92
  try:
93
  o = json.loads(ln) if isinstance(ln, str) else dict(ln)
94
  o["args"] = "[hidden during the hackathon]"; o["args_hidden"] = True
 
95
  out.append(json.dumps(o, ensure_ascii=False) if isinstance(ln, str) else o)
96
  except Exception: # noqa: BLE001
97
  continue # a record that cannot be parsed is not passed on
 
92
  try:
93
  o = json.loads(ln) if isinstance(ln, str) else dict(ln)
94
  o["args"] = "[hidden during the hackathon]"; o["args_hidden"] = True
95
+ o["chain"] = o["prev"] = "[hidden]" # a hash over the record would let anyone test guesses of the hidden arguments
96
  out.append(json.dumps(o, ensure_ascii=False) if isinstance(ln, str) else o)
97
  except Exception: # noqa: BLE001
98
  continue # a record that cannot be parsed is not passed on