İNCELE · KARAR VER · DÜZELT
Güvenli kod laboratuvarı
Riskli kodu okuyun ve savunmayı seçin. Senaryolar dış sistemlere bağlanmaz; örnek kodlar çalıştırılmaz.
SENARYO 01
SQL Injection: separate data from query
A profile page appends the user ID from the URL to the SQL text. Which change preserves the query structure?
İNCELENECEK KODRiskli örnek
// Hatalı örnek — çalıştırılmaz
$sql = 'SELECT * FROM users WHERE id = ' . $_GET['id'];SENARYO 02
XSS: encode output according to its context
A comment is being printed directly into the HTML text node. Which approach is suitable for safe display?
İNCELENECEK KODRiskli örnek
// Hatalı örnek — çalıştırılmaz
echo '<p>' . $comment . '</p>';SENARYO 03
IDOR: verify authority on each object
A logged in user fetches a record with document number. How do you prevent access to another user's document?
İNCELENECEK KODRiskli örnek
// Hatalı örnek — çalıştırılmaz
SELECT * FROM documents WHERE id = ?