lokalise-security-basics
Apply Lokalise security best practices for API tokens and access control. Use when securing API tokens, implementing least privilege access, or auditing Lokalise security configuration. Trigger with phrases like "lokalise security", "lokalise secrets", "secure lokalise", "lokalise API token security".
Best use case
lokalise-security-basics is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Apply Lokalise security best practices for API tokens and access control. Use when securing API tokens, implementing least privilege access, or auditing Lokalise security configuration. Trigger with phrases like "lokalise security", "lokalise secrets", "secure lokalise", "lokalise API token security".
Teams using lokalise-security-basics should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/lokalise-security-basics/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How lokalise-security-basics Compares
| Feature / Agent | lokalise-security-basics | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Apply Lokalise security best practices for API tokens and access control. Use when securing API tokens, implementing least privilege access, or auditing Lokalise security configuration. Trigger with phrases like "lokalise security", "lokalise secrets", "secure lokalise", "lokalise API token security".
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
ChatGPT vs Claude for Agent Skills
Compare ChatGPT and Claude for AI agent skills across coding, writing, research, and reusable workflow execution.
SKILL.md Source
# Lokalise Security Basics
## Overview
Security practices for Lokalise integrations: API token management with scoped permissions, translation content sanitization, CI/CD secret handling, webhook secret verification, and audit logging. Lokalise handles translation strings that may contain user-facing content, interpolation variables, and occasionally PII embedded in keys or values.
## Prerequisites
- Lokalise API token provisioned (admin token for audit, scoped tokens for operations)
- Understanding of Lokalise token permission model (read-only vs read-write)
- Secret management infrastructure (GitHub Secrets, AWS Secrets Manager, GCP Secret Manager, or Vault)
## Instructions
### Step 1: Token Scope Management
Lokalise API tokens are either read-only or read-write. Create separate tokens per use case to enforce least privilege.
```typescript
import { LokaliseApi } from "@lokalise/node-api";
// Token strategy: separate tokens per context
const TOKENS = {
// CI download pipeline — read-only token
ciDownload: process.env.LOKALISE_READ_TOKEN,
// CI upload pipeline — read-write token
ciUpload: process.env.LOKALISE_WRITE_TOKEN,
// Admin operations (contributor management, webhooks) — admin token
admin: process.env.LOKALISE_ADMIN_TOKEN,
} as const;
function getClient(scope: keyof typeof TOKENS): LokaliseApi {
const token = TOKENS[scope];
if (!token) {
throw new Error(
`LOKALISE_${scope.toUpperCase()}_TOKEN not set. ` +
`Generate at https://app.lokalise.com/profile#apitokens`
);
}
return new LokaliseApi({ apiKey: token, enableCompression: true });
}
// Download translations — uses read-only token
const readClient = getClient("ciDownload");
const bundle = await readClient.files().download(projectId, {
format: "json",
original_filenames: false,
bundle_structure: "%LANG_ISO%.json",
});
```
### Step 2: Validate Translation Content
Translation strings may contain interpolation variables, HTML, or user-generated content. Validate before rendering.
```typescript
interface ValidationIssue {
key: string;
severity: "critical" | "warning";
message: string;
}
function validateTranslation(key: string, value: string): ValidationIssue[] {
const issues: ValidationIssue[] = [];
// XSS: Check for script injection in translations
if (/<script|javascript:|on\w+=/i.test(value)) {
issues.push({ key, severity: "critical", message: "Potential XSS payload" });
}
// Credential leak: Check for secrets in translation values
if (/(api_key|password|secret|token)\s*[:=]/i.test(value)) {
issues.push({ key, severity: "critical", message: "Possible credential in value" });
}
// Placeholder integrity: Ensure ICU/i18next placeholders are well-formed
const placeholders = value.match(/\{[^}]+\}|\{\{[^}]+\}\}/g) ?? [];
for (const p of placeholders) {
if (/[<>'"]/.test(p)) {
issues.push({ key, severity: "warning", message: `Suspicious placeholder: ${p}` });
}
}
return issues;
}
// Validate all translations after download
import { readFileSync } from "fs";
function auditTranslationFile(filePath: string): ValidationIssue[] {
const data: Record<string, string> = JSON.parse(
readFileSync(filePath, "utf-8")
);
return Object.entries(data).flatMap(([key, value]) =>
validateTranslation(key, value)
);
}
const issues = auditTranslationFile("./src/locales/de.json");
const critical = issues.filter((i) => i.severity === "critical");
if (critical.length > 0) {
console.error("CRITICAL security issues found in translations:");
critical.forEach((i) => console.error(` ${i.key}: ${i.message}`));
process.exit(1);
}
```
### Step 3: Webhook Secret Verification
Lokalise sends a random alphanumeric secret in the `X-Secret` header. Always verify it.
```typescript
import express from "express";
const WEBHOOK_SECRET = process.env.LOKALISE_WEBHOOK_SECRET!;
function verifyWebhookSecret(
req: express.Request,
res: express.Response,
next: express.NextFunction
): void {
const secret = req.headers["x-secret"] as string | undefined;
if (!secret || secret !== WEBHOOK_SECRET) {
console.error("Webhook secret verification failed", {
ip: req.ip,
path: req.path,
hasSecret: !!secret,
});
res.status(401).json({ error: "Invalid webhook secret" });
return;
}
next();
}
```
### Step 4: CI/CD Token Security
```yaml
# GitHub Actions: use repository secrets, never hardcode tokens
name: Sync Translations
on:
push:
branches: [main]
paths: ['src/locales/en.json']
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Pull translations
env:
LOKALISE_API_TOKEN: ${{ secrets.LOKALISE_READ_TOKEN }}
LOKALISE_PROJECT_ID: ${{ vars.LOKALISE_PROJECT_ID }}
run: |
# Token is masked in logs by GitHub Actions
lokalise2 file download \
--token "$LOKALISE_API_TOKEN" \
--project-id "$LOKALISE_PROJECT_ID" \
--format json \
--original-filenames=false \
--bundle-structure "%LANG_ISO%.json" \
--unzip-to ./src/locales/
```
### Step 5: Scan for Hardcoded Tokens
```bash
#!/bin/bash
# scripts/scan-secrets.sh — Run in CI or as pre-commit hook
set -euo pipefail
echo "=== Lokalise Token Security Scan ==="
# Check for hardcoded tokens in source files
HARDCODED=$(grep -rn "X-Api-Token\|apiKey.*['\"][a-f0-9]\{32,\}" \
--include="*.ts" --include="*.js" --include="*.json" --include="*.yml" \
src/ .github/ 2>/dev/null \
| grep -v node_modules \
| grep -v "process.env\|secrets\.\|vars\.\|\${{" || true)
if [[ -n "$HARDCODED" ]]; then
echo "FAIL: Potential hardcoded token found:"
echo "$HARDCODED"
exit 1
fi
# Verify .env files are gitignored
if ! grep -q "\.env" .gitignore 2>/dev/null; then
echo "WARN: .env not in .gitignore — add it immediately"
fi
# Check git history for leaked tokens
HISTORY_LEAK=$(git log --all -p --diff-filter=A -- '*.env' '*.env.*' 2>/dev/null \
| grep -i "LOKALISE_API_TOKEN=" | head -3 || true)
if [[ -n "$HISTORY_LEAK" ]]; then
echo "CRITICAL: Token found in git history. Rotate immediately."
echo " Use 'git filter-repo' to remove, then rotate the token."
exit 1
fi
echo "PASS: No hardcoded tokens detected"
```
### Step 6: Audit Translation Changes
```typescript
interface TranslationAuditEntry {
timestamp: string;
projectId: string;
key: string;
locale: string;
userId: string;
action: "create" | "update" | "delete";
// Never log actual content — may contain PII
oldLength: number;
newLength: number;
}
function logTranslationChange(entry: TranslationAuditEntry): void {
// Ship to your logging backend (Datadog, CloudWatch, etc.)
console.log(JSON.stringify({
level: "info",
event: "translation_change",
...entry,
}));
}
```
## Output
- Scoped token configuration with separate read/write/admin tokens
- Translation content validator catching XSS, credential leaks, and malformed placeholders
- Webhook secret verification middleware for Express
- CI/CD workflow using repository secrets with masked output
- Pre-commit/CI scan script for hardcoded tokens
- Audit logging for translation changes (PII-safe)
## Error Handling
| Issue | Cause | Solution |
|-------|-------|----------|
| Token leaked in CI logs | Token in command output | Use env variables; GitHub Actions auto-masks secrets |
| XSS via translations | Unsanitized translation rendered as HTML | Validate with `validateTranslation()` before use |
| Overprivileged access | Using admin token for read-only operations | Create scoped tokens per use case |
| Unauthorized changes | No audit trail | Register webhook for `project.translation.updated` events |
| Token in git history | Committed .env file | Rotate token immediately, use `git filter-repo` to scrub |
## Resources
- [Lokalise API Authentication](https://developers.lokalise.com/reference/api-authentication)
- [Lokalise Security](https://lokalise.com/security)
- [Webhook Events Reference](https://developers.lokalise.com/docs/webhook-events)
- [OWASP Secrets Management](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html)
## Next Steps
For enterprise-level access control with SSO and contributor groups, see `lokalise-enterprise-rbac`.Related Skills
performing-security-testing
Test automate security vulnerability testing covering OWASP Top 10, SQL injection, XSS, CSRF, and authentication issues. Use when performing security assessments, penetration tests, or vulnerability scans. Trigger with phrases like "scan for vulnerabilities", "test security", or "run penetration test".
checking-session-security
Analyze session management implementations to identify security vulnerabilities in web applications. Use when you need to audit session handling, check for session fixation risks, review session timeout configurations, or validate session ID generation security. Trigger with phrases like "check session security", "audit session management", "review session handling", or "session fixation vulnerability".
finding-security-misconfigurations
Configure identify security misconfigurations in infrastructure-as-code, application settings, and system configurations. Use when you need to audit Terraform/CloudFormation templates, check application config files, validate system security settings, or ensure compliance with security best practices. Trigger with phrases like "find security misconfigurations", "audit infrastructure security", "check config security", or "scan for misconfigured settings".
responding-to-security-incidents
Analyze and guide security incident response, investigation, and remediation processes. Use when you need to handle security breaches, classify incidents, develop response playbooks, gather forensic evidence, or coordinate remediation efforts. Trigger with phrases like "security incident response", "ransomware attack response", "data breach investigation", "incident playbook", or "security forensics".
analyzing-security-headers
Analyze HTTP security headers of web domains to identify vulnerabilities and misconfigurations. Use when you need to audit website security headers, assess header compliance, or get security recommendations for web applications. Trigger with phrases like "analyze security headers", "check HTTP headers", "audit website security headers", or "evaluate CSP and HSTS configuration".
generating-security-audit-reports
Generate comprehensive security audit reports for applications and systems. Use when you need to assess security posture, identify vulnerabilities, evaluate compliance status, or create formal security documentation. Trigger with phrases like "create security audit report", "generate security assessment", "audit security posture", or "PCI-DSS compliance report".
workhuman-security-basics
Workhuman security basics for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman security basics".
wispr-security-basics
Wispr Flow security basics for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr security basics".
windsurf-security-basics
Apply Windsurf security best practices for workspace isolation, data privacy, and secret protection. Use when securing sensitive code from AI indexing, configuring telemetry, or auditing Windsurf security posture. Trigger with phrases like "windsurf security", "windsurf secrets", "windsurf privacy", "windsurf data protection", "codeiumignore".
webflow-security-basics
Apply Webflow API security best practices — token management, scope least privilege, OAuth 2.0 secret rotation, webhook signature verification, and audit logging. Use when securing API tokens, implementing least privilege access, or auditing Webflow security configuration. Trigger with phrases like "webflow security", "webflow secrets", "secure webflow", "webflow API key security", "webflow token rotation".
vercel-security-basics
Apply Vercel security best practices for secrets, headers, and access control. Use when securing API keys, configuring security headers, or auditing Vercel security configuration. Trigger with phrases like "vercel security", "vercel secrets", "secure vercel", "vercel headers", "vercel CSP".
veeva-security-basics
Veeva Vault security basics for REST API and clinical operations. Use when working with Veeva Vault document management and CRM. Trigger: "veeva security basics".