feat: add configurable log line length limits to prevent DoS attacks#51
Merged
GingerGraham merged 2 commits intofix/bug-fixes-feb-2026-phase-01from Feb 6, 2026
Merged
Conversation
Owner
GingerGraham
commented
Feb 6, 2026
- fixes [BUG] No Input Length Limits #41
Contributor
There was a problem hiding this comment.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.