verygoodsecurity / starlarky

VGS edition of Google's safe and hermetically sealed Starlark language - a non-Turing complete subset of Python 3.
https://vgs.dev
Apache License 2.0
28 stars 38 forks source link

Larky Third Party Applications #49

Open mjallday opened 3 years ago

mjallday commented 3 years ago

Proposing an interface for calling third party operations made available via the marketplace.

Assuming we provision an application that provides an operation for virus scanning we can invoke like this

Given an application defined like (see marketplace spec)

apiVersion: 1.0.0
kind: App
data:
  fqn: myCompany/virusScanner

and it has been provisioned onto a vault, it would become available to be invoked via larky like so:

# namespace/app-name/function-name
@loads('myCompany/virusScanner/scan')
def process(input, ctx):
    result = myCompany.virusScanner.scan(input, ctx)
    # do something with result
    if result.hasVirus:
       return abort(400, 'You have a virus')
    return input

Local development can be enabled by the app providing a basic mocked request/response that allows integrators to receive a static response without running a stand-alone server in their local environment.

We would need to publish a basic request/response somehow so that the api for the method call is available to the developer.

mahmoudimus commented 3 years ago

@mjallday did this get resolved with #71 ?