Open underbluewaters opened 4 years ago
Example of adding authorizer to gateway/lambdas in Typescript with latest CDK
Access control of Lambda endpoints so they are not publicly accessible:
restrictedAccess: true
issAllowList: ["seasketch.org"]
. This could be hard-coded or made configurablerestrictedAccess
is true for any geoprocessing function, then SeaSketch will generate and provide a single JWT to geoprocessing React App via PostMessage event on init (interface TBD).useToken
hook, along with decoded claims. (better name?)useFunction
hook will pass JWT to all geoprocessing function requests with restrictedAccess
set to true (what about web socket requests?)restrictedAccess
is true
:Access control of sensitive reports (in addition to above):
restrictedAccess: true
, //whether publicly accessible or notSeaSketch manages which groups can access a geoprocessing function:
functionAllowList
. projectAllow
claim is also included as JWT claim, because the project name is not part of the issuer URL (subdomain) and the gp project authorizer needs to make sure request isn't being made with token for another project.
{
"claims": {
"projectAllow": "sensitive-project", // ID of seasketch project this is for, since can verify as part of issuer URL
"functionAllowList": ["sensitiveFunction1", "sensitiveFunction2"]
}
}
functionAllowList
, then it doesn't render that card or make Lambda request.forbiddenFunctions
array and if not allowed return a 403 Forbidden, otherwise proceed to run geoprocessing function Lambda.Sources:
Could potentially use the same token provided in sketch URL. Add additional claims there. Could provide an easier way to get token for debugging purposes - context menu item in sketch menu?
Should be able to use a jwt library to verify token with issuer, etc.
Implement access control scheme described here: https://github.com/seasketch/geoprocessing/wiki/OriginalDesignDoc#access-control-tokens
This system should protect user sketch data and support locking down report outputs to specific authorized projects.