Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
25a1cced
Commit
25a1cced
authored
Nov 19, 2013
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reshuffle security chapter
parent
b720d965
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
29 deletions
+37
-29
security.rst
docs/en/reference/security.rst
+37
-29
No files found.
docs/en/reference/security.rst
View file @
25a1cced
Security
========
Allowing users of your website to communicate with a database can possibly have security implications
that you should be aware of. Databases allow very powerful commands that not every user of your website
should be able to execute. Additionally the data in your database probably contains information that
should not be visible to everyone with access to the website.
Allowing users of your website to communicate with a database can possibly have
security implications that you should be aware of. Databases allow very
powerful commands that not every user of your website should be able to
execute. Additionally the data in your database probably contains information
that should not be visible to everyone with access to the website.
The most dangerous security problem with regard to databases is the possibility of SQL injections.
An SQL injection security hole allows an attacker to execute new or modify existing SQL statements to
access information that he is not allowed to access.
The most dangerous security problem with regard to databases is the possibility
of SQL injections. An SQL injection security hole allows an attacker to
execute new or modify existing SQL statements to access information that he is
not allowed to access.
Neither Doctrine DBAL nor ORM can prevent such attacks if you are careless as a developer. This section
explains to you the problems of SQL injection and how to prevent them.
Neither Doctrine DBAL nor ORM can prevent such attacks if you are careless as a
developer. This section explains to you the problems of SQL injection and how
to prevent them.
SQL Injection: Safe and Unsafe APIs for User Input
--------------------------------------------------
A database library naturally falls touches the class of SQL injection security
vulnerabilities. You should read the following information carefully to
understand how Doctrine can and cannot help you to prevent SQL injection.
In general you should assume that APIs in Doctrine are not safe for user input.
There are hoewver some exceptions.
The following APIs are designed to be **SAFE** from SQL injections:
- ``Doctrine\DBAL\Connection#insert($table, $values, $types)``
- ``Doctrine\DBAL\Connection#update($table, $values, $where, $types)``
- ``Doctrine\DBAL\Connection#delete($table, $where, $types)``
- ``Doctrine\DBAL\Query\QueryBuilder#setFirstResult($offset)``
- ``Doctrine\DBAL\Query\QueryBuilder#setMaxResults($limit)``
- ``Doctrine\DBAL\Platforms\AbstractPlatform#modifyLimitQuery($sql, $limit, $offset)`` for the ``$limit`` and ``$offset`` parameters.
Consider **ALL** other APIs to be not safe for user-input:
- Query methods on the Connection
- The QueryBuilder API
- The Platforms and SchemaManager APIs to generate and execute DML/DDL SQL statements
User input in your queries
--------------------------
...
...
@@ -138,23 +166,3 @@ by passing the driver option "charset" to Doctrine PDO MySQL driver. Using SET N
'charset' => 'UTF8',
));
SQL Injection: Safe and Unsafe APIs for User Input
--------------------------------------------------
In general you should assume that APIs in Doctrine are not safe for user input.
There are hoewver some exceptions.
The following APIs are designed to be **SAFE** from SQL injections:
- ``Doctrine\DBAL\Connection#insert($table, $values, $types)``
- ``Doctrine\DBAL\Connection#update($table, $values, $where, $types)``
- ``Doctrine\DBAL\Connection#delete($table, $where, $types)``
- ``Doctrine\DBAL\Query\QueryBuilder#setFirstResult($offset)``
- ``Doctrine\DBAL\Query\QueryBuilder#setMaxResults($limit)``
- ``Doctrine\DBAL\Platforms\AbstractPlatform#modifyLimitQuery($sql, $limit, $offset)`` for the ``$limit`` and ``$offset`` parameters.
Consider **ALL** other APIs to be not safe for user-input:
- Query methods on the Connection
- The QueryBuilder API
- The Platforms and SchemaManager APIs to generate and execute DML/DDL SQL statements
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment