Skip to content

Commit 52b2349

Browse files
committed
fix google calendar
1 parent e52f0f1 commit 52b2349

File tree

4 files changed

+7
-33
lines changed

4 files changed

+7
-33
lines changed

apps/sim/app/api/tools/google_calendar/calendars/route.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { type NextRequest, NextResponse } from 'next/server'
33
import { authorizeCredentialUse } from '@/lib/auth/credential-access'
44
import { generateRequestId } from '@/lib/core/utils/request'
55
import { refreshAccessTokenIfNeeded } from '@/app/api/auth/oauth/utils'
6-
import { isUuidV4 } from '@/executor/constants'
76
export const dynamic = 'force-dynamic'
87

98
const logger = createLogger('GoogleCalendarAPI')
@@ -34,16 +33,6 @@ export async function GET(request: NextRequest) {
3433
logger.warn(`[${requestId}] Missing credentialId parameter`)
3534
return NextResponse.json({ error: 'Credential ID is required' }, { status: 400 })
3635
}
37-
38-
if (!isUuidV4(credentialId)) {
39-
logger.warn(`[${requestId}] Invalid credentialId format`, { credentialId })
40-
return NextResponse.json({ error: 'Invalid credential ID format' }, { status: 400 })
41-
}
42-
43-
if (workflowId && !isUuidV4(workflowId)) {
44-
logger.warn(`[${requestId}] Invalid workflowId format`, { workflowId })
45-
return NextResponse.json({ error: 'Invalid workflow ID format' }, { status: 400 })
46-
}
4736
const authz = await authorizeCredentialUse(request, { credentialId, workflowId })
4837
if (!authz.ok || !authz.credentialOwnerUserId) {
4938
return NextResponse.json({ error: authz.error || 'Unauthorized' }, { status: 403 })

apps/sim/lib/core/security/redaction.ts

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
* Centralized redaction utilities for sensitive data
33
*/
44

5-
/** Standard marker used for all redacted values */
65
export const REDACTED_MARKER = '[REDACTED]'
76

8-
/**
9-
* Patterns for sensitive key names (case-insensitive matching)
10-
* These patterns match common naming conventions for sensitive data
11-
*/
7+
const BYPASS_REDACTION_KEYS = new Set(['nextPageToken'])
8+
129
const SENSITIVE_KEY_PATTERNS: RegExp[] = [
1310
/^api[_-]?key$/i,
1411
/^access[_-]?token$/i,
@@ -66,12 +63,10 @@ const SENSITIVE_VALUE_PATTERNS: Array<{
6663
},
6764
]
6865

69-
/**
70-
* Checks if a key name matches any sensitive pattern
71-
* @param key - The key name to check
72-
* @returns True if the key is considered sensitive
73-
*/
7466
export function isSensitiveKey(key: string): boolean {
67+
if (BYPASS_REDACTION_KEYS.has(key)) {
68+
return false
69+
}
7570
const lowerKey = key.toLowerCase()
7671
return SENSITIVE_KEY_PATTERNS.some((pattern) => pattern.test(lowerKey))
7772
}
@@ -93,12 +88,6 @@ export function redactSensitiveValues(value: string): string {
9388
return result
9489
}
9590

96-
/**
97-
* Recursively redacts sensitive data (API keys, passwords, tokens, etc.) from an object
98-
*
99-
* @param obj - The object to redact sensitive data from
100-
* @returns A new object with sensitive data redacted
101-
*/
10291
export function redactApiKeys(obj: any): any {
10392
if (obj === null || obj === undefined) {
10493
return obj

apps/sim/tools/google_calendar/list.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ interface GoogleCalendarListV2Response {
123123
success: boolean
124124
output: {
125125
nextPageToken?: string
126-
nextSyncToken?: string
127126
timeZone?: string
128127
events: Array<Record<string, any>>
129128
}
@@ -145,7 +144,6 @@ export const listV2Tool: ToolConfig<GoogleCalendarListParams, GoogleCalendarList
145144
success: true,
146145
output: {
147146
nextPageToken: data.nextPageToken,
148-
nextSyncToken: data.nextSyncToken,
149147
timeZone: data.timeZone,
150148
events: events.map((event: GoogleCalendarApiEventResponse) => ({
151149
id: event.id,
@@ -165,7 +163,6 @@ export const listV2Tool: ToolConfig<GoogleCalendarListParams, GoogleCalendarList
165163
},
166164
outputs: {
167165
nextPageToken: { type: 'string', description: 'Next page token', optional: true },
168-
nextSyncToken: { type: 'string', description: 'Next sync token', optional: true },
169166
timeZone: { type: 'string', description: 'Calendar time zone', optional: true },
170167
events: { type: 'json', description: 'List of events' },
171168
},

apps/sim/tools/types.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,15 @@ export interface ToolConfig<P = any, R = any> {
6161
}
6262
>
6363

64-
// Output schema - what this tool produces
6564
outputs?: Record<
6665
string,
6766
{
6867
type: 'string' | 'number' | 'boolean' | 'json' | 'file' | 'file[]' | 'array' | 'object'
6968
description?: string
7069
optional?: boolean
7170
fileConfig?: {
72-
mimeType?: string // Expected MIME type for file outputs
73-
extension?: string // Expected file extension
71+
mimeType?: string
72+
extension?: string
7473
}
7574
items?: {
7675
type: string

0 commit comments

Comments
 (0)