Skip to content

feat: add configurable log line length limits to prevent DoS attacks#51

Merged
GingerGraham merged 2 commits intofix/bug-fixes-feb-2026-phase-01from
bug/41-log-length-limits
Feb 6, 2026
Merged

feat: add configurable log line length limits to prevent DoS attacks#51
GingerGraham merged 2 commits intofix/bug-fixes-feb-2026-phase-01from
bug/41-log-length-limits

Conversation

@GingerGraham
Copy link
Owner

Copilot AI review requested due to automatic review settings February 6, 2026 09:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request implements configurable log line length limits as a defense-in-depth measure against denial-of-service attacks through excessively large log messages. It addresses issue #41 which identified that the library lacked input length limits, potentially allowing rapid disk space consumption, performance degradation, and journal message size issues.

Changes:

  • Adds _truncate_log_message() internal function with robust edge case handling for message truncation
  • Implements separate configurable limits for console/file output (LOG_MAX_LINE_LENGTH) and journal output (LOG_MAX_JOURNAL_LENGTH) with 4096-byte defaults
  • Provides CLI flags (--max-line-length, --max-journal-length) and configuration file options for customization

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
logging.sh Core implementation: adds global limit variables, _truncate_log_message() function, CLI argument parsing, config file parsing, and integration into message logging flow
tests/test_output.sh Adds functional test for message truncation with formatted output validation
tests/test_config.sh Adds test for configuration file parsing of length limit settings
docs/initialization.md Documents new CLI options in initialization reference
docs/configuration.md Documents configuration keys, aliases, defaults, and example usage
docs/api-reference.md Updates API reference table with new initialization options
docs/journal-logging.md Explains DoS mitigation context for journal message limits
configuration/logging.conf.example Adds example configuration with comments
README.md Adds DoS resistance feature to highlights list

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Graham Watts <34165628+GingerGraham@users.noreply.github.com>
@GingerGraham GingerGraham merged commit 1203292 into fix/bug-fixes-feb-2026-phase-01 Feb 6, 2026
2 checks passed
@GingerGraham GingerGraham deleted the bug/41-log-length-limits branch February 6, 2026 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant