fix: add input validation to event emitter + add test report

- archeflow-event.sh: validate JSON data and parent format before processing
- docs/test-report: 42/42 tests passed across all 8 lib scripts
This commit is contained in:
2026-04-03 12:06:57 +02:00
parent 9e22ff5822
commit 9bf64fc8f0
2 changed files with 490 additions and 1 deletions

View File

@@ -45,11 +45,20 @@ fi
TS=$(date -u +%Y-%m-%dT%H:%M:%SZ)
# Validate JSON data
if ! echo "$DATA" | jq empty 2>/dev/null; then
echo "Error: invalid JSON in data argument: $DATA" >&2
exit 1
fi
# Build parent array from comma-separated seq numbers
if [[ -z "$PARENT_RAW" ]]; then
PARENT_JSON="[]"
else
elif [[ "$PARENT_RAW" =~ ^[0-9]+(,[0-9]+)*$ ]]; then
PARENT_JSON="[${PARENT_RAW}]"
else
echo "Error: invalid parent format (expected comma-separated integers): $PARENT_RAW" >&2
exit 1
fi
# Construct the event using jq for reliable JSON assembly