# Areas of Concern Prioritized: **HIGH** = security/data risk, **MEDIUM** = significant tech debt, **LOW** = polish/quality. --- ## Security — HIGH ### Hardcoded credentials in [config.php](config.php) DB password, email password, and remote DB host stored in plaintext. If the repo leaks (or is on a shared dev machine), full DB compromise is immediate. **Fix:** move to `.env` + `getenv()`; add `config.php` to `.gitignore`; rotate the leaked secret. ### Unsafe `unserialize()` PHP object-injection surface: - [autoload/class.Cache.php](autoload/class.Cache.php) line 29 — `@unserialize($data)` (cache files in `temp/`) - [libraries/grid/grid.php](libraries/grid/grid.php) lines 95, 122 - [libraries/medoo/medoo.php](libraries/medoo/medoo.php) line 1264 **Fix:** switch to `json_encode/decode`, or pass the `['allowed_classes' => false]` option. ### Insecure persistent-login cookie [index.php](index.php) lines 92-102 sets a cookie containing JSON `{email, hash}` with no `HttpOnly`, no `Secure`, no `SameSite` (also see `setcookie()` calls in [autoload/controls/class.Users.php](autoload/controls/class.Users.php) lines 43, 561). **Fix:** issue an opaque random token, store hash server-side, set `HttpOnly; Secure; SameSite=Strict`. ### `eval()` in vendored grid [libraries/grid/templates/results.php](libraries/grid/templates/results.php) line 289 and [libraries/grid/templates/print.php](libraries/grid/templates/print.php) line 73 evaluate strings drawn from `$_SESSION`. Session takeover ⇒ RCE. **Fix:** replace with a safe expression evaluator or simple template helpers. ### Debug scripts shipped with credentials `tmp/debug_*.php` (7 files) embed live DB creds. If `tmp/` is web-accessible, they're a one-shot console. **Fix:** delete from repo; add `tmp/` to `.gitignore`; verify `tmp/` is not served (check [.htaccess](.htaccess)). --- ## Security — MEDIUM ### No CSRF protection POST endpoints (controllers, [ajax.php](ajax.php), [api.php](api.php)) accept requests with no token validation. **Fix:** generate per-session token, embed in forms, verify in mutating actions. ### Path traversal in `\Tpl::render()` [autoload/class.Tpl.php](autoload/class.Tpl.php) lines 31-62 builds `include` paths from `$file` without whitelisting. If `$file` ever flows from request data, `../../config` is reachable. Currently template names are hardcoded in controllers, so risk is latent — keep it that way. ### Inconsistent XSS escaping in templates [templates/products/main_view.php](templates/products/main_view.php) defines a local `escape_html()` but applies it inconsistently. Polish content with apostrophes / quoted JSON in `