.. _security-configureextract: .. _configure-extract: Configure Extract +++++++++++++++++ The `extract() `_ function overwrites local variables when left unconfigured. Extract imports variables from an array into the local scope. In case of a conflict, that is when a local variable already exists, it overwrites the previous variable. In fact, `extract() `_ may be configured to handle the situation differently : it may skip the conflicting variable, prefix it, prefix it only if it exists, only import overwriting variables... It may also import them as references to the original values. This analysis reports `extract() `_ when it is not configured explicitly. If overwriting is the intended objective, it is not reported. Always avoid using `extract() `_ on untrusted sources, such as ``$_GET``, ``$_POST``, ``$_FILES``, or even databases records. .. code-block:: php See also `extract `_. Connex PHP features ------------------- + `extract `_ + `variable `_ Suggestions ___________ * Always use the second argument of extract(), and avoid using ``EXTR_OVERWRITE`` Specs _____ +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Short name | Security/ConfigureExtract | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Changed Behavior `, :ref:`Security ` | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 1.2.9 | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | PHP Version | All | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Severity | Minor | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | Instant (5 mins) | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Precision | Very high | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Examples | :ref:`case-zurmo-security-configureextract`, :ref:`case-dolibarr-security-configureextract` | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Exakat Cloud `_ | +--------------+-------------------------------------------------------------------------------------------------------------------------+