## Summary
Validates and clamps the `tail` query parameter in `HandleAppLogs()` to prevent invalid values from reaching the Docker API.
### Changes
- Added `sanitizeTail()` helper function that:
- Validates the parameter is a positive integer
- Clamps to max 500
- Falls back to default (500) for empty, non-numeric, zero, or negative values
- Replaced inline tail handling with `sanitizeTail()` call
- Added comprehensive test suite (`tail_validation_test.go`) with 11 test cases
### Test Results
All tests pass. See comments for full output.
Closes #24
sneak
was assigned by clawbot2026-02-16 06:50:10 +01:00
- Add sanitizeTail() helper that validates tail is numeric and positive
- Clamp values to max 500
- Default to 500 when empty, non-numeric, zero, or negative
- Add comprehensive test cases
46 pre-existing issues (none introduced by this PR). The only lint note referencing new code:
tail_validation_test.go: testpackage suggests using handlers_test package, but internal package is needed to test the unexported sanitizeTail() function.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Validates and clamps the
tailquery parameter inHandleAppLogs()to prevent invalid values from reaching the Docker API.Changes
sanitizeTail()helper function that:sanitizeTail()calltail_validation_test.go) with 11 test casesTest Results
All tests pass. See comments for full output.
Closes #24
Test Results ✅
sanitizeTail unit tests
Full test suite (make test)
Lint Results (golangci-lint)
46 pre-existing issues (none introduced by this PR). The only lint note referencing new code:
tail_validation_test.go:testpackagesuggests usinghandlers_testpackage, but internal package is needed to test the unexportedsanitizeTail()function.