-
Notifications
You must be signed in to change notification settings - Fork 538
Filter Improvements #11454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ofahimIQSS
merged 35 commits into
IQSS:develop
from
GlobalDataverseCommunityConsortium:FilterUpdates
Jun 4, 2025
Merged
Filter Improvements #11454
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
be53d48
Change to ContainerRequestFilter
qqmyers 0813c3c
add new filter
qqmyers 478fb31
drop old filter, move to using @WebFilter annotations
qqmyers 6cee8bf
separate Cors filter
qqmyers 000087c
note that Cors setting is now cached/read only at startup
qqmyers e21b2e2
use annotation
qqmyers 66ff5b3
cleanup - deleting unused imports/injects
qqmyers 297cb87
release note
qqmyers 8cf3d7a
restore policies, add header
qqmyers fb8d483
doc for new header
qqmyers f0dc16d
apply password rules to unblock key as a warning
qqmyers 181324d
add JvmSettings
qqmyers f843a87
drop undocumented allow policy
qqmyers a5788af
add warnings
qqmyers 017962d
new CORS Jvm settings
qqmyers 44bb9fe
adjust names, mark settings as deprecated
qqmyers 08caaad
doc updates
qqmyers f1a4cc6
remove random line
qqmyers 86298ee
fix restart notes
qqmyers 15b199a
avoid double init
qqmyers d460bdc
fix no origin case
qqmyers 9956210
use constants, flip back to info for debugging setup
qqmyers ed806db
fix drop/localhost-only policies
qqmyers 48abd42
Fix for method hierarchy
qqmyers 9a2cf73
revert to checking db settings dynamically
qqmyers 80c0083
allow default drop JvmSetting, update docs
qqmyers 6b0fd66
check for valid policy
qqmyers ed72607
Merge remote-tracking branch 'IQSS/develop' into DropApiFilter
qqmyers 2460fb4
remove unused search settings
qqmyers ecb1b6b
add TODO to stop using deprecated database settings #11454
pdurbin 15f7b0d
Move filters to sub packages, add comment for CorsFilter class
qqmyers 1b80bc7
Apply suggestions from code review
qqmyers a8c460b
change ref links per review
qqmyers 760a888
move UploadMethods note per review
qqmyers 5643f51
Fix X-Dataverse-Key
qqmyers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| ### Improved efficiency for per-request Filters | ||
|
|
||
| This release improves the performance of Dataverse's per-request handling of CORS Headers and API calls | ||
|
|
||
| It adds new jvm-options/Microprofile settings replacing the now deprecated database settings. | ||
|
|
||
| Additional changes: | ||
|
|
||
| - CORS headers can now be configured with a list of desired origins, methods, and allowed and exposed headers. | ||
| - An 'X-Dataverse-unblock-key' header has been added that can be used instead of the less secure 'unblock-key' query parameter when the :BlockedApiPolicy is set to 'unblock-key' | ||
| - Warnings have been added to the log if the Blocked Api settings are misconfigured or if the key is weak (when the "unblock-key" policy is used) | ||
| - The new `dataverse.api.blocked.key` can be configured using Payara password aliases or other secure storage options. | ||
|
|
||
| New JvmSettings: | ||
| - `dataverse.cors.origin`: Allowed origins for CORS requests | ||
| - `dataverse.cors.methods`: Allowed HTTP methods for CORS requests | ||
| - `dataverse.cors.headers.allow`: Allowed headers for CORS requests | ||
| - `dataverse.cors.headers.expose`: Headers to expose in CORS responses | ||
| - `dataverse.api.blocked.policy`: Policy for blocking API endpoints | ||
| - `dataverse.api.blocked.endpoints`: List of API endpoints to be blocked (comma-separated) | ||
| - `dataverse.api.blocked.key`: Key for unblocking API endpoints | ||
|
|
||
| Deprecated database settings: | ||
| - `:AllowCors` | ||
| - `:BlockedApiPolicy` | ||
| - `:BlockedApiEndpoints` | ||
| - `:BlockedApiKey` | ||
|
|
||
|
|
||
| Upgrade instructions: | ||
|
|
||
| The deprecated database settings will continue to work in this version. To use the new settings (which are more efficient), | ||
|
|
||
| If :AllowCors is not set or is true: | ||
| bin/asadmin create-jvm-options -Ddataverse.cors.origin=* | ||
|
|
||
| Optionally set origin to a list of hosts and/or set other CORS JvmSettings | ||
| Your currently blocked API endpoints can be found at http://localhost:8080/api/admin/settings/:BlockedApiEndpoints | ||
|
|
||
| Copy them into the new setting with the following command. As with the deprecated setting, the endpoints should be comma-separated. | ||
|
|
||
| bin/asadmin create-jvm-options '-Ddataverse.api.blocked.endpoints=<current :BlockedApiEndpoints>' | ||
|
|
||
| If :BlockedApiPolicy is set and is not 'drop' | ||
| bin/asadmin create-jvm-options '-Ddataverse.api.blocked.policy=<current :BlockedApiPolicy>' | ||
|
|
||
| If :BlockedApiPolicy is 'unblock-key' and :BlockedApiKey is set | ||
|
|
||
| `echo "API_BLOCKED_KEY_ALIAS=<value of :BlockedApiKey>" > /tmp/dataverse.api.blocked.key.txt` | ||
|
|
||
| `sudo -u dataverse /usr/local/payara6/bin/asadmin create-password-alias --passwordfile /tmp/dataverse.api.blocked.key.txt` | ||
|
|
||
| When you are prompted "Enter the value for the aliasname operand", enter `api_blocked_key_alias` | ||
|
|
||
| You should see "Command create-password-alias executed successfully." | ||
|
|
||
| bin/asadmin create-jvm-options '-Ddataverse.api.blocked.key=${ALIAS=api_blocked_key_alias}' | ||
|
|
||
| Restart Payara: | ||
|
|
||
| service payara restart | ||
|
|
||
| Check server.log to verify that your new settings are in effect. | ||
|
|
||
| Cleanup: delete deprecated settings: | ||
| curl -X DELETE http://localhost:8080/api/admin/settings/:AllowCors | ||
| curl -X DELETE http://localhost:8080/api/admin/settings/:BlockedApiEndpoints | ||
| curl -X DELETE http://localhost:8080/api/admin/settings/:BlockedApiPolicy | ||
| curl -X DELETE http://localhost:8080/api/admin/settings/:BlockedApiKey | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ echo "" | |
| echo "Revoke the key that allows for creation of builtin users..." | ||
| curl -sS -X DELETE "${DATAVERSE_URL}/api/admin/settings/BuiltinUsers.KEY" | ||
|
|
||
| # TODO: stop using these deprecated database settings. See https://github.com/IQSS/dataverse/pull/11454 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I kicked off a thread about this here: https://dataverse.zulipchat.com/#narrow/channel/375812-containers/topic/deprecated.20API.20block.20settings.20.28.2311454.29/near/522132505 |
||
| echo "" | ||
| echo "Set key for accessing blocked API endpoints..." | ||
| curl -sS -X PUT -d "$BLOCKED_API_KEY" "${DATAVERSE_URL}/api/admin/settings/:BlockedApiKey" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.