You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add query length validation and input sanitization
Add configurable query expression length limits to prevent resource exhaustion
from overly complex queries, and implement comprehensive input validation to
reject control characters in client library parameters.
Changes:
- Add api.max_query_length config parameter (default: 128, 0 = unlimited)
- Implement query length calculation across search text, AND/NOT terms, filters, and ORDER BY
- Add QueryParser::SetMaxQueryLength() for runtime configuration
- Apply length validation in both SEARCH and COUNT commands
- Add control character detection in MygramClient for all string inputs
- Update config schema, examples, and documentation (EN/JA)
- Add serialization support for new config parameter in dump format
- Add comprehensive unit tests for validation logic
- Update documentation to explain query length limits and error handling
This improves security by preventing injection attacks through control
characters and guards against resource exhaustion from unbounded query
complexity.
0 commit comments