Skip to content
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

WW-5340 Mild refactor StrutsOgnlGuard for easier subclassing #760

Merged
merged 3 commits into from
Oct 6, 2023

Conversation

kusalk
Copy link
Member

@kusalk kusalk commented Oct 5, 2023

WW-5340

Quick follow-up to #747
See comments

values.add(StringUtils.EMPTY);
} else if (size > maxStringLength) {
if (size > maxStringLength) {
LOG.debug("Form field {} of size {} bytes exceeds limit of {}.", item.getFieldName(), size, maxStringLength);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just added this line, no other functional changes here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think logging the field name at the debug level is fine in terms of security?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume so, yet this is a user controlled value so maybe it needs escaping

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure a field name can even contain newline characters but anyway SonarCloud is happy now

return false;
}

protected boolean checkNode(Node node) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I separated the recursion logic from the node checking logic so that subclasses don't need to unnecessarily duplicate that code when overriding.

@kusalk kusalk requested a review from lukaszlenart October 5, 2023 17:30
@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

86.1% 86.1% Coverage
0.0% 0.0% Duplication

@kusalk kusalk merged commit fc03a2b into master Oct 6, 2023
8 checks passed
@kusalk kusalk deleted the WW-5340-subclassable branch October 6, 2023 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants