Open claudio-benfatto opened 5 years ago
I realised that it actually happens even in much simpler cases, ie.
serve:
proxy:
port: 4455
api:
port: 4456
log:
level: debug
access_rules:
repositories:
- file://./data/rules.yaml
mutators:
header:
enabled: true
config:
-
noop:
enabled: true
cookie:
enabled: true
config:
-
authorizers:
allow:
enabled: true
deny:
enabled: true
keto_engine_acp_ory:
enabled: true
config:
base_url: http://auth-keto:4444/
authenticators:
anonymous:
enabled: true
config:
subject: guest
jwt:
enabled: true
config:
jwks_urls:
- http://auth-keycloak/auth/realms/realm/protocol/openid-connect/certs
scope_strategy: wildcard
- id: example
match:
url: "http://www.example.com/<.*>"
methods:
- GET
- HEAD
- OPTIONS
authenticators: [{ "handler": "anonymous" }]
authorizer: { "handler": "allow" }
mutators:
- handler: header
config:
headers:
X-Auth-User: first
oathkeeper --config data/oathkeeper.yaml serve
$ curl -I -X GET -H "X-Forwarded-Proto: http" -H "Host: www.example.com" http://localhost:4456/decisions/v2
HTTP/1.1 200 OK
X-Auth-User: first
Date: Tue, 08 Oct 2019 08:28:02 GMT
Content-Length: 0
- id: example
match:
url: "http://www.example.com/<.*>"
methods:
- GET
- HEAD
- OPTIONS
authenticators: [{ "handler": "anonymous" }]
authorizer: { "handler": "allow" }
mutators:
- handler: header
config:
headers:
X-Auth-User: second
DEBU[0299] Detected file change in directory containing access rules. Triggering a reload. event=fsnotify file=data/rules.yaml op=CHMOD
DEBU[0299] Detected file change in directory containing access rules. Triggering a reload. event=fsnotify file=data/rules.yaml op=WRITE
DEBU[0299] Viper detected a configuration change, reloading config. event=config_change source=fsnotify
DEBU[0299] Viper detected a configuration change, reloading config. event=config_change source=fsnotify
DEBU[0299] One or more access rule repositories changed, reloading access rules. event=repository_change file="file://./data/rules.yaml" source=config_update
DEBU[0299] Fetching access rules from given location because something changed. location="file://data/rules.yaml"
DEBU[0299] One or more access rule repositories changed, reloading access rules. event=repository_change file="file://./data/rules.yaml" source=config_update
DEBU[0299] Fetching access rules from given location because something changed. location="file://data/rules.yaml"
curl -I -X GET -H "X-Forwarded-Proto: http" -H "Host: www.example.com" http://localhost:4456/decisions/v2
HTTP/1.1 200 OK
X-Auth-User: first
Date: Tue, 08 Oct 2019 08:31:44 GMT
Content-Length: 0
curl -I -X GET -H "X-Forwarded-Proto: http" -H "Host: www.example.com" http://localhost:4456/decisions/v2
HTTP/1.1 200 OK
X-Auth-User: second
Date: Tue, 08 Oct 2019 08:33:08 GMT
Content-Length: 0
Which version of Oathkeeper are you running?
Also, be aware that it might take a couple of seconds before the rules are refreshed in the internal cache.
Hi @aeneasr I'm running v0.18.0-beta.1
, and I'm waiting much longer than 2 sec ;)
UPDATE
I could replicate it with v0.19.0-beta.1
too
Hey, sorry for the super long follow-up, I believe that this could be caused by the template caching! It appears that the rules are properly reloaded judging from the debug log.
I was able to identify the issue, it is in fact caused by caching!
Hi,
Describe the bug
After modifying some configuration in the mutators stanza, for example the content of the headers the new behaviour is not applied accordingly (ie. I still see the old headers in the Oathkeeper responses). This seems to happen especially when the changes are affecting a go template.
Reproducing the bug
Steps to reproduce the behavior:
/rules
endpoint shows the updated rules and templateServer logs
These are the debug logs following the change in the rules:
Server configuration
Expected behavior
The new configuration should be applied after the rule change is observed and the header should be populated with the right value
Environment
Thank you for your help!