release: version 1.0.2 - Audit security fixes and RPM packaging

Security hardening:
- Add input sanitization for method (32), path (2048), host (256), http_version (16)
- Prevent log injection via oversized HTTP values
- Add LOG_THROTTLED macro for consistent error reporting
- Improve socket state double-check pattern to avoid unnecessary reconnects

Code quality:
- Fix const qualifier warnings in get_header()
- Add flags field to module definition
- Add -Wno-error=format-security for compatibility

Documentation:
- Clarify timestamp precision (microseconds expressed as nanoseconds)
- Update README and architecture.yml

Testing:
- Add 4 unit tests for input sanitization
- All 78 tests passing

Packaging:
- Remove DEB package support (RPM only: el8, el9, el10)
- Add CHANGELOG file included in RPM packages
- Bump version to 1.0.2

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
Jacquin Antoine
2026-02-28 21:45:06 +01:00
parent d0ca0a7e4c
commit c2e1221e5a
8 changed files with 223 additions and 140 deletions

View File

@ -6,7 +6,7 @@ APXS ?= apxs
# Compiler settings
CC ?= gcc
CFLAGS ?= -Wall -Wextra -O2 -std=gnu11 -x c
CFLAGS ?= -Wall -Wextra -O2 -std=gnu11 -x c -Wno-error=format-security
# Directories
SRC_DIR = src
@ -21,7 +21,7 @@ SRCS = $(SRC_DIR)/mod_reqin_log.c
MODULE_NAME = mod_reqin_log
# Package version
VERSION ?= 1.0.0
VERSION ?= 1.0.2
.PHONY: all clean install uninstall test package package-deb package-rpm
@ -80,39 +80,27 @@ debug: CFLAGS += -g -DDEBUG
debug: clean all
# =============================================================================
# Packaging (DEB + RPM with Docker + fpm)
# Dockerfile.package builds all packages in a single multi-stage build:
# - 1 DEB package (Debian/Ubuntu)
# Packaging (RPM with Docker + fpm)
# Dockerfile.package builds RPMs in a single multi-stage build:
# - 3 RPM packages (el8, el9, el10 for RHEL/Rocky/AlmaLinux compatibility)
# =============================================================================
## package: Build all packages (deb + rpm for el8, el9, el10)
## package: Build all RPM packages (el8, el9, el10)
package:
mkdir -p $(DIST_DIR)/deb $(DIST_DIR)/rpm
mkdir -p $(DIST_DIR)/rpm
docker build --target output -t mod_reqin_log:packager \
--build-arg VERSION=$(VERSION) \
-f Dockerfile.package .
@echo "Extracting packages from Docker image..."
docker run --rm -v $(PWD)/$(DIST_DIR):/output mod_reqin_log:packager \
sh -c 'cp -r /packages/deb/* /output/deb/ && cp -r /packages/rpm/* /output/rpm/'
sh -c 'cp -r /packages/rpm/* /output/rpm/'
@echo "Packages created:"
@echo " DEB:"
@ls -la $(DIST_DIR)/deb/
@echo " RPM (el8, el9, el10):"
@ls -la $(DIST_DIR)/rpm/
## package-deb: Build DEB package (built together with RPMs in Dockerfile.package)
package-deb: package
@echo "DEB package built together with RPMs in Dockerfile.package"
## package-rpm: Build RPM packages (el8, el9, el10 built together in Dockerfile.package)
## package-rpm: Build RPM packages (el8, el9, el10)
package-rpm: package
@echo "RPM packages built together with DEB in Dockerfile.package"
## test-package-deb: Test DEB package installation in Docker
test-package-deb: package
docker run --rm -v $(PWD)/$(DIST_DIR)/deb:/packages:ro debian:latest \
sh -c "apt-get update && apt-get install -y /packages/*.deb && echo 'DEB install OK'"
@echo "RPM packages built in Dockerfile.package"
## test-package-rpm: Test RPM package installation in Docker (tests el9 by default)
test-package-rpm: package
@ -134,8 +122,8 @@ test-package-rpm-el10: package
docker run --rm -v $(PWD)/$(DIST_DIR)/rpm:/packages:ro almalinux:10 \
sh -c "dnf install -y /packages/*.el10.*.rpm && echo 'RPM el10 install OK'"
## test-package: Test all packages installation
test-package: test-package-deb test-package-rpm-el8 test-package-rpm-el9 test-package-rpm-el10
## test-package: Test all RPM packages installation
test-package: test-package-rpm-el8 test-package-rpm-el9 test-package-rpm-el10
# Help target
help:
@ -148,14 +136,13 @@ help:
@echo " clean - Remove build artifacts"
@echo " test - Run unit tests"
@echo " debug - Build with debug symbols"
@echo " package - Build all packages (deb + rpm for el8, el9, el10)"
@echo " package-deb - Build DEB package"
@echo " package - Build all RPM packages (el8, el9, el10)"
@echo " package-rpm - Build RPM packages"
@echo " test-package - Test package installation"
@echo " test-package - Test RPM package installation"
@echo ""
@echo "Variables:"
@echo " APXS - Path to apxs tool (default: apxs)"
@echo " CC - C compiler (default: gcc)"
@echo " CFLAGS - Compiler flags (default: -Wall -Wextra -O2)"
@echo " DESTDIR - Installation destination (default: /)"
@echo " VERSION - Package version (default: 1.0.0)"
@echo " VERSION - Package version (default: 1.0.2)"