-
Notifications
You must be signed in to change notification settings - Fork 834
WW-5256 Add configurable FreeMarker whitespace stripping and compress tag #1418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lukaszlenart
wants to merge
12
commits into
main
Choose a base branch
from
feature/WW-5256-freemarker-compress
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,828
−109
Conversation
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
- Add struts.freemarker.whitespaceStripping configuration option - Automatically disable whitespace stripping in devMode - Add @SInCE 7.2.0 tags to new Compress component and configuration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add struts.compress.enabled configuration option - Compress tag respects global setting unless force=true - Add @SInCE 7.2.0 tag to new constant 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add tests for global compression disabled setting - Add test for force attribute overriding global setting - Update compress tag documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Test whitespace stripping enabled by default - Test whitespace stripping disabled via configuration - Test whitespace stripping disabled in devMode - Test whitespace stripping enabled when not in devMode 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…ation Replace complex CompressWriter (125 lines) with simple regex-based compression (15 lines). Remove bufferSize parameter as buffering is no longer needed when processing strings directly. Update tests to remove buffer-related test cases. - Remove CompressWriter inner class and state machine - Add compressWhitespace() static method using regex - Remove bufferSize field and setter from Compress and CompressTag - Remove 3 buffer-related tests from CompressTest - Remove 1 buffer-related test from CompressTagTest - All remaining 19 tests pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add documentation for the singleLine attribute in compress tag. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
0be3e9e to
2fa7671
Compare
Add configurable size limits and log truncation to prevent: - DoS attacks via large input (configurable maxSize, default 10MB) - Sensitive data exposure in logs (configurable logMaxLength, default 200 chars) - ReDoS attacks via regex operations (50MB hard limit) Adds new configuration constants: - STRUTS_COMPRESS_MAX_SIZE for maximum compressible body size - STRUTS_COMPRESS_LOG_MAX_LENGTH for maximum log content length Includes implementation plan documentation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add comprehensive test coverage for security enhancements: - testMaxSizeLimit: verify size limit enforcement - testMaxSizeDisabled: verify disabled limit behavior - testLogTruncation: verify log truncation works correctly - testVeryLargeInputSafety: verify 50MB hard limit protection - testInvalidMaxSizeConfiguration: verify invalid config handling - testInvalidLogMaxLengthConfiguration: verify invalid config handling All tests use behavior-based assertions following existing patterns. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Update @StrutsTag annotation description to include security considerations: - DoS attack prevention via configurable size limits - Sensitive data exposure prevention via log truncation The description will be used to generate the site documentation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Member
Author
|
//cc: @sepe81 |
Remove singleLine parameter and complex whitespace normalization logic. Revert to simple original compression: trim and remove whitespace between tags. Changes: - Remove singleLine field and setter from Compress and CompressTag - Simplify compressWhitespace() to use single regex: >\\s+< - Update documentation to remove singleLine attribute - Update all tests to reflect simple compression behavior - Maintain all security features (maxSize, log truncation, ReDoS protection) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
5c3a6b2 to
9e4f099
Compare
|
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.



Summary
Resolves WW-5256 - Reduce size of generated HTML output from FreeMarker tag templates.
struts.freemarker.whitespaceStrippingconfiguration option to control FreeMarker whitespace stripping (auto-disabled in devMode)struts.compress.enabledconfiguration option for global compress tag control<s:compress>tag to compress HTML output withforceattribute to override settings@since 7.2.0Test plan
🤖 Generated with Claude Code