-
Notifications
You must be signed in to change notification settings - Fork 23
[Hold][WIP] Workflow Endpoint: how to encrypt secrets #670
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments! I can add a commit to this branch to update the code samples once the new certificate flow is ready. Some other thoughts:
- I think the pattern of showing redacted on the encrypted text is a bit noisy. It's instructive to show the
---BEGIN PUBLIC KEY---
headers and such, but the other text will always be garbled nonsense, so there's nothing to "hide". Maybe just ellipses?
{
"encrypted_aes_key": "x3+......9zD",
"aes_iv": "k2N......g==",
"encrypted_value": "gM1......A2m",
"type": "rsa_aes"
}
typically required when creating [source connectors](/api-reference/workflow/sources/overview) or | ||
[destination connectors](/api-reference/workflow/destinations/overview) that work with specific third-party services. | ||
|
||
Instead of programmatically sending a secret to Unstructured in plain text, which presents a security risk, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of programmatically sending a secret to Unstructured in plain text, which presents a security risk, | |
There are inherent risks to sending plaintext secrets over a network. For stronger security, you may choose to use Unstructured's process for encrypting secrets locally as follows: |
For now our stance is that this is more secure but it isn't backwards incompatible (except for GDrive). We'll also need to confirm that SecretReference
is accepted by all connectors before pushing this approach too broadly.
Instead of programmatically sending a secret to Unstructured in plain text, which presents a security risk, | ||
you must instead follow Unstructured's process for more securely sending the secret as follows: | ||
|
||
1. Call Unstructured to get the Privacy Enhanced Mail (PEM) version of the public key for your Unstructured user account. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. Call Unstructured to get the Privacy Enhanced Mail (PEM) version of the public key for your Unstructured user account. | |
1. Call Unstructured to get the RSA public key associated with your Unstructured user account. |
The pem
detail is probably too in the weeds. For the security minded folks who are doing this, the file format goes without saying. "RSA public key" is the right level of detail.
you must instead follow Unstructured's process for more securely sending the secret as follows: | ||
|
||
1. Call Unstructured to get the Privacy Enhanced Mail (PEM) version of the public key for your Unstructured user account. | ||
2. Use this PEM to encrypt your plain-text secret locally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2. Use this PEM to encrypt your plain-text secret locally. | |
2. Use this key to encrypt your plaintext secret locally. |
|
||
- [Google Drive source connector](/api-reference/workflow/sources/google-drive) | ||
|
||
Unstructured plans to add this requirement to other source and destination connectors in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unstructured plans to add this requirement to other source and destination connectors in the future. | |
Unstructured plans to support this workflow with other source and destination connectors in the future. |
import GetStartedSimpleAPIOnly from '/snippets/general-shared-text/get-started-simple-api-only.mdx'; | ||
|
||
While you can use a REST API client such as `curl` or Postman to complete most of the following steps, you can only use Python to | ||
complete the step of encrypting the plain-text secret locally. Otherwise, both approaches are shown for the other steps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
complete the step of encrypting the plain-text secret locally. Otherwise, both approaches are shown for the other steps. | |
complete the step of encrypting the plaintext secret locally. Otherwise, both approaches are shown for the other steps. |
|
||
import GetStartedSimpleAPIOnly from '/snippets/general-shared-text/get-started-simple-api-only.mdx'; | ||
|
||
While you can use a REST API client such as `curl` or Postman to complete most of the following steps, you can only use Python to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you can use a REST API client such as `curl` or Postman to complete most of the following steps, you can only use Python to | |
While you can use a REST API client such as `curl` or Postman to complete most of the following steps, you can only use Python or another encryption language library to |
- `UNSTRUCTURED_API_URL`, set to the Workflow Endpoint API URL for your Unstructured user account. | ||
- `UNSTRUCTURED_API_KEY`, set to the API key for your Unstructured user account. | ||
|
||
## Step 1: Get the PEM version of the public key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Step 1: Get the PEM version of the public key | |
## Step 1: Get the RSA public key |
</Accordion> | ||
</AccordionGroup> | ||
|
||
## Step 4: Use the registered secret's ID and encryption type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Step 4: Use the registered secret's ID and encryption type | |
## Step 4: Use the registered secret's reference ID |
See this notebook for an updated flow once https://github.com/Unstructured-IO/platform-api/pull/544 is merged. The response from |
Work in progress. Still waiting for renamed "retrieve" endpoint, and certificate signing.
For now, see: