@pie-players/tts-client-server 0.3.36 → 0.3.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -179,6 +179,7 @@ interface ServerTTSProviderConfig {
|
|
|
179
179
|
endpointValidationMode?: 'voices' | 'endpoint' | 'none';
|
|
180
180
|
authToken?: string; // JWT or API key
|
|
181
181
|
includeAuthOnAssetFetch?: boolean;
|
|
182
|
+
assetOrigins?: string[]; // Trusted origins for Authorization header
|
|
182
183
|
organizationId?: string; // For multi-tenant setups
|
|
183
184
|
headers?: Record<string, string>; // Custom headers
|
|
184
185
|
voiceId?: string; // Voice ID
|
|
@@ -188,6 +189,36 @@ interface ServerTTSProviderConfig {
|
|
|
188
189
|
}
|
|
189
190
|
```
|
|
190
191
|
|
|
192
|
+
## Security
|
|
193
|
+
|
|
194
|
+
`ServerTTSProvider` treats `apiEndpoint` and `authToken` as host-owned.
|
|
195
|
+
The host is responsible for authenticating `/api/tts/*` (session cookie,
|
|
196
|
+
JWT, or equivalent), rate-limiting callers, and keeping vendor
|
|
197
|
+
credentials (AWS, Google, etc.) server-side only. End-to-end guidance —
|
|
198
|
+
including a SvelteKit `hooks.server.ts` sketch and rate-limit example —
|
|
199
|
+
lives in
|
|
200
|
+
[`@pie-players/tts-server-polly` → INTEGRATION-GUIDE.md § Security Considerations](../tts-server-polly/examples/INTEGRATION-GUIDE.md#security-considerations).
|
|
201
|
+
|
|
202
|
+
The provider itself enforces one piece of security directly: it scrubs
|
|
203
|
+
the `Authorization` header when following URLs returned by the TTS
|
|
204
|
+
server that fall outside a trusted origin set.
|
|
205
|
+
|
|
206
|
+
- **`assetOrigins`** — allow-list of origins permitted to receive the
|
|
207
|
+
bearer token when the provider fetches custom-transport audio or
|
|
208
|
+
speech-mark URLs. Defaults to the origin of `apiEndpoint` (or, for a
|
|
209
|
+
relative `apiEndpoint`, `window.location.origin`). Non-`http(s)`
|
|
210
|
+
URLs and malformed URLs are always rejected, regardless of this
|
|
211
|
+
setting.
|
|
212
|
+
- **`includeAuthOnAssetFetch`** — defaults to `false`. When `true`, the
|
|
213
|
+
provider will forward `Authorization` on asset fetches *only* to
|
|
214
|
+
origins in `assetOrigins`; off-allow-list origins are fetched without
|
|
215
|
+
auth. Leave at the default unless your CDN / storage backend actually
|
|
216
|
+
requires the bearer token to read assets.
|
|
217
|
+
|
|
218
|
+
See
|
|
219
|
+
[`docs/tools-and-accomodations/tool_host_contract.md#backend-endpoints-for-tool-providers`](../../docs/tools-and-accomodations/tool_host_contract.md#backend-endpoints-for-tool-providers)
|
|
220
|
+
for the host-wide contract this provider fits into.
|
|
221
|
+
|
|
191
222
|
## How It Works
|
|
192
223
|
|
|
193
224
|
1. **Client calls** `speak(text)`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-players/tts-client-server",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.37",
|
|
4
4
|
"description": "Client-side TTS provider that calls server API for synthesis",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@pie-players/pie-tts": "0.3.
|
|
41
|
+
"@pie-players/pie-tts": "0.3.37"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"typescript": "^5.9.3",
|