alleyinteractive / wp-rest-api-guard

Restrict and control access to the REST API
https://wordpress.org/plugins/rest-api-guard/
GNU General Public License v2.0
11 stars 1 forks source link

Allowlist/Denylist not working in some OS system #15

Closed sjoonk closed 8 months ago

sjoonk commented 8 months ago

Description of the bug

The allowlist/denylist you use this plugin use explode("\n", $list) syntax. But as you know, this code does not work in some OS system, because the newline is different by systems. Can you change this logic into more safe function?

      $allowlist = preg_split( "/\r\n|\n|\r/", $allowlist );

Steps To Reproduce

  1. Open REST API Guard Settings page on Mac OS
  2. Enter more than 2 endpoints in "Anonymous Request Allowlist"
  3. Call the API request
  4. It returns 401 error

Additional Information

No response