Use Drupal database placeholders instead of concatenating SQL
Reviewed Drupal Knowledge trusted knowledge, reviewed by a human against authoritative sources
A human reviewed this against registered authoritative sources. It states something about Drupal, not about any one project.
Drupal secure-code documentation says data must never be concatenated directly into SQL queries and directs developers to use proper argument substitution, select queries, escapeLike() for LIKE values, and fixed operator choices.
Record drupal.security.database-query-parameterization
What this is
- What is this
- trusted knowledge, reviewed by a human against authoritative sources: Use Drupal database placeholders instead of concatenating SQL
- Why it exists
- A human reviewed authoritative Drupal sources and recorded this as trusted knowledge.
- What makes it authoritative
- A human reviewed this against registered authoritative sources. It states something about Drupal, not about any one project.
- Project scope
- Nothing: this record is about Drupal, not about any one project.
- Recommended next step
- Read the record's own actions and checks.
- Was anything changed
- No. Querying Drupal Knowledge changes nothing.
What is not known
- Nothing was left unstated by this record.
What the record states
| Domains | security, database, api |
|---|---|
| Kind | security-guidance |
| Version applicability | drupal_core: [{'constraint': 'current-documented-secure-code-guidance', 'notes': 'This record reflects current Drupal secure-code guidance for database query construction.', 'status': 'applicable'}] |
Provenance
This record's authority is internal to Drupal Knowledge; no external source snapshot stands behind it.
- authoritative_source · drupal-secure-code · Use the database abstraction layer to avoid SQL injection attacks
https://www.drupal.org/docs/administering-a-drupal-site/security-in-drupal/writing-secure-code-for-drupal
Related records
Only relationships the canonical records already declare. Nothing here is inferred.