@davidlemaitre opened this Issue on November 7th 2022

I want to use config:delete command to remove an ip address from General.login_allowlist_ip array but the command never found the value. If I add a new value without dots to an array, the deletion works. I tried to escape dots with backslashes without success.

Steps to Reproduce

./console config:set 'General.login_allowlist_ip[]="123.123.123.123"'
Setting [General] login_allowlist_ip = "123.123.123.123"... done.
./console config:get 'General.login_allowlist_ip'`
["123.123.123.123"]
./console config:delete --section=General --key=login_allowlist_ip[] --value=123.123.123.123`
Nothing found

Your Environment

  • Matomo Version: 4.12.3
  • PHP Version: 8.0.25
@peterhashair commented on November 7th 2022 Contributor

@davidlemaitre thanks for reporting this, you are right, I can see there is a bug there caused by the IP address having dot in it. Instead of searching for 123.123.123.123, it searches 123

@peterhashair commented on November 7th 2022 Contributor

Hints: this is caused by this line.
https://github.com/matomo-org/matomo/blob/3ddbb186ef564718ed0a4457e56d287c0c0f6708/plugins/CoreAdminHome/Commands/ConfigDelete.php#L240

possible solution:

update the regex to /^([a-zA-Z0-9_]+)(?:\.([a-zA-Z0-9_]+))?(?:\[\])?(?:\.([a-zA-Z0-9_.]+))?/, not sure if we want to accept all special characters

Powered by GitHub Issue Mirror