Security hardening: path traversal, TLS verification, DOS protections (#112-#118) #138
Reference in New Issue
Block a user
Delete Branch "fix/security-hardening"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes 7 security issues:\n- #118: TLS cert verification when CA provided\n- #117: Reduce MAX_DATA_SIZE to 256MB + per-connection memory tracking\n- #116: Per-message receive timeout (60s)\n- #115: Dynamic SSH buffer instead of fixed 512-byte stack\n- #114: Integer overflow check in delta_signature_deserialize\n- #113: Connection limit (100) to prevent fork bomb\n- #112: Proper path traversal check with has_path_traversal()
=== PR #138 REVIEW ===
Branch: fix/security-hardening
Files: 23 changed (658 insertions, 88 deletions)
=== SUMMARY ===
This PR adds security hardening (path traversal detection, keepalive/abort mechanism, memory limits), new CLI flags (--quiet, --backup, --stats, --timeout, --contimeout, --exclude-from, --include-from, --log-file, --queue-size, --max-depth), batch incremental checking, and SIGINT/SIGTERM handling.
=== ISSUES ===
[WARNING-1] src/shared/utils.c:152-169 — has_path_traversal
Correctly splits on "/" and rejects ".." segments. However, symlinks pointing to parent directories bypass this string-level check. Consider adding realpath(3) resolution after path concatenation.
[WARNING-2] src/shared/utils.c:12-51 — mkdir_r
Uses strcpy/strcat manual construction with pointer arithmetic. While buffer sizing appears correct, this pattern is fragile. Recommend snprintf with explicit bounds.
[STYLE-1] src/shared/protocol.c:19-21 — io_bwlimit globals
io_bwlimit, bw_tokens, bw_last_refill are file-scope globals (not thread_local). Safe today (only sender thread calls bw_throttle) but fragile.
[STYLE-2] src/client/client_cli.c:80 — read_patterns_from_file
Fixed char line[4096] stack buffer. Lines >4095 chars get truncated. Consider dynamic sizing or a larger buffer.
=== POSITIVES ===
=== VERDICT ===
No critical issues found. APPROVED.
bcea8412dato7d14d2b672Pull request closed