initial commit

Signed-off-by: ale <ale@manalejandro.com>
Este commit está contenido en:
ale
2025-11-16 17:20:37 +01:00
commit 9bf87efb79
Se han modificado 18 ficheros con 3435 adiciones y 0 borrados

94
test.sh Archivo ejecutable
Ver fichero

@@ -0,0 +1,94 @@
#!/bin/bash
# Quick test script for ActivityPub Security PoC
# This script demonstrates the main features
set -e
echo "================================================"
echo "ActivityPub Security PoC - Quick Test"
echo "================================================"
echo ""
# Check if node_modules exists
if [ ! -d "node_modules" ]; then
echo "📦 Installing dependencies..."
npm install
echo ""
fi
echo "🚀 Starting mock server in background..."
node src/cli.js mock-server --port 3000 > /tmp/mock-server.log 2>&1 &
MOCK_PID=$!
echo " Mock server PID: $MOCK_PID"
# Wait for server to start
sleep 3
echo ""
echo "================================================"
echo "Test 1: Fetch Actor Profile"
echo "================================================"
node src/cli.js fetch-actor --target http://localhost:3000/users/alice
echo ""
echo "================================================"
echo "Test 2: Fetch Outbox"
echo "================================================"
node src/cli.js test-outbox --target http://localhost:3000/users/alice/outbox
echo ""
echo "================================================"
echo "Test 3: Send Simple Note to Inbox"
echo "================================================"
node src/cli.js test-inbox \
--target http://localhost:3000/users/alice/inbox \
--content "Hello from security PoC test!" \
--actor https://example.com/users/tester
echo ""
echo "================================================"
echo "Test 4: Send Predefined Payload"
echo "================================================"
node src/cli.js test-inbox \
--target http://localhost:3000/users/bob/inbox \
--payload examples/create-note.json
echo ""
echo "================================================"
echo "Test 5: Craft Custom Activity"
echo "================================================"
node src/cli.js craft \
--type Follow \
--actor https://example.com/users/tester \
--object http://localhost:3000/users/alice
echo ""
echo "================================================"
echo "Test 6: Security Scan (Limited)"
echo "================================================"
node src/cli.js security-scan \
--target http://localhost:3000/users/alice/inbox \
--tests xss,injection \
--actor http://localhost:3000/users/alice
echo ""
echo "================================================"
echo "Tests Complete!"
echo "================================================"
echo ""
echo "📊 Check mock server logs:"
echo " tail -f /tmp/mock-server.log"
echo ""
echo "🛑 Stopping mock server (PID: $MOCK_PID)..."
kill $MOCK_PID 2>/dev/null || true
echo ""
echo "✅ All tests completed successfully!"
echo ""
echo "Next steps:"
echo " - Review the code in src/"
echo " - Read examples/USAGE.md for more examples"
echo " - Read docs/SECURITY_TESTING.md for testing methodology"
echo " - Start the mock server: npm run mock-server"
echo " - Run custom tests with: node src/cli.js --help"