class
Analyzer::Php::Php
- Analyzer::Php::Php
- Analyzer::Php::PhpEngine
- Analyzer
- Reference
- Object
Defined in:
analyzer/analyzers/php/php.crConstant Summary
-
ALLOW_PATTERNS_RE =
Regex.union(["$_GET", "$_POST", "$_REQUEST", "$_SERVER", "$_COOKIE", "$_FILES", "filter_input"]) -
Precompiled once at load. The per-line gate below used to be
allow_patterns.any? { |pattern| line.includes? pattern }— 7String#includes?scans of the line per pattern. Crystal'sString#includes?is measurably slower than a single precompiledRegex#matches?call, and this runs on every line of every.phpfile in the project, so the union regex is a straight win. -
WEBROOT_DIR_NAMES =
["public", "webroot", "public_html", "htdocs", "www", "web"] -
Directory names that conventionally hold the document root. A directory only counts as one when it also contains an
index.phpfront controller — that requirement is what keeps this safe: a static-site build output likedocs/public/shipsindex.html, neverindex.php, so it is not mistaken for a web root. (See the warning inAnalyzer#web_root_pathabout barepublic//www/markers.)