Skip to content

Handle null name and value in SecurityWrapperResponse.setHeader - #924

Open
VolodymyrLinuxovich wants to merge 1 commit into
ESAPI:developfrom
VolodymyrLinuxovich:issue-906
Open

VolodymyrLinuxovich wants to merge 1 commit into
ESAPI:developfrom
VolodymyrLinuxovich:issue-906

Conversation

@VolodymyrLinuxovich

Copy link
Copy Markdown

Closes #906

PR #907 fixed the NullPointerException in stripControls. But setHeader still did not follow the Servlet spec for null. A null value went to the validator with allowNull set to false. It failed and was logged as a security failure. The header was never removed. A null name was also sent to the validator and logged the same way.

Now a null name returns right away and does nothing. A null value skips the value check. The header name is still validated, and when it is valid the call goes through as setHeader(name, null). That removes the header. The Javadoc now says this.

I added two tests to SecurityWrapperResponseTest. They fail on develop and pass with the change. The rest of SecurityWrapperResponseTest, SecurityWrapperRequestTest and HTTPUtilitiesTest still pass. I ran them on JDK 17, which needs --add-opens java.base/java.lang=ALL-UNNAMED for PowerMock.

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.

SecurityWrapperResponse.setHeader does not handle nulls

1 participant