Repository navigation
fix: reject target paths and section names with a trailing newline - #116
Merged
Merged
Conversation
Without the D modifier, $ matches before a final newline, so TargetPath::fromString("Europe/gw1\n") succeeded and stored a target no SmokePing section can match.
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
somethingwithproof
added a commit
that referenced
this pull request
Nov 20, 2026
) Follow-up to #116 Intent: #116 added the `D` modifier to three patterns; `SummaryScript::parse` and other whole-string checks still ended in `$` and accepted a trailing newline (`12~berlin\n`). Changed: `D` on the series argument, the CLI numeric options, `ConfigSchema::coerce`, `LossColors` version parsing, `SmokepingInventory::intOrNull`, the YAML hex escape and `YamlScalar::classify`. `Row`'s numeric check is untouched: it trims whitespace by design. Tests: unit cases with a trailing newline for the series, versions, int coercion and YAML classification; six fail without the change. Verification: Pest (locked harness, php:8.4-cli) 584 passed, 1 skipped. Risk: low; only inputs ending in a newline change, and they are now refused. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Improved validation of numeric values, versions, YAML escapes, and summary inputs. Trailing newlines or extra characters are no longer accepted as valid matches, and affected values are handled as strings or rejected as appropriate. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: Thomas Vincent <thomasvincent@gmail.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.



Fixes #114
The only item in the checklist: the SEGMENT and LOCATION patterns in TargetPath, and the
sectionsfilter in smokeping_import.php, ended in$without theDmodifier, so a trailing newline passed. An imported path ending in a newline was stored as a target that can never match a SmokePing section.Added the
Dmodifier to all three patterns. Unit cases added for "gw1\n", "Europe/gw1\n", "Europe\n/gw1" and a location "sydney\n"; four of them fail without the change.Verification (php:8.4-cli, locked Pest harness): pest --configuration=phpunit.xml, 554 passed, 1 skipped. php -l on PHP 8.0 for smokeping_import.php clean.
Risk: low; inputs that were wrongly accepted are now refused.