Skip to content

Commit 65dbd16

Browse files
Lars Kroehlclaude
andcommitted
fix(sprint-1.2.2): PR number, code paths, admin-key auth in verify
README: PR #67 -> PR #70 (actual PR number after #68/#69 landed). 02_code_patches.md: intro names both files - Patch 1 in app/swarm/trust_score.py (compute_phase2_score), Patch 2+3 in app/main.py; Patch 3 header path made explicit. 03_verify_post_deploy.sh Block 6: sources ADMIN_KEY from ~/.moltrust_secrets and sends x-admin-key header, skips gracefully when key absent or auth fails, only fails on real validator miss. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 28123e5 commit 65dbd16

3 files changed

Lines changed: 26 additions & 10 deletions

File tree

‎migrations/sprint-1.2.2/02_code_patches.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Sprint 1.2.2 — Code-Patches
22

3-
Drei Änderungen an `~/moltstack/app/main.py` (und ggf. `app/scoring.py`).
3+
Änderungen an `~/moltstack/app/swarm/trust_score.py` (Patch 1) und `~/moltstack/app/main.py` (Patch 2 + 3).
44

55
## Patch 1: Sybil-Penalty Whitelist für Seed-DIDs
66

@@ -50,7 +50,7 @@ Wirkung: Blockiert NUR neue Seed-POSTs mit Vanity-DIDs. Bestehende Lookups auf `
5050

5151
## Patch 3: avg_trust_score-Aggregation in /swarm/stats
5252

53-
Handler von `GET /swarm/stats`:
53+
Handler von `GET /swarm/stats` in `app/main.py`:
5454

5555
```python
5656
avg = conn.execute("""

‎migrations/sprint-1.2.2/03_verify_post_deploy.sh‎

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,30 @@ done
7373

7474
echo ""
7575
echo "=== 6. SeedRequest-Validator (Patch 2) ==="
76-
V=$(curl -s -m 10 -o /dev/null -w "%{http_code}" \
77-
-X POST "$BASE/swarm/seed" -H 'Content-Type: application/json' \
78-
-d '{"did":"did:moltrust:newvanity","label":"x","base_score":50}')
79-
if [[ "$V" == "422" ]]; then
80-
echo " ✓ Vanity-DID rejected (422)"
76+
if [[ -f ~/.moltrust_secrets ]]; then
77+
set -a; source ~/.moltrust_secrets; set +a
78+
fi
79+
if [[ -z "${ADMIN_KEY:-}" ]]; then
80+
echo " ⚠ ADMIN_KEY nicht gesetzt — Block 6 übersprungen"
81+
echo " Manueller Test:"
82+
echo " curl -X POST $BASE/swarm/seed -H 'x-admin-key: \$ADMIN_KEY' \\"
83+
echo " -H 'Content-Type: application/json' \\"
84+
echo " -d '{\"did\":\"did:moltrust:newvanity\",\"label\":\"x\",\"base_score\":50}'"
85+
echo " Erwartet: 422 Validation Error"
8186
else
82-
echo " ✗ Vanity-DID accepted (HTTP $V) — Validator wirkt nicht"
83-
FAIL=$((FAIL+1))
87+
V=$(curl -s -m 10 -o /dev/null -w "%{http_code}" \
88+
-X POST "$BASE/swarm/seed" \
89+
-H "x-admin-key: $ADMIN_KEY" \
90+
-H 'Content-Type: application/json' \
91+
-d '{"did":"did:moltrust:newvanity","label":"x","base_score":50}')
92+
if [[ "$V" == "422" ]]; then
93+
echo " ✓ Vanity-DID rejected (422)"
94+
elif [[ "$V" == "401" || "$V" == "403" ]]; then
95+
echo " ⚠ Auth fehlgeschlagen (HTTP $V) — ADMIN_KEY prüfen, Block übersprungen"
96+
else
97+
echo " ✗ Vanity-DID accepted (HTTP $V) — Validator wirkt nicht"
98+
FAIL=$((FAIL+1))
99+
fi
84100
fi
85101

86102
echo ""

‎migrations/sprint-1.2.2/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PR #67 — Sprint 1.2.2: Seed-Konsolidierung + Score-Härtung
1+
# PR #70 — Sprint 1.2.2: Seed-Konsolidierung + Score-Härtung
22

33
**Repo:** moltrust-api · **Voraussetzung:** PR #66 deployed
44
**Reviewer:** §2.3 Cross-Review (GPT-4o + Gemini + Perplexity)

0 commit comments

Comments
 (0)