Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b27a56a296 |
@@ -98,22 +98,22 @@ RUN gcc -static -O2 -Wall -Wextra -std=c99 \
|
||||
src/main.c src/config.c src/dm_admin.c src/request_validator.c \
|
||||
src/nip009.c src/nip011.c src/nip013.c src/nip040.c src/nip042.c \
|
||||
src/websockets.c src/subscriptions.c src/api.c src/embedded_web_content.c \
|
||||
-o /build/c_relay_static_musl \
|
||||
-o /build/c_relay_static \
|
||||
nostr_core_lib/libnostr_core_x64.a \
|
||||
-lwebsockets -lssl -lcrypto -lsqlite3 -lsecp256k1 \
|
||||
-lcurl -lz -lpthread -lm -ldl
|
||||
|
||||
# Strip binary to reduce size
|
||||
RUN strip /build/c_relay_static_musl
|
||||
RUN strip /build/c_relay_static
|
||||
|
||||
# Verify it's truly static
|
||||
RUN echo "=== Binary Information ===" && \
|
||||
file /build/c_relay_static_musl && \
|
||||
ls -lh /build/c_relay_static_musl && \
|
||||
file /build/c_relay_static && \
|
||||
ls -lh /build/c_relay_static && \
|
||||
echo "=== Checking for dynamic dependencies ===" && \
|
||||
(ldd /build/c_relay_static_musl 2>&1 || echo "Binary is static") && \
|
||||
(ldd /build/c_relay_static 2>&1 || echo "Binary is static") && \
|
||||
echo "=== Build complete ==="
|
||||
|
||||
# Output stage - just the binary
|
||||
FROM scratch AS output
|
||||
COPY --from=builder /build/c_relay_static_musl /c_relay_static_musl
|
||||
COPY --from=builder /build/c_relay_static /c_relay_static
|
||||
@@ -53,17 +53,17 @@ ARCH=$(uname -m)
|
||||
case "$ARCH" in
|
||||
x86_64)
|
||||
PLATFORM="linux/amd64"
|
||||
OUTPUT_NAME="c_relay_static_musl_x86_64"
|
||||
OUTPUT_NAME="c_relay_static_x86_64"
|
||||
;;
|
||||
aarch64|arm64)
|
||||
PLATFORM="linux/arm64"
|
||||
OUTPUT_NAME="c_relay_static_musl_arm64"
|
||||
OUTPUT_NAME="c_relay_static_arm64"
|
||||
;;
|
||||
*)
|
||||
echo "WARNING: Unknown architecture: $ARCH"
|
||||
echo "Defaulting to linux/amd64"
|
||||
PLATFORM="linux/amd64"
|
||||
OUTPUT_NAME="c_relay_static_musl_${ARCH}"
|
||||
OUTPUT_NAME="c_relay_static_${ARCH}"
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -107,14 +107,14 @@ $DOCKER_CMD build \
|
||||
--platform "$PLATFORM" \
|
||||
--target builder \
|
||||
-f "$DOCKERFILE" \
|
||||
-t c-relay-musl-builder-stage:latest \
|
||||
-t c-relay-static-builder-stage:latest \
|
||||
. > /dev/null 2>&1
|
||||
|
||||
# Create a temporary container to copy the binary
|
||||
CONTAINER_ID=$($DOCKER_CMD create c-relay-musl-builder-stage:latest)
|
||||
CONTAINER_ID=$($DOCKER_CMD create c-relay-static-builder-stage:latest)
|
||||
|
||||
# Copy binary from container
|
||||
$DOCKER_CMD cp "$CONTAINER_ID:/build/c_relay_static_musl" "$BUILD_DIR/$OUTPUT_NAME" || {
|
||||
$DOCKER_CMD cp "$CONTAINER_ID:/build/c_relay_static" "$BUILD_DIR/$OUTPUT_NAME" || {
|
||||
echo "ERROR: Failed to extract binary from container"
|
||||
$DOCKER_CMD rm "$CONTAINER_ID" 2>/dev/null
|
||||
exit 1
|
||||
@@ -180,7 +180,7 @@ echo "Binary: $BUILD_DIR/$OUTPUT_NAME"
|
||||
echo "Size: $(du -h "$BUILD_DIR/$OUTPUT_NAME" | cut -f1)"
|
||||
echo "Platform: $PLATFORM"
|
||||
if [ "$TRULY_STATIC" = true ]; then
|
||||
echo "Type: Fully static MUSL binary"
|
||||
echo "Type: Fully static binary (Alpine MUSL-based)"
|
||||
echo "Portability: Works on ANY Linux distribution"
|
||||
else
|
||||
echo "Type: Static binary (may have minimal dependencies)"
|
||||
|
||||
@@ -163,14 +163,15 @@ rm -f db/c_nostr_relay.db* 2>/dev/null
|
||||
echo "Embedding web files..."
|
||||
./embed_web_files.sh
|
||||
|
||||
# Build the project first - use static build by default
|
||||
# Build the project - ONLY static build
|
||||
echo "Building project (static binary with SQLite JSON1 extension)..."
|
||||
./build_static.sh
|
||||
|
||||
# Fallback to regular build if static build fails
|
||||
# Exit if static build fails - no fallback
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Static build failed, falling back to regular build..."
|
||||
make clean all
|
||||
echo "ERROR: Static build failed. Cannot proceed without static binary."
|
||||
echo "Please fix the build errors and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Restore database files if preserving
|
||||
@@ -187,37 +188,32 @@ if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if relay binary exists after build - prefer static binary, fallback to regular
|
||||
# Check if static relay binary exists after build - ONLY use static binary
|
||||
ARCH=$(uname -m)
|
||||
case "$ARCH" in
|
||||
x86_64)
|
||||
STATIC_BINARY="./build/c_relay_static_x86_64"
|
||||
REGULAR_BINARY="./build/c_relay_x86"
|
||||
BINARY_PATH="./build/c_relay_static_x86_64"
|
||||
;;
|
||||
aarch64|arm64)
|
||||
STATIC_BINARY="./build/c_relay_static_arm64"
|
||||
REGULAR_BINARY="./build/c_relay_arm64"
|
||||
BINARY_PATH="./build/c_relay_static_arm64"
|
||||
;;
|
||||
*)
|
||||
STATIC_BINARY="./build/c_relay_static_$ARCH"
|
||||
REGULAR_BINARY="./build/c_relay_$ARCH"
|
||||
BINARY_PATH="./build/c_relay_static_$ARCH"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Prefer static binary if available
|
||||
if [ -f "$STATIC_BINARY" ]; then
|
||||
BINARY_PATH="$STATIC_BINARY"
|
||||
echo "Using static binary: $BINARY_PATH"
|
||||
elif [ -f "$REGULAR_BINARY" ]; then
|
||||
BINARY_PATH="$REGULAR_BINARY"
|
||||
echo "Using regular binary: $BINARY_PATH"
|
||||
else
|
||||
echo "ERROR: No relay binary found. Checked:"
|
||||
echo " - $STATIC_BINARY"
|
||||
echo " - $REGULAR_BINARY"
|
||||
# Verify static binary exists - no fallbacks
|
||||
if [ ! -f "$BINARY_PATH" ]; then
|
||||
echo "ERROR: Static relay binary not found: $BINARY_PATH"
|
||||
echo ""
|
||||
echo "The relay requires the static binary with JSON1 support."
|
||||
echo "Please run: ./build_static.sh"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Using static binary: $BINARY_PATH"
|
||||
|
||||
echo "Build successful. Proceeding with relay restart..."
|
||||
|
||||
# Kill existing relay if running - start aggressive immediately
|
||||
|
||||
28
test_results_20251011_105627.log
Normal file
28
test_results_20251011_105627.log
Normal file
@@ -0,0 +1,28 @@
|
||||
2025-10-11 10:56:27 - ==========================================
|
||||
2025-10-11 10:56:27 - C-Relay Comprehensive Test Suite Runner
|
||||
2025-10-11 10:56:27 - ==========================================
|
||||
2025-10-11 10:56:27 - Relay URL: ws://127.0.0.1:8888
|
||||
2025-10-11 10:56:27 - Log file: test_results_20251011_105627.log
|
||||
2025-10-11 10:56:27 - Report file: test_report_20251011_105627.html
|
||||
2025-10-11 10:56:27 -
|
||||
2025-10-11 10:56:27 - Checking relay status at ws://127.0.0.1:8888...
|
||||
2025-10-11 10:56:27 - \033[0;32m✓ Relay HTTP endpoint is accessible\033[0m
|
||||
2025-10-11 10:56:27 -
|
||||
2025-10-11 10:56:27 - Starting comprehensive test execution...
|
||||
2025-10-11 10:56:27 -
|
||||
2025-10-11 10:56:27 - \033[0;34m=== SECURITY TEST SUITES ===\033[0m
|
||||
2025-10-11 10:56:27 - ==========================================
|
||||
2025-10-11 10:56:27 - Running Test Suite: SQL Injection Tests
|
||||
2025-10-11 10:56:27 - Description: Comprehensive SQL injection vulnerability testing
|
||||
2025-10-11 10:56:27 - ==========================================
|
||||
==========================================
|
||||
C-Relay SQL Injection Test Suite
|
||||
==========================================
|
||||
Testing against relay at ws://127.0.0.1:8888
|
||||
|
||||
=== Basic Connectivity Test ===
|
||||
Testing Basic connectivity... [0;32mPASSED[0m - Valid query works
|
||||
|
||||
=== Authors Filter SQL Injection Tests ===
|
||||
Testing Authors filter with payload: '; DROP TABLE events; --... [1;33mUNCERTAIN[0m - Connection timeout (may indicate crash)
|
||||
2025-10-11 10:56:32 - \033[0;31m✗ SQL Injection Tests FAILED\033[0m (Duration: 5s)
|
||||
Reference in New Issue
Block a user