GDCC/7715 Signed Urls for external tools#9001
Merged
kcondon merged 77 commits intoIQSS:developfrom Nov 30, 2022
Merged
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
scolapasta
approved these changes
Nov 17, 2022
…com/GlobalDataverseCommunityConsortium/dataverse.git into 7715-signed-urls-for-external-tools
Contributor
|
Issues found:
|
Member
Author
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
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

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: