This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch refactor/compress-tag-namespace in repository https://gitbox.apache.org/repos/asf/struts.git
commit 8208675d848a1b602d6fbe12ad12b964cfb9b9a8 Author: Lukasz Lenart <[email protected]> AuthorDate: Sat Dec 6 10:53:29 2025 +0100 refactor(config): WW-5256 move compress constants to struts.tag.compress namespace Rename struts.compress.* configuration constants to struts.tag.compress.* to align with established tag-specific configuration patterns (e.g., struts.tag.includetag.useResponseEncoding). Changes: - STRUTS_COMPRESS_ENABLED: struts.tag.compress.enabled - STRUTS_COMPRESS_MAX_SIZE: struts.tag.compress.maxSize - STRUTS_COMPRESS_LOG_MAX_LENGTH: struts.tag.compress.log.maxLength The struts.tag.* prefix is used for tag-specific configuration, distinguishing it from UI component configuration (struts.ui.*) and template engine configuration (struts.freemarker.*). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> --- .../java/org/apache/struts2/StrutsConstants.java | 6 ++--- .../org/apache/struts2/components/Compress.java | 2 +- .../org/apache/struts2/default.properties | 6 ++--- ...press-component-security-implementation-plan.md | 26 +++++++++++----------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/core/src/main/java/org/apache/struts2/StrutsConstants.java b/core/src/main/java/org/apache/struts2/StrutsConstants.java index 7f4963593..9791a89ad 100644 --- a/core/src/main/java/org/apache/struts2/StrutsConstants.java +++ b/core/src/main/java/org/apache/struts2/StrutsConstants.java @@ -341,21 +341,21 @@ public final class StrutsConstants { * * @since 7.2.0 */ - public static final String STRUTS_COMPRESS_ENABLED = "struts.compress.enabled"; + public static final String STRUTS_COMPRESS_ENABLED = "struts.tag.compress.enabled"; /** * Maximum size (in bytes) of body content that can be compressed. Content exceeding this limit will be skipped without compression. * * @since 7.2.0 */ - public static final String STRUTS_COMPRESS_MAX_SIZE = "struts.compress.maxSize"; + public static final String STRUTS_COMPRESS_MAX_SIZE = "struts.tag.compress.maxSize"; /** * Maximum length of body content to include in log messages. Content longer than this will be truncated with length indicator. * * @since 7.2.0 */ - public static final String STRUTS_COMPRESS_LOG_MAX_LENGTH = "struts.compress.log.maxLength"; + public static final String STRUTS_COMPRESS_LOG_MAX_LENGTH = "struts.tag.compress.log.maxLength"; /** * Extension point for the Struts CompoundRootAccessor diff --git a/core/src/main/java/org/apache/struts2/components/Compress.java b/core/src/main/java/org/apache/struts2/components/Compress.java index 34c2d5008..b605f31eb 100644 --- a/core/src/main/java/org/apache/struts2/components/Compress.java +++ b/core/src/main/java/org/apache/struts2/components/Compress.java @@ -39,7 +39,7 @@ import java.io.Writer; * </p> * <ul> * <li>Body content is truncated in log messages to prevent sensitive data exposure</li> - * <li>Maximum size limit prevents DoS attacks via large inputs (configurable via struts.compress.maxSize)</li> + * <li>Maximum size limit prevents DoS attacks via large inputs (configurable via struts.tag.compress.maxSize)</li> * <li>Regex operations include safeguards against ReDoS attacks</li> * </ul> * diff --git a/core/src/main/resources/org/apache/struts2/default.properties b/core/src/main/resources/org/apache/struts2/default.properties index 283a5b1bc..a980196a6 100644 --- a/core/src/main/resources/org/apache/struts2/default.properties +++ b/core/src/main/resources/org/apache/struts2/default.properties @@ -212,17 +212,17 @@ struts.freemarker.mru.max.strong.size=0 struts.freemarker.whitespaceStripping=true ### Controls whether the compress tag is enabled globally. -struts.compress.enabled=true +struts.tag.compress.enabled=true ### Maximum size (in bytes) of body content that can be compressed. ### Content exceeding this limit will be skipped without compression. ### Default: 10MB (10485760 bytes) -struts.compress.maxSize=10485760 +struts.tag.compress.maxSize=10485760 ### Maximum length of body content to include in log messages. ### Content longer than this will be truncated with length indicator. ### Default: 200 characters -struts.compress.log.maxLength=200 +struts.tag.compress.log.maxLength=200 ### configure the XSLTResult class to use stylesheet caching. ### Set to true for developers and false for production. diff --git a/thoughts/shared/research/2025-11-27-compress-component-security-implementation-plan.md b/thoughts/shared/research/2025-11-27-compress-component-security-implementation-plan.md index 880cf5706..2fcf9f79a 100644 --- a/thoughts/shared/research/2025-11-27-compress-component-security-implementation-plan.md +++ b/thoughts/shared/research/2025-11-27-compress-component-security-implementation-plan.md @@ -55,7 +55,7 @@ Implement security enhancements to address three identified security issues in t * * @since 7.2.0 */ -public static final String STRUTS_COMPRESS_MAX_SIZE = "struts.compress.maxSize"; +public static final String STRUTS_COMPRESS_MAX_SIZE = "struts.tag.compress.maxSize"; /** * Maximum length of body content to include in log messages. @@ -64,7 +64,7 @@ public static final String STRUTS_COMPRESS_MAX_SIZE = "struts.compress.maxSize"; * * @since 7.2.0 */ -public static final String STRUTS_COMPRESS_LOG_MAX_LENGTH = "struts.compress.log.maxLength"; +public static final String STRUTS_COMPRESS_LOG_MAX_LENGTH = "struts.tag.compress.log.maxLength"; ``` **Validation**: @@ -77,19 +77,19 @@ public static final String STRUTS_COMPRESS_LOG_MAX_LENGTH = "struts.compress.log ### Phase 2: Default Properties **File**: `core/src/main/resources/org/apache/struts2/default.properties` -**Location**: After line 215 (after `struts.compress.enabled=true`) +**Location**: After line 215 (after `struts.tag.compress.enabled=true`) **Changes**: ```properties ### Maximum size (in bytes) of body content that can be compressed. ### Content exceeding this limit will be skipped without compression. ### Default: 10MB (10485760 bytes) -struts.compress.maxSize=10485760 +struts.tag.compress.maxSize=10485760 ### Maximum length of body content to include in log messages. ### Content longer than this will be truncated with length indicator. ### Default: 200 characters -struts.compress.log.maxLength=200 +struts.tag.compress.log.maxLength=200 ``` **Validation**: @@ -297,7 +297,7 @@ private String compressWhitespace(String input, boolean singleLine) { * </p> * <ul> * <li>Body content is truncated in log messages to prevent sensitive data exposure</li> - * <li>Maximum size limit prevents DoS attacks via large inputs (configurable via struts.compress.maxSize)</li> + * <li>Maximum size limit prevents DoS attacks via large inputs (configurable via struts.tag.compress.maxSize)</li> * <li>Regex operations include safeguards against ReDoS attacks</li> * </ul> * @@ -512,8 +512,8 @@ truncated to prevent sensitive data from appearing in logs.</p> - [ ] Verify naming conventions ### Phase 2: Default Properties -- [ ] Add `struts.compress.maxSize=10485760` -- [ ] Add `struts.compress.log.maxLength=200` +- [ ] Add `struts.tag.compress.maxSize=10485760` +- [ ] Add `struts.tag.compress.log.maxLength=200` - [ ] Add descriptive comments - [ ] Verify property file format @@ -557,23 +557,23 @@ truncated to prevent sensitive data from appearing in logs.</p> ### Default Configuration (Recommended) ```properties -struts.compress.maxSize=10485760 -struts.compress.log.maxLength=200 +struts.tag.compress.maxSize=10485760 +struts.tag.compress.log.maxLength=200 ``` ### Custom Size Limit (5MB) ```properties -struts.compress.maxSize=5242880 +struts.tag.compress.maxSize=5242880 ``` ### Disable Size Limit (Not Recommended) ```properties -struts.compress.maxSize=0 +struts.tag.compress.maxSize=0 ``` ### Increase Log Truncation Length ```properties -struts.compress.log.maxLength=500 +struts.tag.compress.log.maxLength=500 ``` ---
