-
Notifications
You must be signed in to change notification settings - Fork 495
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
GDCC/7715 Signed Urls for external tools #9001
GDCC/7715 Signed Urls for external tools #9001
Conversation
impements POST-redirect-GET for DP Creator tool POST is currently done on server, gets a redirect response, and GETs the new location in the browser Need to change the way the base context is gotten for POST, as in the GET code, it always uses the extenal tool url as provided in the configuration - the redirect use be a different context than the configured tool url.
remove some experimental code
…/dataverse into 7715-signed-urls-for-external-tools
…ar DPCreator WIP - still need to handle use of signed Url to access resource on dataverse
…7715-signed-urls-for-external-tools Validation fix and API call
…7715-signed-urls-for-external-tools Define/use an additional secret key, Refactor token replacement for signed urls
…7715-signed-urls-for-external-tools 7715 signed urls for external tools
…7715-signed-urls-for-external-tools Minor tweaks from IQSS#7325 review
7715-signed-urls-for-external-tools
- use the user if supplied - require superuser
feat: make API signing secret a JvmSetting IQSS#7715
…com/GlobalDataverseCommunityConsortium/dataverse.git into 7715-signed-urls-for-external-tools
Issues found:
|
Calling the appropriate file or dataset scope toolparam endpoint directly is basically starting at the fourth bullet above. There is also a separate workflow to directly request a signed URL, e.g. calling |
Daily:
|
7715-signed-urls-for-external-tools
What this PR does / why we need it: This PR eliminates the need to share a user's apiToken with external tools, reducing the risk in trusting tools and the privacy of the user's local machine. It adds a new set of allowedApiCalls to the tool manifest which allow Dataverse to provide a defined set of signedUrls to the tool.
Two options are available
POST - where the queryparams and allowedApiCall signed URLs are sent in a post body to the tool URL, after which Dataverse redirects to a redirect URL provided in the response (as OpenDP works now)
GET - where a base64 encoded callback param is sent to the tool as a query param in the URL. The decoded token is a signed URL to retrieve all the rest of the query params and allowedApiCalls.
In all cases, URLs are only signed if the dataset/datafile in question is not public.
Which issue(s) this PR closes:
Closes #7715
Closes #8999
Special notes for your reviewer: There are tests for the major functionality. Nominally some IT tests could be added but the unit tests cover the same functionlity (i.e. creating/validating a sighed URL, assuring the json sent back in the dataset and datafile callback URLs is valid/correct.
@rtreacy - note that I dropped the internal "apis" object in the tool manifest. If you run this branch, you'll need to moidy the tool manifest for openDP
Re: POST - I think openDP wanted this because we didn't have a way to do a GET and get many signed URLs (they wouldn't all fit on the GET URL). With the new callback mechanism, that is now possible and OpenDP might want to just use a GET. My guess is that GET will be easier for most external tools to use.
Suggestions on how to test this: The API calls themselves can be tested. One can also register a tool with the new signedURL mechanism and manually verify the callback works:
Tool Manfiest: {
"displayName": "Read Text",
"toolName": "textPreviewer",
"description": "Read the text file.",
"types": [
"preview"
],
"scope": "file",
"toolUrl": "https://gdcc.github.io/dataverse-previewers/previewers/v1.3/TextPreview.html",
"toolParameters": {
"httpMethod": "GET",
"queryParameters": [
{
"fileid": "{fileId}"
},
{
"siteUrl": "{siteUrl}"
},
{
"datasetid": "{datasetId}"
},
{
"datasetversion": "{datasetVersion}"
},
{
"locale": "{localeCode}"
}
]
},
"contentType": "text/plain",
"allowedApiCalls": [
{
"name": "retrieveDataFile",
"httpMethod": "GET",
"urlTemplate": "/api/v1/access/datafile/{fileId}",
"timeOut": 270
}
]
}
Test steps:
Could/should repeat this with a non-null dataverse.api.signature-secret jvm/microProfile setting.
It should not be too hard to create updated Previewers so we may be able to test real ones once they exist.
Does this PR introduce a user interface change? If mockups are available, please link/include them here:
Is there a release notes update needed for this change?: included, doc updates as well
Additional documentation: