Security / least privilege
Give each producer only the access it needs.
Authentication identifies the caller. Authorization determines which workspace and operations that identity may use. A token that parses correctly can still be expired, scoped incorrectly or bound to a different region.
Reference scope model
| Scope | Allowed action | Typical identity |
|---|---|---|
| events:write | Submit telemetry envelopes | Application producer |
| traces:read | Query retained trace data | Diagnostic CLI or operator |
| webhooks:replay | Request a new delivery attempt | Incident responder |
| workspace:admin | Manage workspace configuration | Restricted control-plane automation |
Scopes are additive but workspace-bound. A producer should not carry read, replay or administration scopes merely because it runs on a server. Rotate service identities independently from human accounts.
Server-side initialization
// Illustrative API; the fictional package is not included here.
const token = process.env.PULSEFLOW_TOKEN;
const workspaceId = process.env.PULSEFLOW_WORKSPACE;
if (!token || !workspaceId) {
throw new Error('PulseFlow server configuration is incomplete');
}
const client = new PulseFlow({
token,
workspaceId,
region: process.env.PULSEFLOW_REGION ?? 'us-east-1'
});Inject the token from a secret manager or protected CI secret. Never prefix it with a framework's public-environment-variable marker. Ensure error serializers, request interceptors and debug logs redact authorization headers before logging.
Short-lived credentials in CI
The imagined platform can exchange a workload identity for a short-lived token. A secure implementation must validate issuer, audience, repository, branch and environment claims before minting credentials. This fixture does not implement an exchange endpoint or claim to trust any particular identity provider. If an exchange cannot be verified, fail closed instead of falling back to a broad personal token.
Rotation without silent data loss
- Create a replacement identity with the same minimal scopes.
- Deploy it to one canary producer and verify accepted events.
- Roll it out to all producers and track the old identity's remaining usage.
- Revoke the old token after the overlap window.
- Confirm revoked-token requests fail and no logs contain the old value.
Store the token identifier and last-rotation date for auditing, not the secret itself. A rotation rollback should use a newly authorized credential, not re-enable a leaked token.
Diagnose authentication failures
- 401: check presence, expiry and revocation; avoid automatic retry loops.
- 403: check workspace binding and required scopes; a new token with identical scopes will not help.
- Regional mismatch: verify workspace residency before changing endpoints.
- Works locally but not in CI: inspect secret injection and environment protection without printing the token.
Browser applications
Send telemetry through an application-controlled backend that applies rate limits, consent and field allowlists. A secret embedded in JavaScript is public regardless of obfuscation. The local playground demonstrates UI behavior only and performs no authenticated requests.
Next: implement the structured error policy or review the CI/CD guide.