Skip to content

Commit

Permalink
Add CSRF backward compatibility for older Sidecars
Browse files Browse the repository at this point in the history
...who don't have the "X-Requested-By" header yet.
Simply accepting "X-Graylog-Collector-Version" serves the same purpose.

Relates to #4987
  • Loading branch information
mpfz0r committed Oct 9, 2018
1 parent 7e0701b commit 4213f61
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ public class VerboseCsrfProtectionFilter extends CsrfProtectionFilter {
@Override
public void filter(ContainerRequestContext rc) throws IOException {
try {
super.filter(rc);
// Backward compatibility for Sidecars < 0.1.7
if (!rc.getHeaders().containsKey("X-Graylog-Collector-Version")) {
super.filter(rc);
}
} catch (BadRequestException badRequestException) {
throw new BadRequestException(
"CSRF protection header is missing. Please add a \"" + HEADER_NAME + "\" header to your request.",
Expand Down

0 comments on commit 4213f61

Please sign in to comment.