Skip to content

Commit df0b2d2

Browse files
committed
fix[gmail]: removed search & read gmail since they rely on restricted scopes & a security assessment
1 parent 7b7cca7 commit df0b2d2

File tree

6 files changed

+74
-68
lines changed

6 files changed

+74
-68
lines changed

sim/app/blocks/blocks/gmail.ts

Lines changed: 66 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { BlockConfig } from '../types'
55
export const GmailBlock: BlockConfig<GmailToolResponse> = {
66
type: 'gmail',
77
name: 'Gmail',
8-
description: 'Send, read, and search Gmail',
8+
description: 'Send Gmail',
99
longDescription:
10-
'Integrate Gmail functionality to send, read, and search email messages within your workflow. Automate email communications and process email content using OAuth authentication.',
10+
'Integrate Gmail functionality to send email messages within your workflow. Automate email communications and process email content using OAuth authentication.',
1111
category: 'tools',
1212
bgColor: '#E0E0E0',
1313
icon: GmailIcon,
@@ -20,8 +20,8 @@ export const GmailBlock: BlockConfig<GmailToolResponse> = {
2020
layout: 'full',
2121
options: [
2222
{ label: 'Send Email', id: 'send_gmail' },
23-
{ label: 'Read Email', id: 'read_gmail' },
24-
{ label: 'Search Emails', id: 'search_gmail' },
23+
// { label: 'Read Email', id: 'read_gmail' },
24+
// { label: 'Search Emails', id: 'search_gmail' },
2525
],
2626
},
2727
// Gmail Credentials
@@ -34,7 +34,7 @@ export const GmailBlock: BlockConfig<GmailToolResponse> = {
3434
serviceId: 'gmail',
3535
requiredScopes: [
3636
'https://www.googleapis.com/auth/gmail.send',
37-
'https://www.googleapis.com/auth/gmail.readonly',
37+
// 'https://www.googleapis.com/auth/gmail.readonly',
3838
'https://www.googleapis.com/auth/gmail.labels',
3939
],
4040
placeholder: 'Select Gmail account',
@@ -65,64 +65,67 @@ export const GmailBlock: BlockConfig<GmailToolResponse> = {
6565
condition: { field: 'operation', value: 'send_gmail' },
6666
},
6767
// Read Email Fields - Add folder selector
68-
{
69-
id: 'folder',
70-
title: 'Label',
71-
type: 'folder-selector',
72-
layout: 'full',
73-
provider: 'google-email',
74-
serviceId: 'gmail',
75-
requiredScopes: ['https://www.googleapis.com/auth/gmail.readonly'],
76-
placeholder: 'Select Gmail label/folder',
77-
condition: { field: 'operation', value: 'read_gmail' },
78-
},
79-
{
80-
id: 'unreadOnly',
81-
title: 'Unread Only',
82-
type: 'switch',
83-
layout: 'full',
84-
condition: { field: 'operation', value: 'read_gmail' },
85-
},
86-
{
87-
id: 'maxResults',
88-
title: 'Number of Emails',
89-
type: 'short-input',
90-
layout: 'full',
91-
placeholder: 'Number of emails to retrieve (default: 1, max: 10)',
92-
condition: { field: 'operation', value: 'read_gmail' },
93-
},
94-
{
95-
id: 'messageId',
96-
title: 'Message ID',
97-
type: 'short-input',
98-
layout: 'full',
99-
placeholder: 'Enter message ID to read (optional)',
100-
condition: {
101-
field: 'operation',
102-
value: 'read_gmail',
103-
and: {
104-
field: 'folder',
105-
value: '',
106-
},
107-
},
108-
},
109-
// Search Fields
110-
{
111-
id: 'query',
112-
title: 'Search Query',
113-
type: 'short-input',
114-
layout: 'full',
115-
placeholder: 'Enter search terms',
116-
condition: { field: 'operation', value: 'search_gmail' },
117-
},
118-
{
119-
id: 'maxResults',
120-
title: 'Max Results',
121-
type: 'short-input',
122-
layout: 'full',
123-
placeholder: 'Maximum number of results (default: 10)',
124-
condition: { field: 'operation', value: 'search_gmail' },
125-
},
68+
// {
69+
// id: 'folder',
70+
// title: 'Label',
71+
// type: 'folder-selector',
72+
// layout: 'full',
73+
// provider: 'google-email',
74+
// serviceId: 'gmail',
75+
// requiredScopes: [
76+
// // 'https://www.googleapis.com/auth/gmail.readonly',
77+
// 'https://www.googleapis.com/auth/gmail.labels',
78+
// ],
79+
// placeholder: 'Select Gmail label/folder',
80+
// condition: { field: 'operation', value: 'read_gmail' },
81+
// },
82+
// {
83+
// id: 'unreadOnly',
84+
// title: 'Unread Only',
85+
// type: 'switch',
86+
// layout: 'full',
87+
// condition: { field: 'operation', value: 'read_gmail' },
88+
// },
89+
// {
90+
// id: 'maxResults',
91+
// title: 'Number of Emails',
92+
// type: 'short-input',
93+
// layout: 'full',
94+
// placeholder: 'Number of emails to retrieve (default: 1, max: 10)',
95+
// condition: { field: 'operation', value: 'read_gmail' },
96+
// },
97+
// {
98+
// id: 'messageId',
99+
// title: 'Message ID',
100+
// type: 'short-input',
101+
// layout: 'full',
102+
// placeholder: 'Enter message ID to read (optional)',
103+
// condition: {
104+
// field: 'operation',
105+
// value: 'read_gmail',
106+
// and: {
107+
// field: 'folder',
108+
// value: '',
109+
// },
110+
// },
111+
// },
112+
// // Search Fields
113+
// {
114+
// id: 'query',
115+
// title: 'Search Query',
116+
// type: 'short-input',
117+
// layout: 'full',
118+
// placeholder: 'Enter search terms',
119+
// condition: { field: 'operation', value: 'search_gmail' },
120+
// },
121+
// {
122+
// id: 'maxResults',
123+
// title: 'Max Results',
124+
// type: 'short-input',
125+
// layout: 'full',
126+
// placeholder: 'Maximum number of results (default: 10)',
127+
// condition: { field: 'operation', value: 'search_gmail' },
128+
// },
126129
],
127130
tools: {
128131
access: ['gmail_send', 'gmail_read', 'gmail_search'],

sim/app/lib/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export const auth = betterAuth({
176176
'https://www.googleapis.com/auth/userinfo.email',
177177
'https://www.googleapis.com/auth/userinfo.profile',
178178
'https://www.googleapis.com/auth/gmail.send',
179-
'https://www.googleapis.com/auth/gmail.readonly',
179+
// 'https://www.googleapis.com/auth/gmail.readonly',
180180
'https://www.googleapis.com/auth/gmail.labels',
181181
],
182182
prompt: 'consent',

sim/app/lib/oauth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = {
6262
baseProviderIcon: (props) => GoogleIcon(props),
6363
scopes: [
6464
'https://www.googleapis.com/auth/gmail.send',
65-
'https://www.googleapis.com/auth/gmail.readonly',
65+
// 'https://www.googleapis.com/auth/gmail.readonly',
6666
'https://www.googleapis.com/auth/gmail.labels',
6767
],
6868
},

sim/app/tools/gmail/read.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const gmailReadTool: ToolConfig<GmailReadParams, GmailToolResponse> = {
1313
required: true,
1414
provider: 'google-email',
1515
additionalScopes: [
16-
'https://www.googleapis.com/auth/gmail.readonly',
16+
// 'https://www.googleapis.com/auth/gmail.readonly',
1717
'https://www.googleapis.com/auth/gmail.labels',
1818
],
1919
},

sim/app/tools/gmail/search.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ export const gmailSearchTool: ToolConfig<GmailSearchParams, GmailToolResponse> =
1212
oauth: {
1313
required: true,
1414
provider: 'google-email',
15-
additionalScopes: ['https://www.googleapis.com/auth/gmail.readonly'],
15+
additionalScopes: [
16+
// 'https://www.googleapis.com/auth/gmail.readonly',
17+
'https://www.googleapis.com/auth/gmail.labels',
18+
],
1619
},
1720

1821
params: {

sim/app/w/[id]/components/workflow-block/components/sub-block/components/credential-selector/components/oauth-required-modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export interface OAuthRequiredModalProps {
3535
// Map of OAuth scopes to user-friendly descriptions
3636
const SCOPE_DESCRIPTIONS: Record<string, string> = {
3737
'https://www.googleapis.com/auth/gmail.send': 'Send emails on your behalf',
38-
'https://www.googleapis.com/auth/gmail.readonly': 'View and read your email messages',
38+
// 'https://www.googleapis.com/auth/gmail.readonly': 'View and read your email messages',
3939
'https://www.googleapis.com/auth/drive': 'View and manage your Google Drive files',
4040
'https://www.googleapis.com/auth/drive.file': 'View and manage your Google Drive files',
4141
'https://www.googleapis.com/auth/documents': 'View and manage your Google Docs',

0 commit comments

Comments
 (0)