database-security
Skill22 starsChanged 5 months agoMITView on GitHub
Prevent SQL and NoSQL injection, unsafe ORM and raw-query use, over-privileged database identities, weak tenant isolation, and unauthenticated database transport. Use when generating SQL or raw query strings, NoSQL filters, ORM models or queries, database migration files, or connection strings.
5 other projects use a version of this.
Adopted by
Most recently taken up by
- zhaoxuya520/reverse-skilltheir own version, first seen Sep 22, 2026
- Asaiuta/reverse-workbench-skilltheir own version, first seen Aug 14, 2026
- xAmirHamza77/ReverseOps-Skilltheir own version, first seen Aug 2, 2026
- Rootx202/appsec-skillstheir own version, first seen Jul 13, 2026
- JeremyMorgan/code-review-skillstheir own version, first seen Jun 3, 2026
Used with
Projects with it also use browser-extension-reverse, cloud-k8s and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
xAmirHamza77Skillbrowser-extension-reverse
Use for authorized reverse engineering of browser extensions (Chrome/Firefox) including manifest analysis, background workers, and extension-based credential or traffic logic recovery.
Also in 3 projects that use this
xAmirHamza77Skillcloud-k8s
Use for authorized cloud, container, and Kubernetes security assessment including metadata SSRF, IAM misconfig, container escape paths, and cluster RBAC review.
Also in 3 projects that use this
- +10 more from xAmirHamza77
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- zhaoxuya520/reverse-skill★ 40ksame name
- JeremyMorgan/code-review-skills★ 15same name
- Asaiuta/reverse-workbench-skill★ 4same name
- xAmirHamza77/ReverseOps-Skill★ 4same name
- Rootx202/appsec-skills★ 3same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository36 other files it gives its agents.
- AGENTS.mdAGENTS.md
- dist/AGENTS.mdAGENTS.md
- dist/CLAUDE.mdCLAUDE.md
- dist/copilot-instructions.mdCopilot instructions
- docs/llms-full.txtllms.txt
- docs/llms.txtllms.txt
- api-securitySkill
- auth-securitySkill
- cicd-securitySkill
- container-securitySkill
- cors-securitySkill
- crypto-misuseSkill
- deserialization-securitySkill
- dynamic-verificationSkill
- electron-securitySkill
- error-handling-securitySkill
- file-upload-securitySkill
- frontend-securitySkill
- graphql-securitySkill
- iac-securitySkill
- iam-best-practicesSkill
- llm-app-securitySkill
- logging-securitySkill
- ml-securitySkill
- mobile-securitySkill
- protocol-securitySkill
- saas-securitySkill
- secret-detectionSkill
- secure-code-reviewSkill
- security-regression-testsSkill
- serverless-securitySkill
- ssrf-preventionSkill
- supply-chain-securitySkill
- template-injectionSkill
- threat-modelingSkill
- websocket-securitySkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 42
Prefer the ORM's structured query-expression API over textual SQL.
- Distinctive: line 50
Treat a NoSQL query as a structure, not a string.
- Very specific: line 82
Use an ORM raw-query method (.raw(), .objects.raw(), $queryRawUnsafe, session.execute(text(...))) with an interpolated f-string or template …
- Very specific: line 88
Run application workloads as the database superuser: root, postgres, sa.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Database Security
Rules (for AI agents)
ALWAYS
- Bind every untrusted data value through the driver or ORM parameter API. Never place
it into SQL with language-level interpolation or concatenation —
+, f-strings,%formatting,.format(), JavaScript template interpolation. Driver placeholders (%s,?,$1,:name,@name) are the binding mechanism, not string formatting; confusing the two is how this rule is most often misread. The same applies to values read back out of the database and used to build a later query: stored input is still input, and second-order injection is this bug with a delay. - Prefer the ORM's structured query-expression API over textual SQL. Where raw SQL is
genuinely needed, use that framework's documented parameter-binding mechanism and
never interpolate untrusted values into it.
references/orm-safe-query-examples.mdcarries the verified form per framework. - For SQL structure that cannot be a bind parameter — table and column identifiers, sort direction, sometimes the operator itself — map the external value to a fixed operator-controlled allowlist. Never copy an untrusted identifier or SQL fragment into the statement, escaped or not.
- Treat a NoSQL query as a structure, not a string. Build filters with the driver's
typed query objects, and coerce every request-supplied value to its expected scalar
type before it reaches a filter. A JSON body substituting
{"$ne": null}where a string was expected turns an equality check into a match-all — operator injection needs no quote to break out of. - Give each application its own database identity with the minimum grants it needs, and separate runtime privileges from migration privileges. The runtime identity must not receive schema-owner or DDL rights merely because migrations require them.
- For shared-table multi-tenancy, enforce tenant isolation at a deliberate security
boundary. Where database RLS is used: confirm the application role cannot bypass it
— a superuser, a
BYPASSRLSrole, and the table owner itself all bypass policies unless the table is set toFORCE ROW LEVEL SECURITY— test write policies as well as read, and bind the tenant context transaction-locally. A session-scoped tenant context that survives a connection's return to the pool serves tenant A's rows to tenant B. - Authenticate the database server, do not merely encrypt to it. Encryption without
certificate verification (
sslmode=require, MySQLsslMode=REQUIRED,TrustServerCertificate=True) stops passive capture but not a redirected connection. Where the client is what establishes trust, use a verifying mode — PostgreSQLverify-full, MySQL Connector/JVERIFY_IDENTITY, Microsoft.Data.SqlClient withTrustServerCertificate=False— against the deployment's trusted CA configuration. - Obtain database credentials from an operator-controlled secret-management mechanism;
prefer workload identity or short-lived dynamic credentials where the platform
supports them. A runtime-injected environment variable is an acceptable fallback,
not the target — it is readable through process inspection, crash dumps, and many
orchestrator APIs. Any static credential must support rotation and revocation. See
secret-detectionfor what counts as a committed credential.
NEVER
- Manually quote or escape an untrusted SQL value as a substitute for the framework's documented parameterization mechanism.
- Use an ORM raw-query method (
.raw(),.objects.raw(),$queryRawUnsafe,session.execute(text(...))) with an interpolated f-string or template literal. Raw SQL is not the problem; interpolation into it is. - Evaluate server-side JavaScript over untrusted input (
$where,mapReduce,$accumulator). There is no safe form of it — it is code execution inside the database. - Run application workloads as the database superuser:
root,postgres,sa. - Grant destructive DDL capability to the normal application runtime identity.
- Send database traffic across an untrusted network without authenticated encryption, or disable certificate verification to work around a certificate error.
- Expose a database listener broadly to the public internet. Restrict reachability to explicitly authorized application and administrative sources, and prefer private connectivity for application traffic where the platform supports it.
- Emit database credentials, connection strings containing secrets, or sensitive bound
values to logs.
logging-securityowns the shape this should take — statement template, parameter names, a hashed value identifier — and the redactor that enforces it.
KNOWN FALSE POSITIVES
- Encryption without client-side certificate verification is not a finding where the
channel is already authenticated by other means: a Unix domain socket (where
sslmodedoes not apply at all), a cloud SQL proxy or sidecar terminating an authenticated tunnel, or a service mesh enforcing mTLS. The finding is an unauthenticated connection across a network, not the literal stringsslmode=require. - Some ORMs and DB-API drivers (Django, SQLAlchemy 1.x, psycopg2) use
%sas a parameter marker, not a Python format placeholder.cursor.execute(sql, [value])with an unquoted%sis the safe form, not a violation. - Trusted analyst-authored ad-hoc SQL in a dedicated analytics environment may intentionally contain dynamic SQL structure. Keep that capability behind explicit authorization and appropriately scoped data access. A read-only account limits modification but does not make untrusted query fragments safe, and does not prevent unauthorized reads.
- Static SQL with no untrusted dynamic values —
SELECT 1, fixed schema introspection, constant migration statements — does not need artificial bind parameters to satisfy this skill.
Context (for humans)
Injection has remained a recurring OWASP Top 10 risk across editions. SQL injection stays a high-impact member of that category even as the category's relative ranking moves between releases, and it has not gone away because the failure mode is easy by default: any language with string concatenation lets you produce a query. AI assistants readily generate "works in dev" code that interpolates user input — particularly for sort columns, dynamic filters, and pagination, which are exactly the places a bind parameter cannot be used and an allowlist has to be.
The NoSQL variant is worth naming separately because it does not look like injection. Nothing is quoted, nothing is escaped, and there is no string to break out of — the attacker replaces a scalar with an operator object and the query's shape changes. Reviewers who have learned to spot concatenated SQL will read straight past it.
References
references/verifying-findings.md— confirm or refute a finding, then lock itreferences/orm-safe-query-examples.md— the verified safe call per framework, placeholder styles, and the allowlist pattern for identifiersrules/sql_injection_sinks.jsonrules/orm_safe_patterns.json- OWASP SQL Injection Prevention Cheat Sheet.
- OWASP NoSQL Security Cheat Sheet.
- CWE-89 — SQL Injection.
- CWE-943 — Data query logic injection.
- PostgreSQL Row-Level Security.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

