resteasy/0001-RESTEASY-2559-Improper-validation-of-response-header.patch
DistroBaker 8b5c3e3167 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/resteasy.git#dd38accbc59b1e4b51fef9fd14896228d4565711
2020-11-30 15:05:39 +00:00

48 lines
2.0 KiB
Diff

From f58a22382e31c0c4b92e519fa84f701a606981ac Mon Sep 17 00:00:00 2001
From: Bartosz Spyrko-Smietanko <bspyrkos@redhat.com>
Date: Thu, 16 Apr 2020 14:01:17 +0100
Subject: [PATCH] [RESTEASY-2559] Improper validation of response header in
MediaTypeHeaderDelegate.java class
---
.../plugins/delegates/MediaTypeHeaderDelegate.java | 1 +
.../test/mediatype/MediaTypeHeaderTest.java | 14 ++++++++++++++
2 files changed, 15 insertions(+)
create mode 100644 testsuite/unit-tests/src/test/java/org/jboss/resteasy/test/mediatype/MediaTypeHeaderTest.java
diff --git a/resteasy-jaxrs/src/main/java/org/jboss/resteasy/plugins/delegates/MediaTypeHeaderDelegate.java b/resteasy-jaxrs/src/main/java/org/jboss/resteasy/plugins/delegates/MediaTypeHeaderDelegate.java
index db0b4d588..b31d4376e 100755
--- a/resteasy-jaxrs/src/main/java/org/jboss/resteasy/plugins/delegates/MediaTypeHeaderDelegate.java
+++ b/resteasy-jaxrs/src/main/java/org/jboss/resteasy/plugins/delegates/MediaTypeHeaderDelegate.java
@@ -89,6 +89,7 @@ public class MediaTypeHeaderDelegate implements RuntimeDelegate.HeaderDelegate
case '[':
case ']':
case '=':
+ case '\n':
return false;
default:
break;
diff --git a/testsuite/unit-tests/src/test/java/org/jboss/resteasy/test/mediatype/MediaTypeHeaderTest.java b/testsuite/unit-tests/src/test/java/org/jboss/resteasy/test/mediatype/MediaTypeHeaderTest.java
new file mode 100644
index 000000000..e46f018f7
--- /dev/null
+++ b/testsuite/unit-tests/src/test/java/org/jboss/resteasy/test/mediatype/MediaTypeHeaderTest.java
@@ -0,0 +1,14 @@
+package org.jboss.resteasy.test.mediatype;
+
+import org.jboss.resteasy.plugins.delegates.MediaTypeHeaderDelegate;
+import org.junit.Test;
+
+public class MediaTypeHeaderTest {
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testNewLineInHeaderValueIsRejected() {
+ MediaTypeHeaderDelegate delegate = new MediaTypeHeaderDelegate();
+
+ delegate.fromString("foo/bar\n");
+ }
+}
--
2.26.2