以 MCP 和 n8n 審核 Google Workspace Marketplace 外掛的 OAuth 風險
Audit Google Workspace OAuth Risks with MCP & n8n
文章示範以 MCP 和 n8n 審查 Google Workspace Marketplace 外掛的 OAuth 權限,並整理 Top 100 熱門應用程式的風險數據。
Google Workspace OAuth auditing maps add-on permission URIs (drive, gmail.*, admin.*) to Google's official restricted, sensitive, and non-sensitive verification tiers so security teams can catch over-scoped Shadow SaaS automatically. Auditing the Top 100 popular-apps on Google Workspace Marketplace shows 42% request at least one Google Restricted OAuth scope and 21% combine high OAuth risk with >365 days since their last listing update.
Below, you'll get the real 100-app security findings plus two zero-proxy automation patterns: querying Marketplace OAuth risks inside Claude / Cursor via Apify MCP, and running a weekly 5-node n8n Slack alert workflow.
Transparency note: I built the Apify Actor used in this walkthrough (Google Workspace Marketplace Scraper). All stats come from running it live on popular-apps.
Table of Contents
- Top 100 Marketplace OAuth Study Results
- Step 1: Audit Apps in Claude or Cursor via Apify MCP
- Step 2: Weekly OAuth and Review Alerts in n8n
- Why No Playwright Is Needed
- Try It and Share Feedback
Top 100 Marketplace OAuth Study Results
Instead of manually clicking through OAuth consent screens, we extracted the Top 100 apps in popular-apps via Jvccvctus/google-workspace-marketplace-scraper (finished in 32.4 seconds, $0.50 total at $5/1,000 apps all-inclusive, zero residential proxies).
| Metric (Top 100 Popular Apps, Nov 2026) | Result |
|---|---|
Apps requesting ≥ 1 Google Restricted OAuth scope (high risk) |
42% |
Apps requesting Sensitive scopes only (medium risk) |
51% |
Apps requesting Non-Sensitive scopes only (low risk) |
7% |
| Average / Median OAuth scopes per app | 8.47 / 6.5 |
Apps with auth/script.external_request (external server calls) |
43% |
Apps with auth/drive (full Drive read/write, Restricted) |
18% |
Apps with auth/admin.directory.user.readonly (Restricted) |
18% |
| Apps with High OAuth risk + > 365 days without listing update | 21% |
| Apps with Google's Verified Developer badge | 55% |
| Apps with ≥ 1 negative (1–2★) recent review | 59% |
Top 10 Most Frequently Requested Scopes
| Rank | OAuth Scope | Google Tier | Share of Top 100 |
|---|---|---|---|
| 1 | auth/userinfo.email |
non-sensitive |
100% |
| 2 | auth/userinfo.profile |
non-sensitive |
100% |
| 3 | auth/script.external_request |
sensitive |
43% |
| 4 | auth/script.container.ui |
non-sensitive |
36% |
| 5 | auth/drive.file |
sensitive |
26% |
| 6 | auth/script.scriptapp |
sensitive |
25% |
| 7 | auth/spreadsheets |
sensitive |
23% |
| 8 | auth/script.send_mail |
sensitive |
19% |
| 9 | auth/drive |
restricted |
18% |
| 10 | auth/admin.directory.user.readonly |
restricted |
18% |
Why context matters: Enterprise governance platforms such as GAT+ (47 scopes, 26 restricted) or BetterCloud (38 scopes, 23 restricted) legitimately need Admin SDK access. The real audit priority is catching everyday Docs, PDF, or Sheets utilities asking for blanket auth/drive instead of per-file auth/drive.file — especially the 21% untouched for over a year.
Step 1: Audit Apps in Claude or Cursor via Apify MCP
The scraper runs with Limited permissions, making it discoverable and callable over Apify's hosted MCP server (https://mcp.apify.com). Every record returns oauthSummary, oauthScopes, reviewSummary, and a concise markdownSummary optimized for LLM context windows.
MCP Client Configuration
{
"mcpServers": {
"apify-gwm": {
"type": "http",
"url": "https://mcp.apify.com/?tools=fetch-actor-details,Jvccvctus/google-workspace-marketplace-scraper",
"headers": {
"Authorization": "Bearer YOUR_APIFY_API_TOKEN"
}
}
}
}
Copy-Paste Security Audit Prompts
- Allowlist Screening (before approving an employee request):
Inspect https://workspace.google.com/marketplace/app/bettercloud/800521135851 using Jvccvctus/google-workspace-marketplace-scraper and list every Google Restricted OAuth scope, whether the developer is verified, update freshness in days, and any recurring issues in recent 1-2 star reviews.
- Category Comparison:
Find the top 10 Freemium Gmail & Google Sheets mail merge apps with at least 100,000 installs, rank them by OAuth riskLevel, and flag stale listings (>365 days).
Sample Output Schema (oauthSummary)
{
"oauthSummary": {
"totalScopeCount": 8,
"restrictedScopeCount": 1,
"sensitiveScopeCount": 3,
"nonSensitiveScopeCount": 4,
"riskLevel": "high",
"scopeUrls": [
"https://www.googleapis.com/auth/spreadsheets",
"https://www.googleapis.com/auth/gmail.send"
]
}
}
Personal reviewer names and internal Gaia IDs are excluded intentionally so outputs stay GDPR-friendly.
Step 2: Weekly OAuth and Review Alerts in n8n
To run this audit automatically every Monday and forward only flagged apps (high OAuth risk or recent 1–2★ reviews) to Slack, use the official @apify/n8n-nodes-apify community node (Run actor and get dataset).
Workflow Architecture
- Schedule Trigger — Every Monday at 09:00.
-
Apify (
Run actor and get dataset) — ExecutesJvccvctus~google-workspace-marketplace-scraperwithmaxTotalChargeUsd: 0.25. -
IF Node — Checks
oauthSummary.riskLevel === "high"ORreviewSummary.negativeReviewCount > 0. -
Code Node — Builds a compact Slack alert digest with exact install counts (
installCountNumeric) and Marketplace links. - HTTP Request Node — Posts the digest to your Slack / Teams / Discord Webhook.
Ready-to-Import n8n Workflow JSON (Includes Canvas Sticky Notes)
{
"name": "Google Workspace Marketplace — Weekly OAuth Risk & Competitor Monitor",
"nodes": [
{
"parameters": {
"width": 580,
"height": 200,
"color": 6,
"content": "## 🛡️ Google Workspace OAuth & Competitor Audit\nAutomatically audits Google Workspace Marketplace add-ons every Monday for **Google Restricted OAuth scopes** (`high` risk) and recent **1–2★ complaints**.\n\n### Setup (3 Steps)\n1. Connect your **Apify API** credential in node **Run Google Workspace Marketplace Scraper**.\n2. *(Optional)* Edit `customBody` (`categories`, `searchQueries`, `worksWithFilter`, `minInstalls`).\n3. Paste your Slack / Teams / Discord Incoming Webhook URL in **Send Alert to Slack / Webhook**."
},
"id": "a1000001-0001-4000-8000-000000000010",
"name": "Sticky Note — Setup Guide",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [140, 40]
},
{
"parameters": {
"width": 680,
"height": 170,
"color": 4,
"content": "## ⚙️ Branching, Budget Cap & Output\n- **Cost guard:** `maxTotalChargeUsd` is capped at **$0.25/run** (typical 25-app run costs **~$0.125** at $0.005/app all-inclusive; works on Apify's $5/mo Free plan).\n- **Alert condition:** Only forwards apps where `oauthSummary.riskLevel === \"high\"` **OR** `reviewSummary.negativeReviewCount > 0`.\n- **GDPR-safe:** Excludes personal reviewer names & IDs."
},
"id": "a1000001-0001-4000-8000-000000000011",
"name": "Sticky Note — Alert Rules & Budget",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [740, 40]
},
{
"parameters": {
"rule": {
"interval": [{ "field": "weeks", "triggerAtDay": [1], "triggerAtHour": 9, "triggerAtMinute": 0 }]
}
},
"id": "a1000001-0001-4000-8000-000000000001",
"name": "Every Monday at 09:00",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [220, 300]
},
{
"parameters": {
"authentication": "apifyApi",
"resource": "Actors",
"operation": "Run actor and get dataset",
"actorId": "Jvccvctus~google-workspace-marketplace-scraper",
"actorInputMode": "json",
"customBody": "{\n \"categories\": [\"business-tools\"],\n \"includeOAuthScopes\": true,\n \"includeReviews\": true,\n \"maxReviewsPerApp\": 5,\n \"maxApps\": 25\n}",
"memory": 512,
"maxTotalChargeUsd": 0.25
},
"id": "a1000001-0001-4000-8000-000000000002",
"name": "Run Google Workspace Marketplace Scraper",
"type": "@apify/n8n-nodes-apify.apify",
"typeVersion": 1,
"position": [480, 300]
},
{
"parameters": {
"conditions": {
"options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 2 },
"conditions": [
{
"id": "cond-high-risk",
"leftValue": "={{ $json.oauthSummary?.riskLevel }}",
"rightValue": "high",
"operator": { "type": "string", "operation": "equals" }
},
{
"id": "cond-neg-reviews",
"leftValue": "={{ $json.reviewSummary?.negativeReviewCount ?? 0 }}",
"rightValue": 0,
"operator": { "type": "number", "operation": "gt" }
}
],
"combinator": "or"
}
},
"id": "a1000001-0001-4000-8000-000000000003",
"name": "High OAuth Risk or 1-2 Star Complaints?",
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [740, 300]
},
{
"parameters": {
"mode": "runOnceForAllItems",
"jsCode": "const flagged = $input.all().map((item) => item.json);\nif (flagged.length === 0) return [];\nconst highRisk = flagged.filter((a) => a.oauthSummary?.riskLevel === 'high');\nconst lines = [`*Google Workspace Marketplace Weekly Audit* — ${flagged.length} flagged app(s) (${highRisk.length} high OAuth risk)`, ''];\nfor (const app of flagged.slice(0, 15)) {\n const installs = app.installCountNumeric ? app.installCountNumeric.toLocaleString('en-US') : (app.installCountLabel || 'N/A');\n const risk = (app.oauthSummary?.riskLevel || 'unknown').toUpperCase();\n const restricted = app.oauthSummary?.restrictedScopeCount ?? 0;\n const neg = app.reviewSummary?.negativeReviewCount ?? 0;\n lines.push(`• *${app.name}* (${installs} installs | ${app.pricingModel}) — OAuth: *${risk}* (${restricted} restricted) | 1-2★ recent: ${neg} | <${app.url}|Listing>`);\n}\nreturn [{ json: { flaggedCount: flagged.length, highRiskCount: highRisk.length, message: lines.join('\\n') } }];"
},
"id": "a1000001-0001-4000-8000-000000000004",
"name": "Build Weekly Alert Digest",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [1000, 240]
},
{
"parameters": {
"method": "POST",
"url": "https://hooks.slack.com/services/REPLACE/WITH/YOUR_WEBHOOK",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ text: $json.message }) }}"
},
"id": "a1000001-0001-4000-8000-000000000005",
"name": "Send Alert to Slack / Webhook",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [1260, 240]
}
],
"connections": {
"Every Monday at 09:00": { "main": [[{ "node": "Run Google Workspace Marketplace Scraper", "type": "main", "index": 0 }]] },
"Run Google Workspace Marketplace Scraper": { "main": [[{ "node": "High OAuth Risk or 1-2 Star Complaints?", "type": "main", "index": 0 }]] },
"High OAuth Risk or 1-2 Star Complaints?": { "main": [[{ "node": "Build Weekly Alert Digest", "type": "main", "index": 0 }], []] },
"Build Weekly Alert Digest": { "main": [[{ "node": "Send Alert to Slack / Webhook", "type": "main", "index": 0 }]] }
}
}
Why No Playwright Is Needed
Google Workspace Marketplace embeds structured arrays inside SSR AF_initDataCallback script blocks (ds:1 for core metadata & exact install counts, ds:5 for OAuth scopes, ds:6 for recent reviews). Running pure TypeScript HTTP + Cheerio instead of headless Chromium keeps typical 5–15 app runs at 2–5 seconds on ~164 MB RAM and puts weekly 25-app monitoring at $0.125/week (~$0.50/month) under $0.005/app Pay-Per-Event pricing (covered by Apify's $5 monthly Free tier credits).
Try It and Share Feedback
- Run on Apify Store: Google Workspace Marketplace Scraper
-
Connect via MCP:
https://mcp.apify.com/?tools=fetch-actor-details,Jvccvctus/google-workspace-marketplace-scraper
Question for you: How does your team currently audit Google Workspace add-ons before approving domain-wide OAuth access — manual consent review, Google Admin allowlisting, or automated scripts? Drop your workflow below!
來源:DEV Community · dev.to