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

Fix Http Message Logging Spec tests that depended on Styx API allowing passing invalid cookies. #610

Merged
merged 4 commits into from
Feb 10, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Disable HTTP message logging spec tests that depended on our API acce…
…pting invalid cookies.
  • Loading branch information
a-dlatorre committed Feb 10, 2020
commit ae423e24230ecb4ad023cccd426dbb20527e1978
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,18 @@ class HttpMessageLoggingSpec : FeatureSpec() {
.wait()

val expectedRequest = Regex("requestId=[-a-z0-9]+, secure=false, origin=null, "
+ "request=\\{version=HTTP/1.1, method=GET, uri=/a/path, headers=\\[Host=localhost:[0-9]+, header1=\\*\\*\\*\\*, header2=h2, cookie=cookie1=\\*\\*\\*\\*;cookie2=c2\\], id=[-a-z0-9]+\\}")
+ "request=\\{version=HTTP/1.1, method=GET, uri=/a/path, headers=\\[Host=localhost:[0-9]+, header1=\\*\\*\\*\\*, header2=h2, cookie=cookie1=\\*\\*\\*\\*;cookie2=c2\\], id=[-a-z0-9]+\\}")

val expectedResponse = Regex("requestId=[-a-z0-9]+, secure=false, "
+ "response=\\{version=HTTP/1.1, status=200 OK, headers=\\[header1=\\*\\*\\*\\*, header2=h2, cookie=cookie1=\\*\\*\\*\\*;cookie2=c2, Via=1.1 styx\\]\\}")
+ "response=\\{version=HTTP/1.1, status=200 OK, headers=\\[header1=\\*\\*\\*\\*, header2=h2, cookie=cookie1=\\*\\*\\*\\*;cookie2=c2, Via=1.1 styx\\]\\}")

logger.log().shouldContain(INFO, expectedRequest)
logger.log().shouldContain(INFO, expectedResponse)
}
}

// These tests have been disabled as our API does not allow us to create invalid cookies any longer
feature("!Logging invalid requests/responses hides sensitive information") {
scenario("Requests with badly-formed headers should hide sensitive cookies and headers when logged") {

httpErrorLogger.logger.level = ERROR
Expand Down Expand Up @@ -111,7 +114,7 @@ class HttpMessageLoggingSpec : FeatureSpec() {
}

scenario("Responses with badly-formed headers should hide sensitive cookies and headers when logged") {

// In this scenario, the response generated for this request should include an invalid cookie.
rootLogger.appender.list.clear()
rootLogger.logger.level = DEBUG

Expand Down Expand Up @@ -193,8 +196,6 @@ class HttpMessageLoggingSpec : FeatureSpec() {
routes:
- prefix: /
destination: default
- prefix: /bad
destination: bad

default:
type: StaticResponseHandler
Expand All @@ -209,20 +210,6 @@ class HttpMessageLoggingSpec : FeatureSpec() {
- name: "cookie"
value: "cookie1=c1;cookie2=c2"

bad:
type: StaticResponseHandler
config:
status: 200
content: ""
headers:
- name: "header1"
value: "h1"
- name: "header2"
value: "h2"
- name: "cookie"
value: "cookie1=c1;cookie2=c2"
- name: "badheader"
value: "bad\u0000bad"

httpPipeline: root
""".trimIndent())
Expand Down