mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
fix[gmail]: removed search & read gmail since they rely on restricted scopes & a security assessment
This commit is contained in:
@@ -5,9 +5,9 @@ import { BlockConfig } from '../types'
|
||||
export const GmailBlock: BlockConfig<GmailToolResponse> = {
|
||||
type: 'gmail',
|
||||
name: 'Gmail',
|
||||
description: 'Send, read, and search Gmail',
|
||||
description: 'Send Gmail',
|
||||
longDescription:
|
||||
'Integrate Gmail functionality to send, read, and search email messages within your workflow. Automate email communications and process email content using OAuth authentication.',
|
||||
'Integrate Gmail functionality to send email messages within your workflow. Automate email communications and process email content using OAuth authentication.',
|
||||
category: 'tools',
|
||||
bgColor: '#E0E0E0',
|
||||
icon: GmailIcon,
|
||||
@@ -20,8 +20,8 @@ export const GmailBlock: BlockConfig<GmailToolResponse> = {
|
||||
layout: 'full',
|
||||
options: [
|
||||
{ label: 'Send Email', id: 'send_gmail' },
|
||||
{ label: 'Read Email', id: 'read_gmail' },
|
||||
{ label: 'Search Emails', id: 'search_gmail' },
|
||||
// { label: 'Read Email', id: 'read_gmail' },
|
||||
// { label: 'Search Emails', id: 'search_gmail' },
|
||||
],
|
||||
},
|
||||
// Gmail Credentials
|
||||
@@ -34,7 +34,7 @@ export const GmailBlock: BlockConfig<GmailToolResponse> = {
|
||||
serviceId: 'gmail',
|
||||
requiredScopes: [
|
||||
'https://www.googleapis.com/auth/gmail.send',
|
||||
'https://www.googleapis.com/auth/gmail.readonly',
|
||||
// 'https://www.googleapis.com/auth/gmail.readonly',
|
||||
'https://www.googleapis.com/auth/gmail.labels',
|
||||
],
|
||||
placeholder: 'Select Gmail account',
|
||||
@@ -65,64 +65,67 @@ export const GmailBlock: BlockConfig<GmailToolResponse> = {
|
||||
condition: { field: 'operation', value: 'send_gmail' },
|
||||
},
|
||||
// Read Email Fields - Add folder selector
|
||||
{
|
||||
id: 'folder',
|
||||
title: 'Label',
|
||||
type: 'folder-selector',
|
||||
layout: 'full',
|
||||
provider: 'google-email',
|
||||
serviceId: 'gmail',
|
||||
requiredScopes: ['https://www.googleapis.com/auth/gmail.readonly'],
|
||||
placeholder: 'Select Gmail label/folder',
|
||||
condition: { field: 'operation', value: 'read_gmail' },
|
||||
},
|
||||
{
|
||||
id: 'unreadOnly',
|
||||
title: 'Unread Only',
|
||||
type: 'switch',
|
||||
layout: 'full',
|
||||
condition: { field: 'operation', value: 'read_gmail' },
|
||||
},
|
||||
{
|
||||
id: 'maxResults',
|
||||
title: 'Number of Emails',
|
||||
type: 'short-input',
|
||||
layout: 'full',
|
||||
placeholder: 'Number of emails to retrieve (default: 1, max: 10)',
|
||||
condition: { field: 'operation', value: 'read_gmail' },
|
||||
},
|
||||
{
|
||||
id: 'messageId',
|
||||
title: 'Message ID',
|
||||
type: 'short-input',
|
||||
layout: 'full',
|
||||
placeholder: 'Enter message ID to read (optional)',
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: 'read_gmail',
|
||||
and: {
|
||||
field: 'folder',
|
||||
value: '',
|
||||
},
|
||||
},
|
||||
},
|
||||
// Search Fields
|
||||
{
|
||||
id: 'query',
|
||||
title: 'Search Query',
|
||||
type: 'short-input',
|
||||
layout: 'full',
|
||||
placeholder: 'Enter search terms',
|
||||
condition: { field: 'operation', value: 'search_gmail' },
|
||||
},
|
||||
{
|
||||
id: 'maxResults',
|
||||
title: 'Max Results',
|
||||
type: 'short-input',
|
||||
layout: 'full',
|
||||
placeholder: 'Maximum number of results (default: 10)',
|
||||
condition: { field: 'operation', value: 'search_gmail' },
|
||||
},
|
||||
// {
|
||||
// id: 'folder',
|
||||
// title: 'Label',
|
||||
// type: 'folder-selector',
|
||||
// layout: 'full',
|
||||
// provider: 'google-email',
|
||||
// serviceId: 'gmail',
|
||||
// requiredScopes: [
|
||||
// // 'https://www.googleapis.com/auth/gmail.readonly',
|
||||
// 'https://www.googleapis.com/auth/gmail.labels',
|
||||
// ],
|
||||
// placeholder: 'Select Gmail label/folder',
|
||||
// condition: { field: 'operation', value: 'read_gmail' },
|
||||
// },
|
||||
// {
|
||||
// id: 'unreadOnly',
|
||||
// title: 'Unread Only',
|
||||
// type: 'switch',
|
||||
// layout: 'full',
|
||||
// condition: { field: 'operation', value: 'read_gmail' },
|
||||
// },
|
||||
// {
|
||||
// id: 'maxResults',
|
||||
// title: 'Number of Emails',
|
||||
// type: 'short-input',
|
||||
// layout: 'full',
|
||||
// placeholder: 'Number of emails to retrieve (default: 1, max: 10)',
|
||||
// condition: { field: 'operation', value: 'read_gmail' },
|
||||
// },
|
||||
// {
|
||||
// id: 'messageId',
|
||||
// title: 'Message ID',
|
||||
// type: 'short-input',
|
||||
// layout: 'full',
|
||||
// placeholder: 'Enter message ID to read (optional)',
|
||||
// condition: {
|
||||
// field: 'operation',
|
||||
// value: 'read_gmail',
|
||||
// and: {
|
||||
// field: 'folder',
|
||||
// value: '',
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// // Search Fields
|
||||
// {
|
||||
// id: 'query',
|
||||
// title: 'Search Query',
|
||||
// type: 'short-input',
|
||||
// layout: 'full',
|
||||
// placeholder: 'Enter search terms',
|
||||
// condition: { field: 'operation', value: 'search_gmail' },
|
||||
// },
|
||||
// {
|
||||
// id: 'maxResults',
|
||||
// title: 'Max Results',
|
||||
// type: 'short-input',
|
||||
// layout: 'full',
|
||||
// placeholder: 'Maximum number of results (default: 10)',
|
||||
// condition: { field: 'operation', value: 'search_gmail' },
|
||||
// },
|
||||
],
|
||||
tools: {
|
||||
access: ['gmail_send', 'gmail_read', 'gmail_search'],
|
||||
|
||||
+1
-1
@@ -176,7 +176,7 @@ export const auth = betterAuth({
|
||||
'https://www.googleapis.com/auth/userinfo.email',
|
||||
'https://www.googleapis.com/auth/userinfo.profile',
|
||||
'https://www.googleapis.com/auth/gmail.send',
|
||||
'https://www.googleapis.com/auth/gmail.readonly',
|
||||
// 'https://www.googleapis.com/auth/gmail.readonly',
|
||||
'https://www.googleapis.com/auth/gmail.labels',
|
||||
],
|
||||
prompt: 'consent',
|
||||
|
||||
@@ -62,7 +62,7 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = {
|
||||
baseProviderIcon: (props) => GoogleIcon(props),
|
||||
scopes: [
|
||||
'https://www.googleapis.com/auth/gmail.send',
|
||||
'https://www.googleapis.com/auth/gmail.readonly',
|
||||
// 'https://www.googleapis.com/auth/gmail.readonly',
|
||||
'https://www.googleapis.com/auth/gmail.labels',
|
||||
],
|
||||
},
|
||||
|
||||
@@ -13,7 +13,7 @@ export const gmailReadTool: ToolConfig<GmailReadParams, GmailToolResponse> = {
|
||||
required: true,
|
||||
provider: 'google-email',
|
||||
additionalScopes: [
|
||||
'https://www.googleapis.com/auth/gmail.readonly',
|
||||
// 'https://www.googleapis.com/auth/gmail.readonly',
|
||||
'https://www.googleapis.com/auth/gmail.labels',
|
||||
],
|
||||
},
|
||||
|
||||
@@ -12,7 +12,10 @@ export const gmailSearchTool: ToolConfig<GmailSearchParams, GmailToolResponse> =
|
||||
oauth: {
|
||||
required: true,
|
||||
provider: 'google-email',
|
||||
additionalScopes: ['https://www.googleapis.com/auth/gmail.readonly'],
|
||||
additionalScopes: [
|
||||
// 'https://www.googleapis.com/auth/gmail.readonly',
|
||||
'https://www.googleapis.com/auth/gmail.labels',
|
||||
],
|
||||
},
|
||||
|
||||
params: {
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ export interface OAuthRequiredModalProps {
|
||||
// Map of OAuth scopes to user-friendly descriptions
|
||||
const SCOPE_DESCRIPTIONS: Record<string, string> = {
|
||||
'https://www.googleapis.com/auth/gmail.send': 'Send emails on your behalf',
|
||||
'https://www.googleapis.com/auth/gmail.readonly': 'View and read your email messages',
|
||||
// 'https://www.googleapis.com/auth/gmail.readonly': 'View and read your email messages',
|
||||
'https://www.googleapis.com/auth/drive': 'View and manage your Google Drive files',
|
||||
'https://www.googleapis.com/auth/drive.file': 'View and manage your Google Drive files',
|
||||
'https://www.googleapis.com/auth/documents': 'View and manage your Google Docs',
|
||||
|
||||
Reference in New Issue
Block a user