perplexity-security-basics

Featured

Apply Perplexity security best practices for API key management and query safety. Use when securing API keys, implementing query sanitization, or auditing Perplexity security configuration. Trigger with phrases like "perplexity security", "perplexity secrets", "secure perplexity", "perplexity API key security", "perplexity PII".

AI & Automation 2,944 stars 440 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Perplexity Security Basics ## Overview Security best practices for Perplexity Sonar API. Key concerns: API key protection (keys start with `pplx-`), query sanitization (Perplexity searches the open web, so PII in queries gets sent to external sources), and response handling (citations link to third-party sites). ## Prerequisites - Perplexity API key from [perplexity.ai/settings/api](https://www.perplexity.ai/settings/api) - Understanding of environment variable management - `.gitignore` configured to exclude secret files ## Instructions ### Step 1: API Key Management ```bash # .env (NEVER commit to git) PERPLEXITY_API_KEY=pplx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # .gitignore .env .env.local .env.*.local *.pem ``` ```typescript // Validate key format at startup function validateApiKey(key: string): void { if (!key) throw new Error("PERPLEXITY_API_KEY is not set"); if (!key.startsWith("pplx-")) { throw new Error("PERPLEXITY_API_KEY must start with 'pplx-'"); } if (key.length < 40) { throw new Error("PERPLEXITY_API_KEY appears truncated"); } } validateApiKey(process.env.PERPLEXITY_API_KEY || ""); ``` ### Step 2: Query Sanitization (Critical) Perplexity sends your query to the open web for search. Any PII in the query is exposed to external search infrastructure. ```typescript function sanitizeQuery(query: string): string { return query // Remove email addresses .replace(/\b[\w.+-]+@[\w-]+\.[\w.]+\b/g, "[email]") // Remove p...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category