You can use secret extensions to provide your pipeline with secrets from a custom, third party source. For example, we created a reference secret extension to source secrets from Vault.
Here are some reference extensions:
Configuration
You can register a secret extension with your runners by providing the following configuration parameters:
-
DRONE_SECRET_PLUGIN_ENDPOINT
- Provides the endpoint used to make http requests to a secret extension.
-
DRONE_SECRET_PLUGIN_TOKEN
- Provides the token used to authenticate http requests to the extension. This token is shared between the server and extension.
How it Works
You can define an external secret resource in your Yaml configuration file. When you define an external secret, the runner makes an HTTP POST request to the secret extension to retrieve the external secret.
Example Yaml with external secret:
|
|
Request
The secret extensions receives an HTTP request to return a named secret. The JSON-encoded request body includes the name of the secret being requested, as well as the repository and build information.
Request Body definition:
|
|
|
|
|
|
Response
The secret extension should respond to the request with a 200 response code, and the secret encoded in JSON format. If access to the requested secret cannot be granted, the extension should return a 204 status code.
Response definition:
|
|
Example response:
{
"name": "password",
"data": "correct-horse-battery-staple"
}
Authorization
The http request is signed per the http signatures draft specification use the shared secret. The receiver should use the signature to verify the authenticity and integrity of the webhook.
Starter Project
If you are interested in creating a secret extension we recommend using our starter project as a base to jumpstart development.