Skip to content
Back to skills

Security Anti Patterns

ASecurity

`eval()` or `Function()` on user-controlled data becomes code execution. Safe alternatives: parse structured input explicitly, use allowlisted values, or dispatch through a lookup table. Never pass untrusted strings through a shell. Use direct API calls instead. When spawning subprocesses is genuinely needed, pass arguments as an array, not as a shell command string. User-supplied paths must be validated against an allowlist or canonicalized before use. ```js // DANGEROUS — user input can reac

  • 14 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 19, 2026
toolsrustshellapisecurity

Works with

  • api

Security analysis

A100/100

Scanned September 19, 2026

npx -y skills add itsnin/spotlight --skill security-anti-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Security Anti Patterns?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Security Anti Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/itsnin-security-anti-patterns/badge)](https://www.skillsdirectory.com/skills/itsnin-security-anti-patterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Security Anti-Patterns
## Never Evaluate Untrusted Input as Code
`eval()` or `Function()` on user-controlled data becomes code execution. Safe alternatives: parse structured input explicitly, use allowlisted values, or dispatch through a lookup table.
## Command Injection via Shell
Never pass untrusted strings through a shell. Use direct API calls instead. When spawning subprocesses is genuinely needed, pass arguments as an array, not as a shell command string.
## Path Traversal
User-supplied paths must be validated against an allowlist or canonicalized before use.
```js
// DANGEROUS — user input can reach outside the intended directory
const target = '/usr/share/' + userInput;
// SAFER — canonicalize and verify prefix
const target = Gio.File.new_for_path('/usr/share/' + userInput).resolve_relative_path('.').get_path();
```
## Sensitive Data
- Never log passwords, API keys, tokens, or personal data.
- Never store credentials in extension settings or state files.
- Use the system keyring when persistent credential storage is genuinely required.
## Dangerous Patterns to Avoid
| Anti-Pattern | Safe Alternative |
|-------------|-----------------|
| `eval()` on untrusted input | Explicit parsing, allowlist dispatch |
| Shelling out with concatenated strings | Direct library API, argument arrays |
| InnerHTML with user content | `textContent` or DOM creation APIs |
| Loading remote code over HTTP | HTTPS only, with content verification |
| Storing secrets in GSettings | System keyring, or do not store |
## Extension Boundaries
- Do not expose extension internals through global objects that other extensions can tamper with.
- Validate the type and structure of any object received from another extension or external service before using it.
- Prefer `connectObject` with a scoped owner over plain `connect` on global objects when the handler lifetime is tied to a specific widget.
## GSettings Safety
- Schema paths must be hardcoded, not constructed from user input.
- Never write settings values that were not explicitly validated or allowlisted.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.