
security
MUST be used whenever fixing security issues in a Flows app, or before shipping any feature that handles credentials, user input, or external data. This skill finds AND fixes security problems — it does not just report them. Do NOT skip this when the user asks for a security fix, security hardening, or vulnerability remediation — run every step in order. Triggers: security, security fix, security hardening, vulnerability, XSS, injection, credentials, secrets, auth, authentication, authorization, token, sensitive data, input validation, CORS, CSP, dependency audit.
- Installs
- 1.9K
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/cognitedata/builder-skills --skill security- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads security automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Security Fix
Find and fix security issues in $ARGUMENTS (or the whole app if no argument is given). Work through every step below in order. Every step that finds an issue must also fix it.
Step 1 — Map the attack surface
Read these files before checking anything:
src/main.tsx/src/App.tsx— entry point, routing, auth gatingvite.config.ts— dev server proxy, CORS, headerspackage.json— list of third-party dependencies- Any file matching
**/auth*,**/login*,**/token*,**/credential*
Identify:
- All pages/routes and whether each is behind an auth guard
- All places where external data enters the app (CDF SDK calls,
fetch, user form input) - All places where data is written back (CDF upsert,
fetchPOST/PUT/DELETE)
Step 2 — Migrate all CDF access to the Cognite SDK
All traffic to Cognite Data Fusion (CDF) must go through the official Cognite SDK. Find any HTTP, WebSocket, or other network call to CDF-like hosts or APIs that bypasses the SDK and rewrite it to use the SDK.
Search for raw HTTP calls
# Find fetch, axios, XMLHttpRequest, and other HTTP client usage
grep -rn --include="*.ts" --include="*.tsx" --include="*.js" \
-E "(fetch\(|axios\.|axios\(|XMLHttpRequest|\.ajax\(|http\.get\(|http\.post\(|request\()" src/
# Find raw URL construction that looks like CDF endpoints
grep -rn --include="*.ts" --include="*.tsx" \
-E "(cognitedata\.com|cognite\.ai|/api/v1/projects|cdf\.|\.cognite\.)" src/
# Find custom Authorization or api-key headers
grep -rn --include="*.ts" --include="*.tsx" \
-E "(Authorization|api-key|apikey|x-api-key)" src/ | grep -v "node_modules"
How to fix
For each raw CDF call found, read the surrounding code to understand what CDF resource and operation it targets, then rewrite it using the appropriate SDK method. Remove the raw HTTP client import if it's no longer used.
| Pattern | Action |
|---|---|
fetch() or axios call to a CDF URL (*.cognitedata.com, /api/v1/projects/*) | Rewrite to use the Cognite SDK (cognite.files.getDownloadUrls(...), cognite.timeseries.retrieve(...), client.instances.search(...), etc.) |
Custom Authorization header with a CDF token | Remove — the SDK handles auth automatically |
| WebSocket connection to CDF endpoints | Rewrite to use SDK streaming methods |
| Proxy endpoint that forwards to CDF internally | Rewrite the proxy to use the SDK internally |
fetch() to a non-CDF URL (static assets, documented third-party API) | Leave — but add a comment documenting why it's needed |
After rewriting all CDF calls, remove any axios or fetch-related imports that are no longer used.
What is acceptable
- All CDF reads/writes through
sdk.files.*,sdk.timeseries.*,client.instances.*, etc. - Non-CDF network calls that are:
- To known static asset hosts (CDNs, image services)
- To documented third-party APIs required by the product
- Explicitly noted in the app's README or architecture docs
Step 3 — Find and fix credential & secret hygiene
Search for hard-coded credentials and sensitive values:
# Look for anything that smells like a secret in source files
grep -rn --include="*.ts" --include="*.tsx" --include="*.js" \
-E "(password|secret|apikey|api_key|token|bearer|private_key)\s*=\s*['\"]" src/
For each hardcoded secret, replace it with an environment variable. Create or update .env.example with a placeholder. Add .env to .gitignore if missing.
How to fix
-
Replace each hardcoded secret with an
import.meta.env.VITE_*reference. For example:const apiKey = "sk-abc123"→const apiKey = import.meta.env.VITE_API_KEYconst token = "eyJhbG..."→const token = import.meta.env.VITE_AUTH_TOKEN
-
Add the variable to
.env.examplewith a placeholder value (e.g.,VITE_API_KEY=your-api-key-here). Create.env.exampleif it doesn't exist. -
Ensure
.envand.env.localare in.gitignore— add them if missing. -
Remove any
console.log,console.error, or similar calls that print a CDF token, user object, or API key.
Step 4 — Find and fix dangerous DOM APIs
Search for patterns that allow arbitrary script execution or HTML injection:
grep -rn --include="*.tsx" --include="*.ts" \
-E "dangerouslySetInnerHTML|innerHTML\s*=|eval\(|new Function\(|setTimeout\(['\"]|setInterval\(['\"]" src/
For each dangerous DOM pattern, apply the fix directly. Install DOMPurify with pnpm add dompurify and pnpm add -D @types/dompurify if needed.
How to fix
-
dangerouslySetInnerHTML: Wrap the value withDOMPurify.sanitize(). Addimport DOMPurify from 'dompurify'to the file. Example:// Before <div dangerouslySetInnerHTML={{ __html: userContent }} /> // After import DOMPurify from 'dompurify'; <div dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(userContent) }} /> -
eval()/new Function(): Rewrite using a data-driven approach. UseJSON.parse()for data parsing, or a lookup table / switch statement for dynamic logic dispatch. Never pass user-controlled strings to code evaluation. -
setTimeout/setIntervalwith a string argument: Convert to a function reference:// Before setTimeout("doSomething()", 1000) // After setTimeout(() => doSomething(), 1000)
Step 5 — Find and fix authentication & authorization gaps
Read the auth setup (likely src/contexts/, src/hooks/, or setup-flows-auth output):
- Every route that shows CDF data must be behind the Flows auth guard (
useCogniteClientreturns a non-nullsdkbefore rendering). - The CDF client must be initialized with short-lived OIDC tokens, not a static API key.
- User role/capability checks must happen server-side (CDF ACLs) — do not rely solely on hiding UI elements.
Check Atlas / agent:
- Prefer EOS sidebar (
integrate-fusion-agent); in-appuseAtlasChatis exception-only agentExternalIdnot from user input; validate tool/action args before CDF queries- No third-party LLM APIs with CDF data; no uncapped completions over query results (5 / max 50, cached)
How to fix
For each unguarded route that shows CDF data, wrap it with the auth guard component. For example, ensure the route element is wrapped in a component that checks useCogniteClient and renders a loading/login state when the SDK is not ready.
For Atlas tool execute functions and Fusion agent action handlers, add argument validation at the top of each function. Validate that each args field is the expected type and within expected bounds before using it in any CDF query.
Step 6 — Find and fix input validation gaps
Every value that comes from a form, URL param, or query string before it reaches a CDF call or is rendered to the DOM must be validated:
# Find useSearchParams, URLSearchParams, and form onChange handlers
grep -rn --include="*.tsx" --include="*.ts" \
-E "useSearchParams|URLSearchParams|searchParams\.get|e\.target\.value" src/
For each unvalidated external input, add runtime validation. Install Zod if not present (pnpm add zod). Create a schema that matches the expected shape and use .safeParse() instead of type casts.
How to fix
-
Add Zod schemas for URL params and form inputs. Example:
import { z } from 'zod'; const paramSchema = z.object({ id: z.string().min(1), page: z.coerce.number().int().positive().default(1), }); const result = paramSchema.safeParse({ id: searchParams.get('id'), page: searchParams.get('page') }); if (!result.success) { /* handle error */ } -
Replace
as MyTypecasts on external data with Zod.safeParse()— never trust data from URL params, form inputs, or API responses without validation. -
Add nullish fallbacks for
searchParams.get()— always handle the case where the param is missing or empty.
Step 7 — Find and fix Vite / server configuration
Read vite.config.ts and any server.ts / express.ts files.
How to fix
Add any missing security headers to the vite.config.ts server.headers section. If the section doesn't exist, create it. The minimum required headers are:
server: {
headers: {
'Content-Security-Policy': "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; connect-src 'self' https://*.cognitedata.com",
'X-Frame-Options': 'DENY',
'X-Content-Type-Options': 'nosniff',
},
}
Adjust the Content-Security-Policy to match the app's actual needs (e.g., adding specific CDN hosts for fonts or images).
Also:
- Remove any
defineentries invite.config.tsthat embed raw secrets into the bundle. Useimport.meta.envinstead. - Confirm the dev proxy (
server.proxy) does not expose internal endpoints in production builds.
Step 8 — Find and fix dependency vulnerabilities
pnpm audit --audit-level=high
How to fix
- Run
pnpm audit fixfirst to auto-fix what's possible. - For any remaining high/critical CVEs, manually update the package version in
package.jsonand runpnpm install. - If a vulnerable package has no fix available, document it as a known risk and check if there's an alternative package.
Step 9 — Report remaining findings
Report only issues that could not be auto-fixed (e.g., architectural decisions that need human judgment, packages with no available fix, or patterns that require significant refactoring).
Summarize what was fixed in each step:
| Step | What was fixed | Remaining issues |
|---|---|---|
| 2 — CDF SDK | Migrated N raw calls to SDK | (any that couldn't be migrated) |
| 3 — Credentials | Replaced N hardcoded secrets with env vars | (any that need human decision) |
| 4 — DOM | Sanitized N dangerous patterns | (any that need refactoring) |
| 5 — Auth | Wrapped N unguarded routes | (any architectural gaps) |
| 6 — Validation | Added Zod schemas to N inputs | (any that need custom logic) |
| 7 — Vite config | Added N security headers | (any CSP tuning needed) |
| 8 — Dependencies | Fixed N vulnerable packages | (any with no available fix) |
If any remaining issues require immediate action before deployment, list them explicitly.
Done
State what was fixed and confirm the app is more secure. List any remaining items that require human judgment before the next deployment.
FAQ
What does the security skill do?
MUST be used whenever fixing security issues in a Flows app, or before shipping any feature that handles credentials, user input, or external data. This skill finds AND fixes security problems — it does not just report them. Do NOT skip this when the user asks for a security fix, security hardening, or vulnerability remediation — run every step in order. Triggers: security, security fix, security hardening, vulnerability, XSS, injection, credentials, secrets, auth, authentication, authorization, token, sensitive data, input validation, CORS, CSP, dependency audit.
How do I install security?
Run npx skills add https://github.com/cognitedata/builder-skills --skill security in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/security/ (personal) or .claude/skills/security/ (project).
Which AI agents can use security?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is security safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains security?
It is published by cognitedata in cognitedata/builder-skills. It has 1,903 recorded installs.
More from cognitedata/builder-skills
skill-creator
cognitedata/builder-skills
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch for Claude Code or Cursor, update or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
code-quality
cognitedata/builder-skills
MUST be used whenever reviewing a Flows app for code quality, maintainability, or clean code issues — before a PR review, after a feature is complete, or when the user asks for a code review. Do NOT skip linting steps. Triggers: code quality, code review, clean code, refactor, maintainability, technical debt, any type, naming, dead code, duplication, DRY, single responsibility, component size, lint, linting, TypeScript strict, dependency injection, file structure.
test-coverage
cognitedata/builder-skills
MUST be used whenever fixing test coverage for a Flows app to meet the 80% line coverage hard gate. This skill finds AND fixes coverage gaps — it configures tooling, writes missing tests, covers untested paths, and refactors code for testability. It does not just report. Triggers: test coverage, fix tests, write tests, add tests, coverage fix, 80% coverage, coverage gate, missing tests, testability, vitest coverage, jest coverage.
dependencies-audit
cognitedata/builder-skills
MUST be used whenever fixing dependency issues in a Flows app. This skill finds AND fixes vulnerabilities, outdated packages, deprecated dependencies, and license issues — it does not just report them. Triggers: dependencies, packages, fix dependencies, update packages, fix vulnerabilities, npm audit fix, pnpm audit fix, CVE fix, outdated, deprecated, supply chain, license.
design
cognitedata/builder-skills
Simplified Aura guidance for selecting primitives, keeping token usage consistent, and applying reliable layout/copy/state patterns in Flows and Fusion apps.
reveal-3d
cognitedata/builder-skills
Integrates the @cognite/reveal-widget npm package into Flows apps for an interactive Cognite Reveal 3D Scene/CAD/point cloud/360-image viewer. Use when adding 3D viewer, 3D visualization, Reveal, CAD model, Point cloud model, 360 image collection, Scenes, RevealWidget, RevealWidgetController, DM 3D mapping, asset 3D model, model browser, or Cognite 3D content to a Flows application.
Popular security skills
azure-compliance
microsoft/azure-skills
Run Azure compliance and security audits with azqr plus Key Vault expiration checks. Covers best-practice assessment, resource review, policy/compliance validation, and security posture checks. WHEN: compliance scan, security audit, BEFORE running azqr (compliance cli tool), Azure best practices, Key Vault expiration check, expired certificates, expiring secrets, orphaned resources, compliance assessment.
minimal-run-and-audit
lllllllama/rigorpilot-skills
Rigor Run skill for README-first deep learning repo reproduction. Use when the task is specifically to capture or normalize evidence from the selected smoke test or documented inference or evaluation command and write standardized reprooutputs/ files, including patch notes when repository files changed. Do not use for training execution, initial repo intake, generic environment setup, paper lookup, target selection, hidden scientific-meaning changes, or end-to-end orchestration by itself.
seo-audit
coreyhaines31/marketingskills
When the user wants to audit, review, or diagnose SEO issues on their site. Also use when the user mentions "SEO audit," "technical SEO," "why am I not ranking," "SEO issues," "on-page SEO," "meta tags review," "SEO health check," "my traffic dropped," "lost rankings," "not showing up in Google," "site isn't ranking," "Google update hit me," "page speed," "core web vitals," "crawl errors," "indexing issues," "stuck on page 2," "striking distance keywords," "title tag rewrite," "low CTR," "local SEO," "Google Business Profile," or "map pack." Use this even if the user just says something vague like "my SEO is bad" or "help with SEO" — start with an audit. For building pages at scale to target keywords, see programmatic-seo. For adding structured data, see schema. For AI search optimization, see ai-seo.
firebase-security-rules-auditor
firebase/agent-skills
Audits Firebase (Firestore, Cloud Storage) security rules for vulnerabilities, privilege escalation, role bypasses, create vs update inconsistencies, resource exhaustion, type safety, size limits, and hasOnly ownership checks. Use when auditing/reviewing rules, running red-team rule assessments, or scoring against auditor checklists. Don't use for Firebase CLI (login, deploy), Auth, Crashlytics, Remote Config, or database queries.
audit
pbakaus/impeccable
Run technical quality checks across accessibility, performance, theming, responsive design, and anti-patterns. Generates a scored report with P0-P3 severity ratings and actionable plan. Use when the user wants an accessibility check, performance audit, or technical quality review.
competitors
coreyhaines31/marketingskills
When the user wants to create competitor comparison or alternative pages for SEO and buyer-facing use. Also use when the user mentions 'alternative page,' 'vs page,' 'competitor comparison,' 'comparison page,' '[Product] vs [Product],' '[Product] alternative,' 'competitive landing pages,' 'how do we compare to X,' 'competitor teardown,' 'audit our competitor pages,' 'are our comparison pages out of date,' or 'competitive asset audit.' Use this for any content that positions your product against competitors. Covers four formats: singular alternative, plural alternatives, you vs competitor, and competitor vs competitor. For auditing existing claims (not researching competitors from scratch, which is competitor-profiling; not technical SEO on these pages, which is seo-audit), use the asset audit here. For internal battle cards and sales-specific competitor docs, see sales-enablement.