serpapi-security-basics
Secure SerpApi API keys and prevent credit abuse. Use when storing API keys, implementing backend proxies, or auditing SerpApi access patterns. Trigger: "serpapi security", "serpapi API key security", "secure serpapi".
- License 许可
- MIT
- 最近更新
- 2026-07-13
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- serpapi-security-basics
- tags
- [ "saas", "search", "seo", "serpapi" ]
- author
- Jeremy Longshore <jeremy@intentsolutions.io>
- license
- MIT
- version
- 1.0.0
- description
- Secure SerpApi API keys and prevent credit abuse. Use when storing API keys, implementing backend proxies, or auditing SerpApi access patterns. Trigger: "serpapi security", "serpapi API key security", "secure serpapi".
- allowed-tools
- Read, Write, Grep
- compatible-with
- claude-code
03 SKILL.md 正文
SerpApi Security Basics
Overview
SerpApi uses a single API key for authentication. The key grants full account access -- there are no scoped keys or OAuth. Protect it like a credit card: never expose in frontend code, always proxy through your backend.
Instructions
Step 1: Never Expose API Key in Frontend
// BAD: API key in browser-side code
const result = await fetch(`https://serpapi.com/search.json?q=${query}&api_key=YOUR_KEY`);
// GOOD: Proxy through your backend
// Frontend
const result = await fetch(`/api/search?q=${encodeURIComponent(query)}`);
// Backend (api/search.ts)
export async function GET(req: Request) {
const url = new URL(req.url);
const q = url.searchParams.get('q');
const result = await getJson({
engine: 'google', q,
api_key: process.env.SERPAPI_API_KEY, // Server-side only
});
return Response.json(result.organic_results);
}
Step 2: Secure Storage
# .gitignore
.env
.env.local
# Use platform secret managers in production
gh secret set SERPAPI_API_KEY # GitHub Actions
vercel env add SERPAPI_API_KEY # Vercel
fly secrets set SERPAPI_API_KEY=x # Fly.io
Step 3: Rate Limit Your Proxy
// Prevent abuse of your search proxy endpoint
import rateLimit from 'express-rate-limit';
const searchLimiter = rateLimit({
windowMs: 60_000, // 1 minute
max: 10, // 10 searches per minute per IP
message: 'Too many searches, try again later',
});
app.get('/api/search', searchLimiter, searchHandler);
Step 4: Monitor Usage
# Set up daily usage check
curl -s "https://serpapi.com/account.json?api_key=$SERPAPI_API_KEY" \
| jq '{used: .this_month_usage, remaining: .plan_searches_left}'
# Alert if usage is unexpectedly high
Security Checklist
- [ ] API key in environment variables only
- [ ]
.envin.gitignore - [ ] Backend proxy for all search requests
- [ ] Rate limiting on proxy endpoints
- [ ] Usage monitoring and alerts
- [ ] Separate keys for dev/prod (if available)
Resources
Next Steps
For production deployment, see serpapi-prod-checklist.
04 同仓库更多 Skills
zustand-store-creator
Create zustand store creator operations. Auto-activating skill for Frontend Development. Triggers on: zustand store creator, zustand store creator Part of the Frontend Development skill category. Use when working with zustand store creator functionality. Trigger with phrases like "zustand store creator", "zustand creator", "zustand".
zero-trust-config-helper
Configure with zero trust config helper operations. Auto-activating skill for Security Advanced. Triggers on: zero trust config helper, zero trust config helper Part of the Security Advanced skill category. Use when configuring systems or services. Trigger with phrases like "zero trust config helper", "zero helper", "zero".
zapier-integration-helper
Assist with zapier integration helper operations. Auto-activating skill for Business Automation. Triggers on: zapier integration helper, zapier integration helper Part of the Business Automation skill category. Use when working with APIs or building integrations. Trigger with phrases like "zapier integration helper", "zapier helper", "zapier".
yaml-config-validator
Validate yaml config validator operations. Auto-activating skill for DevOps Basics. Triggers on: yaml config validator, yaml config validator Part of the DevOps Basics skill category. Use when configuring systems or services. Trigger with phrases like "yaml config validator", "yaml validator", "yaml".
xvary-stock-research
Thesis-driven equity analysis from public SEC EDGAR and market data; /analyze, /score, /compare workflows with bundled Python tools (Claude Code, Cursor, Codex).
xss-vulnerability-scanner
Scan xss vulnerability scanner operations. Auto-activating skill for Security Fundamentals. Triggers on: xss vulnerability scanner, xss vulnerability scanner Part of the Security Fundamentals skill category. Use when working with xss vulnerability scanner functionality. Trigger with phrases like "xss vulnerability scanner", "xss scanner", "xss".