diff --git a/fern/products/platform/pages/platform/core/projects.mdx b/fern/products/platform/pages/platform/core/projects.mdx index 081f0fbfc3..7bf1a11115 100644 --- a/fern/products/platform/pages/platform/core/projects.mdx +++ b/fern/products/platform/pages/platform/core/projects.mdx @@ -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 diff --git a/fern/products/platform/pages/platform/setup/api-credentials.mdx b/fern/products/platform/pages/platform/setup/api-credentials.mdx index 6e3fa56ab0..1e2db4e783 100644 --- a/fern/products/platform/pages/platform/setup/api-credentials.mdx +++ b/fern/products/platform/pages/platform/setup/api-credentials.mdx @@ -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. diff --git a/fern/products/server-sdks/pages/guides/build-ai-agents/security.mdx b/fern/products/server-sdks/pages/guides/build-ai-agents/security.mdx index 5af7da87f3..2f52a18b97 100644 --- a/fern/products/server-sdks/pages/guides/build-ai-agents/security.mdx +++ b/fern/products/server-sdks/pages/guides/build-ai-agents/security.mdx @@ -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 + + +```text +Basic Auth: signalwire:(credentials configured) (source: generated) +``` + + +```text +Auth: my-agent:**** (source: generated) ``` + + + +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 diff --git a/fern/products/swml/pages/guides/basics/webhook-security.mdx b/fern/products/swml/pages/guides/basics/webhook-security.mdx index 4002cf1689..6e654e654d 100644 --- a/fern/products/swml/pages/guides/basics/webhook-security.mdx +++ b/fern/products/swml/pages/guides/basics/webhook-security.mdx @@ -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. @@ -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.