chore: import upstream snapshot with attribution
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* @vitest-environment node
|
||||
*/
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { buildBaseUrl } from '@/connectors/zendesk/zendesk'
|
||||
|
||||
describe('buildBaseUrl', () => {
|
||||
it.concurrent('builds the base URL for a valid subdomain', () => {
|
||||
expect(buildBaseUrl('acme')).toBe('https://acme.zendesk.com')
|
||||
})
|
||||
|
||||
it.concurrent('allows hyphens and digits within the label', () => {
|
||||
expect(buildBaseUrl('acme-support-1')).toBe('https://acme-support-1.zendesk.com')
|
||||
})
|
||||
|
||||
it.concurrent('allows a single-character subdomain', () => {
|
||||
expect(buildBaseUrl('a')).toBe('https://a.zendesk.com')
|
||||
})
|
||||
|
||||
it.concurrent('allows the maximum 63-character label', () => {
|
||||
const label = `a${'b'.repeat(61)}c`
|
||||
expect(label).toHaveLength(63)
|
||||
expect(buildBaseUrl(label)).toBe(`https://${label}.zendesk.com`)
|
||||
})
|
||||
|
||||
it.concurrent('trims surrounding whitespace', () => {
|
||||
expect(buildBaseUrl(' acme ')).toBe('https://acme.zendesk.com')
|
||||
})
|
||||
|
||||
it.concurrent('normalizes uppercase to lowercase (DNS is case-insensitive)', () => {
|
||||
expect(buildBaseUrl('MyCompany')).toBe('https://mycompany.zendesk.com')
|
||||
})
|
||||
|
||||
describe('rejects SSRF payloads', () => {
|
||||
const ssrfPayloads: Array<[string, string]> = [
|
||||
['fragment truncation', 'webhook.site/abc#'],
|
||||
['fragment with path', 'evil.com/path#'],
|
||||
['embedded path', 'acme/api/v2'],
|
||||
['scheme injection', 'http://evil.com'],
|
||||
['userinfo', 'user@evil.com'],
|
||||
['port', 'acme:8080'],
|
||||
['open-redirect host', 'httpbin.org/redirect-to?url=http://169.254.169.254'],
|
||||
['loopback', '127.0.0.1'],
|
||||
['link-local literal', '169.254.169.254'],
|
||||
['whitespace injection', 'acme evil'],
|
||||
['leading hyphen', '-acme'],
|
||||
['trailing hyphen', 'acme-'],
|
||||
['leading dot', '.acme'],
|
||||
['trailing dot', 'acme.'],
|
||||
['empty string', ''],
|
||||
['whitespace only', ' '],
|
||||
['over-length label', 'a'.repeat(64)],
|
||||
['unicode', 'acmé'],
|
||||
]
|
||||
|
||||
it.concurrent.each(ssrfPayloads)('rejects %s', (_label, payload) => {
|
||||
expect(() => buildBaseUrl(payload)).toThrow('Invalid Zendesk subdomain')
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user