@vellumai/vellum-gateway 0.6.0 → 0.6.2
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/Dockerfile +3 -1
- package/package.json +1 -1
- package/src/__tests__/config.test.ts +2 -1
- package/src/__tests__/feature-flags-route.test.ts +38 -1
- package/src/__tests__/remote-feature-flag-sync.test.ts +130 -0
- package/src/channels/inbound-event.ts +4 -2
- package/src/channels/transport-hints.ts +18 -0
- package/src/config.ts +4 -1
- package/src/download-validation.test.ts +96 -0
- package/src/download-validation.ts +92 -0
- package/src/email/normalize.test.ts +129 -0
- package/src/email/normalize.ts +94 -0
- package/src/email/verify.test.ts +96 -0
- package/src/email/verify.ts +41 -0
- package/src/feature-flag-registry.json +17 -1
- package/src/feature-flag-remote-store.ts +19 -0
- package/src/feature-flag-watcher.ts +38 -12
- package/src/http/routes/email-webhook.test.ts +393 -0
- package/src/http/routes/email-webhook.ts +243 -0
- package/src/http/routes/log-export.test.ts +530 -0
- package/src/http/routes/log-export.ts +494 -0
- package/src/http/routes/telegram-webhook.ts +21 -1
- package/src/http/routes/whatsapp-webhook.ts +28 -1
- package/src/index.ts +37 -1
- package/src/logger.ts +21 -6
- package/src/remote-feature-flag-sync.ts +91 -21
- package/src/schema.ts +149 -0
- package/src/slack/download.test.ts +81 -10
- package/src/slack/download.ts +23 -1
- package/src/slack/socket-mode.ts +10 -0
- package/src/telegram/download.ts +3 -0
- package/src/types.ts +1 -0
- package/src/whatsapp/download.ts +3 -0
package/src/slack/socket-mode.ts
CHANGED
|
@@ -103,6 +103,16 @@ export class SlackSocketModeClient {
|
|
|
103
103
|
if (data.team) {
|
|
104
104
|
this.config.teamName = data.team;
|
|
105
105
|
}
|
|
106
|
+
// Warn if the bot token is missing scopes needed for file downloads.
|
|
107
|
+
const scopes = resp.headers.get("x-oauth-scopes") ?? "";
|
|
108
|
+
if (!scopes.split(",").some((s) => s.trim() === "files:read")) {
|
|
109
|
+
log.warn(
|
|
110
|
+
"Slack bot token is missing the 'files:read' scope — file/image " +
|
|
111
|
+
"attachments will not be downloaded. Add 'files:read' to your " +
|
|
112
|
+
"Slack app's Bot Token Scopes and reinstall the app.",
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
106
116
|
log.info(
|
|
107
117
|
{
|
|
108
118
|
botUserId: data.user_id,
|
package/src/telegram/download.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { fileTypeFromBuffer } from "file-type";
|
|
|
2
2
|
import type { ConfigFileCache } from "../config-file-cache.js";
|
|
3
3
|
import type { CredentialCache } from "../credential-cache.js";
|
|
4
4
|
import { credentialKey } from "../credential-key.js";
|
|
5
|
+
import { validateDownloadedContent } from "../download-validation.js";
|
|
5
6
|
import { fetchImpl } from "../fetch.js";
|
|
6
7
|
import { callTelegramApi } from "./api.js";
|
|
7
8
|
|
|
@@ -72,6 +73,8 @@ export async function downloadTelegramFile(
|
|
|
72
73
|
response.headers.get("Content-Type")?.split(";")[0].trim() ||
|
|
73
74
|
"application/octet-stream";
|
|
74
75
|
|
|
76
|
+
await validateDownloadedContent(new Uint8Array(buffer), mimeType, fileId);
|
|
77
|
+
|
|
75
78
|
const data = Buffer.from(buffer).toString("base64");
|
|
76
79
|
|
|
77
80
|
return { filename, mimeType, data };
|
package/src/types.ts
CHANGED
package/src/whatsapp/download.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { fileTypeFromBuffer } from "file-type";
|
|
2
2
|
import type { GatewayConfig } from "../config.js";
|
|
3
|
+
import { validateDownloadedContent } from "../download-validation.js";
|
|
3
4
|
import {
|
|
4
5
|
getWhatsAppMediaMetadata,
|
|
5
6
|
downloadWhatsAppMediaBytes,
|
|
@@ -79,6 +80,8 @@ export async function downloadWhatsAppFile(
|
|
|
79
80
|
response.headers.get("Content-Type")?.split(";")[0].trim() ||
|
|
80
81
|
"application/octet-stream";
|
|
81
82
|
|
|
83
|
+
await validateDownloadedContent(new Uint8Array(buffer), mimeType, mediaId);
|
|
84
|
+
|
|
82
85
|
const filename = hint?.fileName || inferFilename(mediaId, mimeType);
|
|
83
86
|
const data = Buffer.from(buffer).toString("base64");
|
|
84
87
|
|