Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-helmich committed Nov 5, 2024
1 parent 463407c commit 956517a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ mittwald_extension_webhook_controllers:
prefix: /
```
### 3. Configure encryption key
> [!IMPORTANT]
> This step is important for making sure that your extension secrets are stored securely.
> Without this step, the webhooks will only throw exceptions. It's for your own safety. ;)
The safest way to configure the instance secret encryption key is using an environment variable.
Place the following configuration in your `services.yaml` and make sure the respective environment variable is defined:

```yaml
# config/services.yaml
parameters:
mstudio_ext.instance_secret_key: '%env(MSTUDIO_EXTENSION_SECRET_KEY)%'
```

## Optional integrations

### Implementing event handlers
Expand Down
4 changes: 4 additions & 0 deletions src/Security/ExtensionInstanceSealer.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ public function sealExtensionInstanceSecret(string $secret): string
return $secret;
}

if ($this->key === "CHANGE_ME") {
throw new ExtensionInstanceSealerException("no encryption key was defined; refusing to continue for your own good; read the documentation to learn how to configure an encryption key");
}

$length = openssl_cipher_iv_length($this->cipherMethod);
if ($length === false) {
throw new ExtensionInstanceSealerException("error while building IV");
Expand Down

0 comments on commit 956517a

Please sign in to comment.