You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This release improves the performance of Dataverse's per-request handling of CORS Headers and API calls
4
+
5
+
It adds new jvm-options/Microprofile settings replacing the now deprecated database settings.
6
+
7
+
Additional changes:
8
+
9
+
- CORS headers can now be configured with a list of desired origins, methods, and allowed and exposed headers.
10
+
- 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'
11
+
- 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)
12
+
- The new `dataverse.api.blocked.key` can be configured using Payara password aliases or other secure storage options.
13
+
14
+
New JvmSettings:
15
+
-`dataverse.cors.origin`: Allowed origins for CORS requests
16
+
-`dataverse.cors.methods`: Allowed HTTP methods for CORS requests
17
+
-`dataverse.cors.headers.allow`: Allowed headers for CORS requests
18
+
-`dataverse.cors.headers.expose`: Headers to expose in CORS responses
19
+
-`dataverse.api.blocked.policy`: Policy for blocking API endpoints
20
+
-`dataverse.api.blocked.endpoints`: List of API endpoints to be blocked (comma-separated)
21
+
-`dataverse.api.blocked.key`: Key for unblocking API endpoints
22
+
23
+
Deprecated database settings:
24
+
-`:AllowCors`
25
+
-`:BlockedApiPolicy`
26
+
-`:BlockedApiEndpoints`
27
+
-`:BlockedApiKey`
28
+
29
+
30
+
Upgrade instructions:
31
+
32
+
The deprecated database settings will continue to work in this version. To use the new settings (which are more efficient),
@@ -25,20 +25,47 @@ The default password for the "dataverseAdmin" superuser account is "admin", as m
25
25
Blocking API Endpoints
26
26
++++++++++++++++++++++
27
27
28
-
The :doc:`/api/native-api` contains a useful but potentially dangerous API endpoint called "admin" that allows you to change system settings, make ordinary users into superusers, and more. The "builtin-users" endpoint lets admins create a local/builtin user account if they know the key defined in :ref:`BuiltinUsers.KEY`.
28
+
The :doc:`/api/native-api` contains a useful but potentially dangerous set of API endpoints called "admin" that allows you to change system settings, make ordinary users into superusers, and more. The "builtin-users" endpoints let admins do tasks such as creating a local/builtin user account if they know the key defined in :ref:`BuiltinUsers.KEY`.
29
29
30
-
By default, most APIs can be operated on remotely and a number of endpoints do not require authentication. The endpoints "admin" and "builtin-users" are limited to localhost out of the box by the settings :ref:`:BlockedApiEndpoints` and :ref:`:BlockedApiPolicy`.
30
+
By default in the code, most of these API endpoints can be operated on remotely and a number of endpoints do not require authentication. However, the endpoints "admin" and "builtin-users" are limited to localhost out of the box by the installer, using the JvmSettings :ref:`dataverse.api.blocked.endpoints` and :ref:`dataverse.api.blocked.policy`.
31
31
32
-
It is very important to keep the block in place for the "admin" endpoint, and to leave the "builtin-users" endpoint blocked unless you need to access it remotely. Documentation for the "admin" endpoint is spread across the :doc:`/api/native-api` section of the API Guide and the :doc:`/admin/index`.
32
+
.. note::
33
+
The database settings :ref:`:BlockedApiEndpoints` and :ref:`:BlockedApiPolicy` are deprecated and will be removed in a future version. Please use the JvmSettings mentioned above instead.
33
34
34
-
It's also possible to prevent file uploads via API by adjusting the :ref:`:UploadMethods` database setting.
35
+
It is **very important** to keep the block in place for the "admin" endpoint, and to leave the "builtin-users" endpoint blocked unless you need to access it remotely. Documentation for the "admin" endpoint is spread across the :doc:`/api/native-api` section of the API Guide and the :doc:`/admin/index`.
35
36
37
+
Given how important it is to avoid exposing the "admin" and "builtin-user" APIs, sites using a proxy, e.g. Apache or Nginx, should also consider blocking them through rules in the proxy.
38
+
The following examples may be useful:
39
+
40
+
Apache/Httpd Rule:
41
+
42
+
Rewrite lines added to /etc/httpd/conf.d/ssl.conf. They can be the first lines inserted after the RewriteEngine On statement:
If you are using a load balancer or a reverse proxy, there are some additional considerations. If no additional configurations are made and the upstream is configured to redirect to localhost, the API will be accessible from the outside, as your installation will register as origin the localhost for any requests to the endpoints "admin" and "builtin-users". To prevent this, you have two options:
37
59
38
60
- If your upstream is configured to redirect to localhost, you will need to set the :ref:`JVM option <useripaddresssourceheader>` to one of the following values ``%client.name% %datetime% %request% %status% %response.length% %header.referer% %header.x-forwarded-for%`` and configure from the load balancer side the chosen header to populate with the client IP address.
39
61
40
62
- Another solution is to set the upstream to the client IP address. In this case no further configuration is needed.
41
63
64
+
For more information on configuring blocked API endpoints, see :ref:`dataverse.api.blocked.endpoints` and :ref:`dataverse.api.blocked.policy` in the JvmSettings documentation.
65
+
66
+
.. note::
67
+
It's also possible to prevent file uploads via API by adjusting the :ref:`:UploadMethods` database setting.
68
+
42
69
Forcing HTTPS
43
70
+++++++++++++
44
71
@@ -3153,6 +3180,64 @@ Defaults to ``false``.
3153
3180
Can also be set via any `supported MicroProfile Config API source`_, e.g. the environment variable
3154
3181
``DATAVERSE_API_ALLOW_INCOMPLETE_METADATA``. Will accept ``[tT][rR][uU][eE]|1|[oO][nN]`` as "true" expressions.
3155
3182
3183
+
.. _dataverse.api.blocked.endpoints:
3184
+
3185
+
dataverse.api.blocked.endpoints
3186
+
+++++++++++++++++++++++++++++++
3187
+
3188
+
A comma-separated list of API endpoints that should be blocked. A minimal example that blocks endpoints for security reasons:
Can also be set via any `supported MicroProfile Config API source`_, e.g. the environment variable ``DATAVERSE_API_BLOCKED_POLICY``.
3218
+
3219
+
.. note::
3220
+
This setting will be ignored unless the :ref:`dataverse.api.blocked.endpoints` and, for the unblock-key policy, the :ref:`dataverse.api.blocked.key` are also set. Otherwise the deprecated :ref:`:BlockedApiPolicy` will be used
3221
+
3222
+
.. _dataverse.api.blocked.key:
3223
+
3224
+
dataverse.api.blocked.key
3225
+
+++++++++++++++++++++++++
3226
+
3227
+
When the blocked API policy is set to ``unblock-key``, this setting specifies the key that allows access to blocked endpoints. For example:
*Since the blocked API key is sensitive, you should treat it like a password.*
3233
+
*See* :ref:`secure-password-storage` *to learn about ways to safeguard it.*
3234
+
3235
+
Can also be set via any `supported MicroProfile Config API source`_, e.g. the environment variable ``DATAVERSE_API_BLOCKED_KEY`` (although you shouldn't use environment variables for sensitive information).
3236
+
3237
+
.. note::
3238
+
This setting will be ignored unless the :ref:`dataverse.api.blocked.policy` is set to ``unblock-key``. Otherwise the deprecated :ref:`:BlockedApiKey` will be used
@@ -3481,6 +3566,70 @@ This setting allows admins to highlight a few of the 1000+ CSL citation styles a
3481
3566
These will be listed above the alphabetical list of all styles in the "View Styled Citations" pop-up.
3482
3567
The default value when not set is "chicago-author-date, ieee".
3483
3568
3569
+
.. _dataverse.cors:
3570
+
3571
+
CORS Settings
3572
+
-------------
3573
+
3574
+
The following settings control Cross-Origin Resource Sharing (CORS) for your Dataverse installation.
3575
+
3576
+
.. _dataverse.cors.origin:
3577
+
3578
+
dataverse.cors.origin
3579
+
+++++++++++++++++++++
3580
+
3581
+
Allowed origins for CORS requests. The default with no value set is to not include CORS headers. However, if the deprecated :AllowCors setting is explicitly set to true the default is "\*" (all origins).
3582
+
When the :AllowsCors setting is not used, you must set this setting to "\*" or a list of origins to enable CORS headers.
3583
+
3584
+
Multiple origins can be specified as a comma-separated list.
Can also be set via any `supported MicroProfile Config API source`_, e.g. the environment variable ``DATAVERSE_CORS_HEADERS_EXPOSE``.
3484
3633
3485
3634
.. _feature-flags:
3486
3635
@@ -3614,8 +3763,11 @@ The pattern you will observe in curl examples below is that an HTTP ``PUT`` is u
3614
3763
3615
3764
.. _:BlockedApiPolicy:
3616
3765
3617
-
:BlockedApiPolicy
3618
-
+++++++++++++++++
3766
+
:BlockedApiPolicy (Deprecated)
3767
+
++++++++++++++++++++++++++++++
3768
+
3769
+
.. note::
3770
+
This setting is deprecated. Please use the JvmSetting :ref:`dataverse.api.blocked.policy` instead. This legacy setting will only be used if the newer JvmSettings are not set.
3619
3771
3620
3772
``:BlockedApiPolicy`` affects access to the list of API endpoints defined in :ref:`:BlockedApiEndpoints`.
3621
3773
@@ -3631,8 +3783,11 @@ Below is an example of setting ``localhost-only``.
3631
3783
3632
3784
.. _:BlockedApiEndpoints:
3633
3785
3634
-
:BlockedApiEndpoints
3635
-
++++++++++++++++++++
3786
+
:BlockedApiEndpoints (Deprecated)
3787
+
+++++++++++++++++++++++++++++++++
3788
+
3789
+
.. note::
3790
+
This setting is deprecated. Please use the JvmSetting :ref:`dataverse.api.blocked.endpoints` instead. This legacy setting will only be used if the newer JvmSettings are not set.
3636
3791
3637
3792
A comma-separated list of API endpoints to be blocked. For a standard production installation, the installer blocks both "admin" and "builtin-users" by default per the security section above:
3638
3793
@@ -3642,16 +3797,21 @@ See the :ref:`list-of-dataverse-apis` for lists of API endpoints.
3642
3797
3643
3798
.. _:BlockedApiKey:
3644
3799
3645
-
:BlockedApiKey
3646
-
++++++++++++++
3800
+
:BlockedApiKey (Deprecated)
3801
+
+++++++++++++++++++++++++++
3802
+
3803
+
.. note::
3804
+
This setting is deprecated. Please use the JvmSetting :ref:`dataverse.api.blocked.key` instead. This legacy setting will only be used if the newer JvmSettings are not set.
3647
3805
3648
3806
``:BlockedApiKey`` is used in conjunction with :ref:`:BlockedApiEndpoints` and :ref:`:BlockedApiPolicy` and will not be enabled unless the policy is set to ``unblock-key`` as demonstrated below. Please note that the order is significant. You should set ``:BlockedApiKey`` first to prevent locking yourself out.
3649
3807
3650
3808
``curl -X PUT -d s3kretKey http://localhost:8080/api/admin/settings/:BlockedApiKey``
3651
3809
3652
3810
``curl -X PUT -d unblock-key http://localhost:8080/api/admin/settings/:BlockedApiPolicy``
3653
3811
3654
-
Now that ``:BlockedApiKey`` has been enabled, blocked APIs can be accessed using the query parameter ``unblock-key=theKeyYouChose`` as in the example below.
3812
+
Now that ``:BlockedApiKey`` has been enabled, blocked APIs can be accessed using the header ``X-Dataverse-unblock-key: theKeyYouChoose`` or, less securely, the query parameter ``unblock-key=theKeyYouChose`` as in the examples below.
0 commit comments