fastly / js-compute-runtime

JavaScript SDK and runtime for building Fastly Compute applications
https://developer.fastly.com/learning/compute/javascript/
Apache License 2.0
193 stars 26 forks source link

Support mTLS for dynamic backends #794

Closed kphillips closed 1 month ago

kphillips commented 1 month ago

Given that the Fastly Rust SDK supports mutual TLS for dynamic backends via BackendBuilder::provide_client_certificate(), the Fastly Compute platform is able to support mTLS backend connections.

Please extend this functionality to the JavaScript Compute SDK.

guybedford commented 1 month ago

Yes, we can add support for this in the JavaScript compute runtime, it shouldn't be too tricky.

In terms of the API, it can be as simple as adding a new clientCert field to the BackendConfiguration type, of the form:

interface ClientCert {
  cert: String,
  key: SecretStoreEntry
}

Then we would also need to implement SecretStore.fromBytes of the form:

class SecretStore {
  static fromBytes (bytes: Uint8Array) -> SecretStoreEntry;
}

I will aim to implement and land this by early next week, to go out with the next release already adding features to dynamic backends as well.

guybedford commented 1 month ago

Support landed in https://github.com/fastly/js-compute-runtime/commit/7d2b7b781ed808d9bcf1fe9584aa31f788b980a2, I'll get a release cycle going now.