Cover zero-width-space wrapper baseURL rejection

Co-authored-by: Eric Allam <eric@trigger.dev>
This commit is contained in:
Cursor Agent
2026-02-15 06:17:12 +00:00
parent fb71d5a686
commit 9fa12b045b
3 changed files with 24 additions and 0 deletions
+1
View File
@@ -670,6 +670,7 @@ Examples:
- ✅ `https://api.trigger.dev/custom%3Fprefix%23segment` (percent-encoded `?` / `#`)
- ✅ `\uFEFFhttps://api.trigger.dev/custom-prefix/\uFEFF` (BOM wrapper trimmed)
- ❌ `\u2060https://api.trigger.dev/custom-prefix/\u2060` (word-joiner wrappers are rejected)
- ❌ `\u200Bhttps://api.trigger.dev/custom-prefix/\u200B` (zero-width-space wrappers are rejected)
- ❌ `https://api.trigger.dev?foo=bar`
- ❌ `https://api.trigger.dev#fragment`
- ❌ `https://user:pass@api.trigger.dev`
+1
View File
@@ -177,6 +177,7 @@ Examples:
-`https://api.trigger.dev/custom%3Fprefix%23segment` (percent-encoded `?` / `#`)
-`\uFEFFhttps://api.trigger.dev/custom-prefix/\uFEFF` (BOM wrapper trimmed)
-`\u2060https://api.trigger.dev/custom-prefix/\u2060` (word-joiner wrappers are rejected)
-`\u200Bhttps://api.trigger.dev/custom-prefix/\u200B` (zero-width-space wrappers are rejected)
-`https://api.trigger.dev?foo=bar` (query string)
-`https://api.trigger.dev#fragment` (hash fragment)
-`https://user:pass@api.trigger.dev` (credentials)
+22
View File
@@ -841,6 +841,17 @@ describe("TriggerChatTransport", function () {
}).toThrowError("baseURL must not contain internal whitespace characters");
});
it("throws when baseURL is wrapped with zero-width-space characters", function () {
expect(function () {
new TriggerChatTransport({
task: "chat-task",
accessToken: "pk_trigger",
baseURL: "\u200Bhttps://api.trigger.dev/custom-prefix/\u200B",
stream: "chat-stream",
});
}).toThrowError("baseURL must not contain internal whitespace characters");
});
it("throws when baseURL contains internal zero-width-non-joiner characters", function () {
expect(function () {
new TriggerChatTransport({
@@ -3624,6 +3635,17 @@ describe("TriggerChatTransport", function () {
}).toThrowError("baseURL must not contain internal whitespace characters");
});
it("throws from factory when baseURL is wrapped with zero-width-space characters", function () {
expect(function () {
createTriggerChatTransport({
task: "chat-task",
accessToken: "pk_trigger",
baseURL: "\u200Bhttps://api.trigger.dev/custom-prefix/\u200B",
stream: "chat-stream",
});
}).toThrowError("baseURL must not contain internal whitespace characters");
});
it("throws from factory when baseURL contains internal zero-width-non-joiner characters", function () {
expect(function () {
createTriggerChatTransport({