Common Security Standards
ASecurityThe code is vulnerable to SQL injection because untrusted `userName` is concatenated into a raw SQL string. It also omits quotes around the value. Use a parameterized query or ORM instead: ```js const result = await db.query( 'SELECT * FROM users WHERE name = $1', [userName] ); ``` For drivers using `?` placeholders: ```js const result = await db.query( 'SELECT * FROM users WHERE name = ?', [userName] ); ``` Also: - Treat `userName` as untrusted at the API/UI boundary; validate expected type,...
- 584 stars
- 0 votes
- 0 copies
- 2 views
- Added September 5, 2026
Works with
Security analysis
100/100Pro scans all 11 files and shows the line behind each finding
npx -y skills add HoangNguyen0403/agent-skills-standard --skill common-security-standards --agent claude-codeAre you the author of Common Security Standards?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangnguyen0403-common-security-standards-5fc7f533)The code is vulnerable to SQL injection because untrusted `userName` is concatenated into a raw SQL string. It also omits quotes around the value.
Use a parameterized query or ORM instead:
```js
const result = await db.query(
'SELECT * FROM users WHERE name = $1',
[userName]
);
```
For drivers using `?` placeholders:
```js
const result = await db.query(
'SELECT * FROM users WHERE name = ?',
[userName]
);
```
Also:
- Treat `userName` as untrusted at the API/UI boundary; validate expected type, length, and format.
- Use least-privilege database credentials.
- Avoid logging the user’s name or other PII.
- Add SQL-injection tests and run SAST/DAST scanners in CI.
- If authentication is involved, store passwords with Argon2id; unrelated session protections should use HttpOnly Secure cookies and rate limiting where appropriate.
Files in this skill
- eval-1.baseline.md
- eval-1.with-skill.md
- eval-2.baseline.md
- eval-2.with-skill.md
- eval-3.baseline.md
- eval-3.with-skill.md
- trigger-1.md
- trigger-2.md
- trigger-3.md
- trigger-4.md
Attribution
Related skills
View all in development →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.