Skip to content

Commit c7eb680

Browse files
committed
fix codeql
1 parent 7dde64a commit c7eb680

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

packages/nextjs/src/server/vercelQueuesMonitoring.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export function maybeEnrichQueueProducerSpan(span: Span): void {
8888
return;
8989
}
9090

91-
if (!parsed.hostname.endsWith('vercel-queue.com')) {
91+
if (parsed.hostname !== 'vercel-queue.com' && !parsed.hostname.endsWith('.vercel-queue.com')) {
9292
return;
9393
}
9494

packages/nextjs/test/server/vercelQueuesMonitoring.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ describe('vercelQueuesMonitoring', () => {
125125
expect(span._data['messaging.system']).toBeUndefined();
126126
});
127127

128+
it('does nothing for hostname that is a suffix match but not a subdomain', () => {
129+
const span = createMockSpan({ 'url.full': 'https://evil-vercel-queue.com/api/v3/topic/orders' });
130+
maybeEnrichQueueProducerSpan(span as any);
131+
expect(span._data['messaging.system']).toBeUndefined();
132+
});
133+
128134
it('does nothing for vercel-queue.com URLs without topic path', () => {
129135
const span = createMockSpan({ 'url.full': 'https://queue.vercel-queue.com/api/v3/other' });
130136
maybeEnrichQueueProducerSpan(span as any);

0 commit comments

Comments
 (0)