Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fern/products/platform/pages/platform/core/projects.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ Subprojects.
[Update a project][update-project] changes the name and security settings of any Project in that
tree, root Project included.
[Rotate a project's signing key][rotate-signing-key] issues a new webhook-signing key for one.
Requests can arrive signed with the old key for a minute or two afterward, so accept either key until
the new one is active.
Requests can arrive signed with the old key for about a minute afterward, and calls already in
progress keep using it until they end, so accept either key until those calls finish.

Integrations built around Compatibility API Account SIDs see the same tree as Accounts:
[Create Subprojects](/docs/compatibility-api/rest/accounts/create-subprojects) and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,11 @@ New signing keys begin with `swpsk_` and are 42 characters long. Keys created ea

After you select **Show**, **Reset** replaces the current key with the next key, which the
confirmation dialog shows before you proceed. [Rotate signing key](/docs/apis/rest/projects/rotate-signing-key)
promotes the same next key through the API. Either way, the new key takes a minute or two to become
active, and until then requests can still arrive signed with the old key. Update your verification
code to accept a signature that verifies with either key during that window, then remove the old key.
promotes the same next key through the API. Either way, the new key takes about a minute to become
active, and until then requests can still arrive signed with the old key. Calls already in progress
keep signing with the old key until they end. Update your verification code to accept a signature
that verifies with either key until the new key is active and those calls have finished, then remove
the old key.

Because that next key already exists, a Project created before the `swpsk_` format can receive a
`PSK_` key from its first reset or API rotation.
Expand Down
29 changes: 18 additions & 11 deletions fern/products/server-sdks/pages/guides/build-ai-agents/security.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -137,19 +137,26 @@ export SWML_BASIC_AUTH_PASSWORD=my_very_secure_password_here

**Option 2: Let SDK Generate Credentials (Development)**

If you don't set credentials, the SDK:
If you don't set a password, the SDK generates a random one on each startup and keeps it only in
memory. The username is `SWML_BASIC_AUTH_USER` when you set it, and an SDK default otherwise. The
startup log names the username and marks the credentials as generated, but it never prints the
password:

- Uses username: `signalwire`
- Generates a random password on each startup
- Prints the password to the console

```bash
$ python my_agent.py
INFO: Agent 'my-agent' starting...
INFO: Basic Auth credentials:
INFO: Username: signalwire
INFO: Password: a7b3x9k2m5n1p8q4 # Use this in SignalWire webhook config
<CodeBlocks>
<CodeBlock title="Python — Server SDK">
```text
Basic Auth: signalwire:(credentials configured) (source: generated)
```
</CodeBlock>
<CodeBlock title="TypeScript — Server SDK">
```text
Auth: my-agent:**** (source: generated)
```
</CodeBlock>
</CodeBlocks>

To know the credentials, for example to put them in a webhook URL or call the agent yourself, set
both `SWML_BASIC_AUTH_USER` and `SWML_BASIC_AUTH_PASSWORD`.

Use generated credentials only in development. The agent puts its credentials in every webhook URL
it generates, so when a restart generates a new password, the calls already in progress fail their
Expand Down
6 changes: 5 additions & 1 deletion fern/products/swml/pages/guides/basics/webhook-security.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ You can rotate the key with the reset button on the same page. A new key takes a
become active, and the page shows it to you before you confirm the reset so you can copy it into
your application first.

A call keeps the key it signed its first request with, so calls already in progress keep using the
old key until they end. Accept both keys until the new key is active and those calls have finished.

Treat the signing key like a password: keep it in an environment variable or a secret manager, not
in the source you deploy.

Expand Down Expand Up @@ -381,7 +384,8 @@ A signature that never validates almost always comes down to one of these:
- **The body was re-serialized.** Hash the bytes you received, not `JSON.stringify` of the parsed
object.
- **The wrong project's key.** Signing keys are per project.
- **The key was just rotated.** A new key needs about a minute to become active.
- **The key was just rotated.** A new key needs about a minute to become active, and calls already
in progress keep signing with the old key until they end.
- **Basic auth in the URL.** A call, AI agent requests included, strips embedded credentials before
signing, so hash the URL without them. A message signs the URL as configured, so hash it with
them.
Expand Down
Loading