MCPcopy Index your code
hub / github.com/simstudioai/sim / verifyAuth

Function verifyAuth

apps/sim/lib/webhooks/providers/incidentio.ts:93–134  ·  view source on GitHub ↗
({
    request,
    rawBody,
    requestId,
    providerConfig,
  }: AuthContext)

Source from the content-addressed store, hash-verified

91
92export const incidentioHandler: WebhookProviderHandler = {
93 async verifyAuth({
94 request,
95 rawBody,
96 requestId,
97 providerConfig,
98 }: AuthContext): Promise<NextResponse | null> {
99 const signingSecret = providerConfig.signingSecret as string | undefined
100 if (!signingSecret?.trim()) {
101 logger.warn(
102 `[${requestId}] incident.io webhook missing signing secret in provider configuration`
103 )
104 return new NextResponse('Unauthorized - incident.io signing secret is required', {
105 status: 401,
106 })
107 }
108
109 const webhookId = request.headers.get('webhook-id')
110 const webhookTimestamp = request.headers.get('webhook-timestamp')
111 const webhookSignature = request.headers.get('webhook-signature')
112
113 if (!webhookId || !webhookTimestamp || !webhookSignature) {
114 logger.warn(`[${requestId}] incident.io webhook missing Svix signature headers`)
115 return new NextResponse('Unauthorized - Missing incident.io signature headers', {
116 status: 401,
117 })
118 }
119
120 if (
121 !verifyIncidentioSignature(
122 signingSecret,
123 webhookId,
124 webhookTimestamp,
125 webhookSignature,
126 rawBody
127 )
128 ) {
129 logger.warn(`[${requestId}] incident.io Svix signature verification failed`)
130 return new NextResponse('Unauthorized - Invalid incident.io signature', { status: 401 })
131 }
132
133 return null
134 },
135
136 async matchEvent({ body, providerConfig, requestId }: EventMatchContext) {
137 const triggerId = providerConfig.triggerId as string | undefined

Callers

nothing calls this directly

Calls 3

warnMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected