dataverse
dataverse copied to clipboard
Fail deployment when configuration for blocked api endpoints is invalid to avoid security issues
The configuration for blocked API endpoint basically allows any value. In case of typos or misconfiguration (like a /api prefix due to copy+paste from Apache/NGINX rules), the rules are essentially rendered useless.
We must check during deployment if the setting is making any sense to us.
- Make sure there's no
/, or/apior/api/v\d+/at the beginning of each - Make sure the list is actually a list (so no invalid characters like
;or, etc) - Ideally check if the referred resource actually exists. (This might be hard to do!)
Also, the whole class of API filtering should be refactored:
- Extract the matching logic and have unit/integration/API tests
- Look into using UriInfo instead of or in addition to ResourceInfo to make the code potentially less complex
- Remove Jetty
StringUtil(also add a check in Maven to flag or fail PRs introducing these imports!) - Potentially make the class more restrictive in it's choices what are acceptable configuration combinations
In addition: the setup scripts are still applying database options for the blocking configuration. This should be cleaned up.