@@ -482,28 +482,6 @@ jobs:
482482 echo "########################################################"
483483 npm run test:v2:live:wallet-health
484484 echo "########################################################"
485- echo "Waiting for non-home project from governance sync"
486- echo "########################################################"
487- MAX_WAIT=600
488- ELAPSED=0
489- while [ "$ELAPSED" -lt "$MAX_WAIT" ]; do
490- PROJECTS=$(curl -s "http://${TEST_API_HOST:-127.0.0.1}:31310/v2/project?page=1&limit=100" 2>/dev/null || echo "[]")
491- NON_HOME=$(echo "$PROJECTS" | jq '[
492- (if type == "object" then .data else . end)[]
493- | select(.orgUid != null and .orgUid != "'"$(curl -s "http://${TEST_API_HOST:-127.0.0.1}:31310/v2/organizations" 2>/dev/null | jq -r 'to_entries[] | select(.value.isHome == true) | .key')"'")
494- ] | length' 2>/dev/null || echo "0")
495- if [ "$NON_HOME" -gt 0 ] 2>/dev/null; then
496- echo "Found $NON_HOME non-home project(s) after ${ELAPSED}s"
497- break
498- fi
499- echo "No non-home projects yet (${ELAPSED}s / ${MAX_WAIT}s)..."
500- sleep 30
501- ELAPSED=$((ELAPSED + 30))
502- done
503- if [ "$ELAPSED" -ge "$MAX_WAIT" ]; then
504- echo "WARNING: No non-home projects appeared after ${MAX_WAIT}s. Ownership guard tests will fail."
505- fi
506- echo "########################################################"
507485 echo "Running data tests"
508486 echo "########################################################"
509487 npm run test:v2:live:data:short
@@ -4383,68 +4361,6 @@ jobs:
43834361 fi
43844362 echo "All AEF data matches expected values"
43854363
4386- - name : Verify ownership guards block non-home mutations
4387- shell : bash
4388- run : |
4389- echo "########################################################"
4390- echo "Verifying ownership guards reject non-home org mutations"
4391- echo "########################################################"
4392- BASE="http://127.0.0.1:31310/v2"
4393- ERRORS=0
4394-
4395- PROJECT=$(curl -s "$BASE/project?page=1&limit=1" | jq '(if type == "object" then .data else . end)[0]')
4396- PROJECT_ID=$(echo "$PROJECT" | jq -r '.cadTrustProjectId')
4397- echo "Using synced project: $PROJECT_ID"
4398-
4399- echo ""
4400- echo "--- PUT update on non-home project (expect 400) ---"
4401- PUT_RESP=$(curl -s -w "\n%{http_code}" -X PUT "$BASE/project/$PROJECT_ID" \
4402- -H "Content-Type: application/json" \
4403- -d "{\"projectName\": \"Should Not Update $(date +%s)\"}")
4404- PUT_HTTP=$(echo "$PUT_RESP" | tail -1)
4405- PUT_BODY=$(echo "$PUT_RESP" | head -n -1)
4406- if [ "$PUT_HTTP" = "400" ]; then
4407- echo " PASS: PUT returned 400"
4408- if echo "$PUT_BODY" | jq -r '.error' 2>/dev/null | grep -q "Restricted data"; then
4409- echo " PASS: Error contains 'Restricted data'"
4410- else
4411- echo " FAIL: Expected 'Restricted data' in error body"
4412- echo " Body: $PUT_BODY"
4413- ERRORS=$((ERRORS + 1))
4414- fi
4415- else
4416- echo " FAIL: Expected HTTP 400, got $PUT_HTTP"
4417- echo " Body: $PUT_BODY"
4418- ERRORS=$((ERRORS + 1))
4419- fi
4420-
4421- echo ""
4422- echo "--- DELETE on non-home project (expect 400) ---"
4423- DEL_RESP=$(curl -s -w "\n%{http_code}" -X DELETE "$BASE/project/$PROJECT_ID")
4424- DEL_HTTP=$(echo "$DEL_RESP" | tail -1)
4425- DEL_BODY=$(echo "$DEL_RESP" | head -n -1)
4426- if [ "$DEL_HTTP" = "400" ]; then
4427- echo " PASS: DELETE returned 400"
4428- if echo "$DEL_BODY" | jq -r '.error' 2>/dev/null | grep -q "Restricted data"; then
4429- echo " PASS: Error contains 'Restricted data'"
4430- else
4431- echo " FAIL: Expected 'Restricted data' in error body"
4432- echo " Body: $DEL_BODY"
4433- ERRORS=$((ERRORS + 1))
4434- fi
4435- else
4436- echo " FAIL: Expected HTTP 400, got $DEL_HTTP"
4437- echo " Body: $DEL_BODY"
4438- ERRORS=$((ERRORS + 1))
4439- fi
4440-
4441- echo ""
4442- if [ "$ERRORS" -gt 0 ]; then
4443- echo "FAILED: $ERRORS ownership guard checks failed"
4444- exit 1
4445- fi
4446- echo "All ownership guard checks passed"
4447-
44484364 - name : Show CADT logs after tests
44494365 if : always()
44504366 shell : bash
0 commit comments