Skip to content

Commit 95d6fae

Browse files
committed
Fix usage of RFC 5737 address
Address range 192.0.2.0/24 is reserved for documentation according to RFC 5737. The recommendation is to reject routing of this address range on routers, but as this is not mandatory, it might happen that the address is really routed. The tests on Docker on Windows fail because of this it, the fail reason is different to the expected one. Fix this by configuring Nginx to listen on 127.0.0.1:80 (and not 0.0.0.0:80) and connecting to 127.1.2.3 instead of 192.0.2.1. Signed-off-by: Oldřich Jedlička <[email protected]>
1 parent 2d70f53 commit 95d6fae

7 files changed

+13
-13
lines changed

tests/spec/access_token_access_spec.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ describe("when token endpoint is not reachable", function()
202202
access_token_opts = {
203203
timeout = 40000,
204204
discovery = {
205-
token_endpoint = "http://192.0.2.1/"
205+
token_endpoint = "http://127.1.2.3/"
206206
}
207207
},
208208
token_response_expires_in = 0
@@ -219,7 +219,7 @@ describe("when token endpoint is not reachable", function()
219219
assert.are.equals(401, status)
220220
end)
221221
it("an error has been logged", function()
222-
assert.error_log_contains("access_token error: accessing token endpoint.*%(http://192.0.2.1/%) failed")
222+
assert.error_log_contains("access_token error: accessing token endpoint.*%(http://127.1.2.3/%) failed")
223223
end)
224224
end)
225225

tests/spec/bearer_token_verification_spec.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ describe("when jwks endpoint is not reachable", function()
464464
verify_opts = {
465465
timeout = 40000,
466466
discovery = {
467-
jwks_uri = "http://192.0.2.1/"
467+
jwks_uri = "http://127.1.2.3/"
468468
}
469469
},
470470
})
@@ -478,7 +478,7 @@ describe("when jwks endpoint is not reachable", function()
478478
assert.are.equals(401, status)
479479
end)
480480
it("an error has been logged", function()
481-
assert.error_log_contains("Invalid token: accessing jwks url.*%(http://192.0.2.1/%) failed")
481+
assert.error_log_contains("Invalid token: accessing jwks url.*%(http://127.1.2.3/%) failed")
482482
end)
483483
end)
484484

tests/spec/introspection_spec.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ describe("when introspection endpoint is not reachable", function()
396396
test_support.start_server({
397397
introspection_opts = {
398398
timeout = 40000,
399-
introspection_endpoint = "http://192.0.2.1/"
399+
introspection_endpoint = "http://127.1.2.3/"
400400
},
401401
})
402402
teardown(test_support.stop_server)
@@ -409,7 +409,7 @@ describe("when introspection endpoint is not reachable", function()
409409
assert.are.equals(401, status)
410410
end)
411411
it("an error has been logged", function()
412-
assert.error_log_contains("Introspection error:.*accessing introspection endpoint %(http://192.0.2.1/%) failed")
412+
assert.error_log_contains("Introspection error:.*accessing introspection endpoint %(http://127.1.2.3/%) failed")
413413
end)
414414
end)
415415

tests/spec/redirect_to_op_spec.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ describe("when discovery endpoint is not reachable", function()
136136
test_support.start_server({
137137
oidc_opts = {
138138
timeout = 40000,
139-
discovery = "http://192.0.2.1/"
139+
discovery = "http://127.1.2.3/"
140140
},
141141
})
142142
teardown(test_support.stop_server)
@@ -148,7 +148,7 @@ describe("when discovery endpoint is not reachable", function()
148148
assert.are.equals(401, status)
149149
end)
150150
it("an error has been logged", function()
151-
assert.error_log_contains("authenticate failed: accessing discovery url.*%(http://192.0.2.1/%) failed")
151+
assert.error_log_contains("authenticate failed: accessing discovery url.*%(http://127.1.2.3/%) failed")
152152
end)
153153
end)
154154

tests/spec/test_support.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ http {
160160
server {
161161
log_subrequest on;
162162
163-
listen 80;
163+
listen 127.0.0.1:80;
164164
#listen 443 ssl;
165165
#ssl_certificate certificate-chain.crt;
166166
#ssl_certificate_key private.key;

tests/spec/token_request_spec.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ describe("if token endpoint is not reachable", function()
153153
oidc_opts = {
154154
timeout = 40000,
155155
discovery = {
156-
token_endpoint = "http://192.0.2.1/"
156+
token_endpoint = "http://127.1.2.3/"
157157
}
158158
},
159159
})
@@ -163,7 +163,7 @@ describe("if token endpoint is not reachable", function()
163163
assert.are.equals(401, status)
164164
end)
165165
it("an error has been logged", function()
166-
assert.error_log_contains("authenticate failed:.*accessing token endpoint %(http://192.0.2.1/%) failed")
166+
assert.error_log_contains("authenticate failed:.*accessing token endpoint %(http://127.1.2.3/%) failed")
167167
end)
168168
end)
169169

tests/spec/userinfo_spec.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ describe("when userinfo endpoint is not reachable", function()
7575
oidc_opts = {
7676
timeout = 40000,
7777
discovery = {
78-
userinfo_endpoint = "http://192.0.2.1/"
78+
userinfo_endpoint = "http://127.1.2.3/"
7979
}
8080
},
8181
})
@@ -85,7 +85,7 @@ describe("when userinfo endpoint is not reachable", function()
8585
assert.are.equals(302, status)
8686
end)
8787
it("an error has been logged", function()
88-
assert.error_log_contains(".*error calling userinfo endpoint: accessing %(http://192.0.2.1/%) failed")
88+
assert.error_log_contains(".*error calling userinfo endpoint: accessing %(http://127.1.2.3/%) failed")
8989
end)
9090
end)
9191

0 commit comments

Comments
 (0)