Closed LaurenceJJones closed 1 year ago
I reported on behalf of a user here are the logs
ERROR: CrowdsecBouncerTraefikPlugin: 2023/09/19 12:04:09 New:validateParams CrowdsecLapiKey doesn't valid this regexp: '/^[a-zA-Z0-9 !#$%!&(MISSING)'*+-.^_`|~]*$/'
time="2023-09-19T12:04:09+01:00" level=error msg="CrowdsecLapiKey doesn't valid this regexp: '/^[a-zA-Z0-9 !#$%&'*+-.^_`|~]*$/'" routerName=whoami@docker entryPointName=https
A workaround for user you can define your own key via
cscli bouncers add mytraefik -k {RANDOM_DIGITS_HERE}
Hey @LaurenceJJones,
Thanks for letting us know so shortly.
I think just adding "=" to our validation regex will do the trick.
I Updated some docker-compose.local.yml to test with version 1.5.3 and plugin version 1.1.14
make run_local
I got the same validation erreur with a crowdsec_lapi_key='40796d93c2958f9e58345514e67740e5='
After editing the regex it's seems to be working fine.
2023-09-19 19:20:05 time="2023-09-19T17:20:05Z" level=debug msg="Configuration received: {\"http\":{\"routers\":{\"router-bar\":{\"entryPoints\":[\"web\"],\"middlewares\":[\"crowdsec-bar@docker\"],\"service\":\"service-bar\",\"rule\":\"Path(`/bar`)\"},\"router-foo\":{\"entryPoints\":[\"web\"],\"middlewares\":[\"crowdsec-foo@docker\"],\"service\":\"service-foo\",\"rule\":\"Path(`/foo`)\"}},\"services\":{\"service-bar\":{\"loadBalancer\":{\"servers\":[{\"url\":\"http://172.21.0.4:80\"}],\"passHostHeader\":true}},\"service-foo\":{\"loadBalancer\":{\"servers\":[{\"url\":\"http://172.21.0.2:80\"}],\"passHostHeader\":true}}},\"middlewares\":{\"crowdsec-bar\":{\"plugin\":{\"bouncer\":{\"crowdseclapikey\":\"40796d93c2958f9e58345514e67740e5=\",\"enabled\":\"true\"}}},\"crowdsec-foo\":{\"plugin\":{\"bouncer\":{\"crowdseclapikey\":\"40796d93c2958f9e58345514e67740e5=\",\"enabled\":\"true\"}}}}},\"tcp\":{},\"udp\":{}}" providerName=docker
Our regex now contains:
reg := regexp.MustCompile("^[a-zA-Z0-9 !#$%&'*+-.^_`|~=]*$")
I will release version 1.1.15 to support 1.5.3+ out of the box.
Do you see anything we should add in the regex ?
Adding on to this, the /
character is present in LAPI Keys as well and not supported within the regex
Describe the bug 🐛 Hello from CrowSec team we didnt realize you had a regex that is testing people bouncer keys. We have increased the cipher suite so they now have
=
at the end. However, this is now causing an issue with your regex test.Expected behavior 👀 Update your regex to contain the new cipher suite.
Context 🔎 Before posting, make sure to use the
logLevel: DEBUG
of the plugin and see if you can fix the error yourself. If not, post your plugin configuration file (anonimize IP and secret key) and a partial logs file where the error is encountered.To Reproduce Steps to reproduce the behavior: