Skip to content

Avoid reflecting invalid URL parameter - prevent false positive #6596

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

Merged
merged 4 commits into from
Apr 23, 2025

Conversation

labkey-jeckels
Copy link
Contributor

@labkey-jeckels labkey-jeckels commented Apr 22, 2025

Rationale

A security scanner is tripping on a reflected, properly encoded URL parameter value. It's not especially helpful for users so we can just avoid including it on the 404.

Changes

  • Simplify user-facing error message
  • Eliminate long-unused HTTP attribute
  • Improve error logging in DavController

@labkey-jeckels labkey-jeckels requested a review from a team April 22, 2025 17:56
catch (IllegalArgumentException e)
{
throw new NotFoundException("Invalid renderAs value");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Since PAGE appears to be the default, you could default to that for invalid value as well:

EnumUtils.getEnum(FileContentController.RenderStyle.class, renderAs.toUpperCase(), FileContentController.RenderStyle.PAGE);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I considered that but opted to be a little stricter. I don't think we've seen this exception aside from the crawler/scanner so I don't think we need to be overly tolerant.

Good to know about EnumUtils though - that wasn't on my radar.

@labkey-jeckels labkey-jeckels merged commit 5f90b1a into develop Apr 23, 2025
6 checks passed
@labkey-jeckels labkey-jeckels deleted the fb_avoidFalsePositiveOn404 branch April 23, 2025 15:47
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