Wygenerowano przez równoległą analizę czterech agentów: stack, architektura, konwencje, integracje, testy, baza danych oraz wykryte problemy i dług techniczny. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
5.0 KiB
5.0 KiB
Concerns & Technical Debt — rank24.pl
Security — CRITICAL
Hardcoded Credentials (must fix before any public exposure)
| Secret | Location | Risk |
|---|---|---|
| MySQL password | config.php lines 2-5 |
Full DB access if repo leaked |
| FTP password | .vscode/ftp-kr.json, .vscode/sftp.json |
Full server access |
| DataForSEO API key | autoload/class.Cron.php ~lines 160, 262, 354 |
API abuse / billing fraud |
| SMTP password | autoload/class.S.php ~lines 293-300 |
Email spoofing |
Remediation: move all secrets to environment variables or a .env file excluded from VCS.
SQL Injection
autoload/class.Cron.php~line 200: raw string concatenation in DELETE queryautoload/class.GoogleRank.phplines 74, 96, 100, 136, 158, 162: raw string concat in UPDATE queriesautoload/class.DataBase.phplines 15, 47, 82: mixed OPD with string building
Remediation: use Medoo's parameterized methods or PDO bindValue() for all dynamic values.
Other Security Issues (MEDIUM)
- Weak password hashing:
md5($pass1)inautoload/class.DataBase.phpline 31 — usepassword_hash() - No CSRF protection: state-changing AJAX operations in
ajax.phplack CSRF tokens - Path traversal:
autoload/class.DataBase.php~line 57 — user-suppliedimage_folderconcatenated into file path without validation - Client-supplied MIME type: file type validation in
class.DataBase.phpchecks$file['type'](attacker-controlled) - Insecure deserialization:
@unserialize()used inautoload/class.FileCache.phpline 43 andautoload/opd.statement.php - XSS:
\S::get()reads raw$_POST/$_GETwithout sanitization; values reach HTML output in multiple templates
Technical Debt
God Classes
autoload/class.S.php— 700+ lines; handles sessions, email, DNS, CSV, URL, string utils, DB helpers. Should be split.autoload/class.GoogleRank.php— 300+ lines; proxy selection logic repeated 4+ times with no extraction.autoload/class.Cron.php— 400+ lines; hardcoded credentials, multiple large functions.
Code Duplication
- Proxy selection + backoff UPDATE query repeated verbatim ~4 times in
class.GoogleRank.php - Google block-detection strings (
"Our systems have detected unusual traffic") duplicated in multiple methods
Global State Anti-Pattern
Every class does global $db, $mdb, $user, $config, $cache; — no DI, no service container. Makes refactoring and testing very difficult.
Two ORM Layers
Both $db (OPD) and $mdb (Medoo) are initialized and used. Older code paths use OPD raw queries; newer paths use Medoo. Inconsistent access patterns throughout.
Deprecated PHP Patterns
- Old-style constructor:
function DataEdit()inautoload/class.DataEdit.phpline 32 (should be__construct()) globalvariable injection instead of constructor parameters- Short open tags
<?in templates — requiresshort_open_tag = Onin php.ini
Missing Abstractions
- No HTTP client wrapper — cURL used directly in
class.GoogleScraper.php, no retry/logging - No proxy manager class — proxy logic spread across
GoogleRank,GoogleSite,class.S - No logger — debugging done via
file_put_contents('google-rank.txt', ...)and commented-out\S::pre() - No centralized input validation layer — all
\S::get()calls are point-of-use
Reliability Concerns
Cron Jobs
- No retry logic — single failure = job skipped until next run
- No max execution time enforcement — long foreach loops can time out silently
cron.phpoutputs JSON directly — no structured logging for cron daemon- API responses partially unchecked:
class.Cron.php~line 162 returns'ok'without verifying data integrity
Scraping / Proxy
- Proxy rotation is deterministic (
ORDER BY used ASC LIMIT 1) — predictable, easier for Google to detect - No rate limiting or delays between requests in batch operations
- No exponential backoff — same fixed 10s timeout regardless of failure history (
CURLOPT_TIMEOUT = 10) - Block detection only covers known string patterns — new CAPTCHA formats would be missed
file_put_contents('google-rank.txt', $result)inclass.GoogleRank.phpline ~185 — debug log left in production
Error Handling
- Global
error_reportingsuppresses notices, warnings, deprecations — real errors can be masked - cURL operations in
class.GoogleScraper.phphave no try/catch — silent failures return-1 - File operations in
class.DataBase.phpuse@suppression — orphaned temp files possible - No circuit breaker — scraping continues even after repeated proxy failures
Minor Issues
- Debug variable
$debbbbleft inautoload/class.S.phpline ~357 - Commented-out dead code in
autoload/class.Cron.phplines 56-61 - Duplicate key in array:
autoload/class.Cron.phplines ~364, ~376 —'se_id'set twice with different values - Session-based state won't scale to multi-server deployment (no session locking)
- All proxy requests use
http://(line ~120class.GoogleRank.php) — credentials sniffable on network