environment-setup-guide
Guide developers through setting up development environments with proper tools, dependencies, and configurations
obsidian-security-basics
Implement secure Obsidian plugin development practices. Use when handling user data, implementing authentication, or ensuring plugin security best practices. Trigger with phrases like "obsidian security", "secure obsidian plugin", "obsidian data protection", "obsidian privacy".
Full skill instructions
Implement secure coding practices for Obsidian plugin development to protect user data and vault contents.
// src/settings.ts
import { Plugin, PluginSettingTab, Setting } from 'obsidian';
interface SecureSettings {
apiEndpoint: string;
// Never store API keys in plain settings
// Use Obsidian's requestUrl or secure methods
}
export class SecureSettingsTab extends PluginSettingTab {
plugin: MyPlugin;
display(): void {
const { containerEl } = this;
containerEl.empty();
// API Key - use password field, don't log
new Setting(containerEl)
.setName('API Key')
.setDesc('Your API key (stored locally, never sent in logs)')
.addText(text => {
text.inputEl.type = 'password';
text.inputEl.autocomplete = 'off';
text
.setPlaceholder('Enter API key')
.setValue(this.plugin.settings.apiKey || '')
.onChange(async (value) => {
// Don't log the value!
this.plugin.settings.apiKey = value;
await this.plugin.saveSettings();
});
});
// Add show/hide toggle
new Setting(containerEl)
.setName('Show API Key')
.addToggle(toggle => toggle
.setValue(false)
.onChange(value => {
const input = containerEl.querySelector('input[type="password"], input[type="text"]');
if (input) {
(input as HTMLInputElement).type = value ? 'text' : 'password';
}
}));
}
}
// src/security/validation.ts
export class InputValidator {
// Validate file path - prevent directory traversal
static validatePath(path: string): { valid: boolean; error?: string } {
// Check for directory traversal
if (path.includes('..')) {
return { valid: false, error: 'Path cannot contain ".."' };
}
// Check for absolute paths (platform-specific)
if (path.startsWith('/') || /^[A-Za-z]:/.test(path)) {
return { valid: false, error: 'Absolute paths not allowed' };
}
// Check for null bytes
if (path.includes('\0')) {
return { valid: false, error: 'Invalid characters in path' };
}
// Check allowed extensions
const allowedExtensions = ['.md', '.txt', '.json', '.yaml', '.yml'];
const ext = path.substring(path.lastIndexOf('.'));
if (!allowedExtensions.includes(ext.toLowerCase())) {
return { valid: false, error: 'File type not allowed' };
}
return { valid: true };
}
// Sanitize HTML content (for rendering in views)
static sanitizeHtml(html: string): string {
// Use DOMPurify or similar in production
// This is a basic example
const div = document.createElement('div');
div.textContent = html;
return div.innerHTML;
}
// Validate URL
static validateUrl(url: string): { valid: boolean; error?: string } {
try {
const parsed = new URL(url);
// Allow only HTTPS
if (parsed.protocol !== 'https:') {
return { valid: false, error: 'Only HTTPS URLs allowed' };
}
// Block localhost/internal IPs
const hostname = parsed.hostname.toLowerCase();
if (
hostname === 'localhost' ||
hostname === '127.0.0.1' ||
hostname.startsWith('192.168.') ||
hostname.startsWith('10.') ||
hostname === '0.0.0.0'
) {
return { valid: false, error: 'Internal URLs not allowed' };
}
return { valid: true };
} catch {
return { valid: false, error: 'Invalid URL format' };
}
}
}
// src/security/http.ts
import { requestUrl, RequestUrlParam } from 'obsidian';
export class SecureHttpClient {
private apiKey: string;
private baseUrl: string;
constructor(apiKey: string, baseUrl: string) {
const urlValidation = InputValidator.validateUrl(baseUrl);
if (!urlValidation.valid) {
throw new Error(`Invalid base URL: ${urlValidation.error}`);
}
this.apiKey = apiKey;
this.baseUrl = baseUrl;
}
async request<T>(
endpoint: string,
options: Partial<RequestUrlParam> = {}
): Promise<T> {
// Validate endpoint
if (endpoint.includes('..') || endpoint.includes('//')) {
throw new Error('Invalid endpoint');
}
const response = await requestUrl({
url: `${this.baseUrl}${endpoint}`,
method: options.method || 'GET',
headers: {
'Authorization': `Bearer ${this.apiKey}`,
'Content-Type': 'application/json',
...options.headers,
},
body: options.body,
throw: false, // Don't throw, handle errors manually
});
// Don't log response body (may contain sensitive data)
if (response.status >= 400) {
throw new Error(`HTTP ${response.status}: Request failed`);
}
return response.json as T;
}
}
// src/security/data-protection.ts
export class DataProtection {
// Check if file path is in allowed directories
static isPathAllowed(
path: string,
allowedFolders: string[]
): boolean {
return allowedFolders.some(folder =>
path.startsWith(folder + '/') || path === folder
);
}
// Redact sensitive content before logging
static redactForLogging(data: any): any {
const sensitiveKeys = [
'apiKey', 'api_key', 'token', 'password', 'secret',
'authorization', 'auth', 'key', 'credential'
];
if (typeof data !== 'object' || data === null) {
return data;
}
const redacted = { ...data };
for (const key of Object.keys(redacted)) {
if (sensitiveKeys.some(sk =>
key.toLowerCase().includes(sk.toLowerCase())
)) {
redacted[key] = '[REDACTED]';
} else if (typeof redacted[key] === 'object') {
redacted[key] = this.redactForLogging(redacted[key]);
}
}
return redacted;
}
// Hash content for comparison without storing original
static async hashContent(content: string): Promise<string> {
const encoder = new TextEncoder();
const data = encoder.encode(content);
const hashBuffer = await crypto.subtle.digest('SHA-256', data);
const hashArray = Array.from(new Uint8Array(hashBuffer));
return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
}
}
// src/security/permissions.ts
export class PermissionManager {
private app: App;
constructor(app: App) {
this.app = app;
}
// Check if user has enabled the required setting
async requestPermission(
action: string,
description: string
): Promise<boolean> {
return new Promise((resolve) => {
const modal = new ConfirmModal(
this.app,
`Allow "${action}"?\n\n${description}`,
(confirmed) => resolve(confirmed)
);
modal.open();
});
}
// Track external data access
logExternalAccess(
service: string,
action: string,
dataType: string
): void {
// Log for audit purposes (without sensitive data)
console.log(`[Audit] External access: ${service} - ${action} - ${dataType}`);
}
// Check before sending data externally
async confirmExternalDataShare(
service: string,
dataDescription: string
): Promise<boolean> {
return this.requestPermission(
`Send data to ${service}`,
`This will send the following data externally:\n${dataDescription}\n\nDo you want to proceed?`
);
}
}
| Risk | Mitigation |
|---|---|
| API key exposure | Store in settings, mask in UI, never log |
| Path traversal | Validate all paths, block .. |
| XSS in views | Sanitize HTML content |
| SSRF | Validate URLs, block internal addresses |
| Data leakage | Confirm before external transmission |
// When creating custom views with external content
const iframe = document.createElement('iframe');
iframe.sandbox.add('allow-scripts');
iframe.sandbox.add('allow-same-origin');
// Don't add 'allow-top-navigation' or 'allow-forms' unless needed
try {
await riskyOperation();
} catch (error) {
// Don't expose internal details
console.error('Operation failed:', DataProtection.redactForLogging(error));
// Show user-friendly message
new Notice('Operation failed. Please check your settings.');
// Don't re-throw with sensitive info
}
For pre-release checklist, see obsidian-prod-checklist.
Guide developers through setting up development environments with proper tools, dependencies, and configurations
Implement Exa lint rules, policy enforcement, and automated guardrails. Use when setting up code quality rules for Exa integrations, implementing pre-commit hooks, or configuring CI policy checks for Exa best practices. Trigger with phrases like "exa policy", "exa lint", "exa guardrails", "exa be...
Configure CI/CD pipelines for Documenso integrations. Use when setting up automated testing, deployment pipelines, or continuous integration for Documenso projects. Trigger with phrases like "documenso CI", "documenso GitHub Actions", "documenso pipeline", "documenso automated testing".
Build check model availability and implement fallback chains. Use when building resilient systems or handling model outages. Trigger with phrases like 'openrouter availability', 'openrouter fallback', 'openrouter model down', 'openrouter health check'.
Configure Langfuse enterprise organization management and access control. Use when implementing team access controls, configuring organization settings, or setting up role-based permissions for Langfuse projects. Trigger with phrases like "langfuse RBAC", "langfuse teams", "langfuse organization"...
Execute compliance and security auditing for Cursor usage. Triggers on "cursor compliance", "cursor audit", "cursor security review", "cursor soc2", "cursor gdpr". Use when analyzing or auditing cursor compliance audit. Trigger with phrases like "cursor compliance audit", "cursor audit", "cursor".
Configure Apollo.io CI/CD integration. Use when setting up automated testing, continuous integration, or deployment pipelines for Apollo integrations. Trigger with phrases like "apollo ci", "apollo github actions", "apollo pipeline", "apollo ci/cd", "apollo automated tests".
Create robust Python automation with full logging and safety checks. Use when tasks need complex data processing, authenticated API work, conditional file operations, or error handling beyond simple shell commands.
Configure PostHog across development, staging, and production environments. Use when setting up multi-environment deployments, configuring per-environment secrets, or implementing environment-specific PostHog configurations. Trigger with phrases like "posthog environments", "posthog staging", "po...
Expert in designing and building autonomous AI agents. Masters tool use, memory systems, planning strategies, and multi-agent orchestration. Use when: build agent, AI agent, autonomous agent, tool use, function calling.
Validate insecure deserialization checker operations. Auto-activating skill for Security Fundamentals. Triggers on: insecure deserialization checker, insecure deserialization checker Part of the Security Fundamentals skill category. Use when working with insecure deserialization checker functiona...
Manage path traversal finder operations. Auto-activating skill for Security Fundamentals. Triggers on: path traversal finder, path traversal finder Part of the Security Fundamentals skill category. Use when working with path traversal finder functionality. Trigger with phrases like "path traversa...
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience