In today's digital threat landscape, web application security cannot be an afterthought or an optional checklist item added right before launch. Automated botnets, credential stuffers, and vulnerability scrapers constantly probe every publicly accessible URL on the internet.
At INDOSYS, every client software solution and proprietary platform — from financial quotation tools to multi-tenant housing society ERPs — is hardened against the OWASP Top 10 vulnerabilities. In this technical whitepaper, we present our core production defense-in-depth checklist.
1. Robust Anti-CSRF Token Lifecycle
Cross-Site Request Forgery (CSRF) allows malicious external websites to submit state-changing actions (such as initiating password changes or authorizing financial payments) on behalf of an authenticated user.
To defeat CSRF, our architecture implements synchronized cryptographically secure token validation:
- Cryptographic Generation: Tokens are generated using
random_bytes(32)and tied to the active server session:$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
- Embedded in Forms or Request Headers: Transmitted via a hidden input field (
<input type="hidden" name="csrf_token" value="...">) or an HTTP header (X-CSRF-Token) for AJAX/Fetch requests. - Constant-Time Verification: Validated on POST/PUT requests using
hash_equals()to protect against timing attacks:if (!hash_equals($_SESSION['csrf_token'] ?? '', $_POST['csrf_token'] ?? '')) { http_response_code(403); exit('CSRF validation failed.'); }
2. Parameterized Database Queries (Eliminating SQL Injection)
Concatenating user input directly into SQL strings remains one of the most devastating security flaws in web engineering. We enforce strict usage of PDO with Prepared Statements:
Correct Parameterized Pattern
$stmt = $pdo->prepare('SELECT id, password_hash FROM users WHERE email = :email AND status = :status LIMIT 1');
$stmt->execute([
':email' => $sanitizedEmail,
':status' => 'active',
]);
$user = $stmt->fetch(PDO::FETCH_ASSOC);
Prepared statements ensure that the SQL database treats user input strictly as raw data parameters, completely neutralizing SQL injection payload escapes.
3. Enterprise HTTP Security Headers
Hardening web server configurations at the Apache or LiteSpeed layer provides an immediate defense barrier before application code is executed:
| Security Header | Recommended Value | Defensive Purpose |
|---|---|---|
| Strict-Transport-Security (HSTS) | max-age=31536000; includeSubDomains |
Forces browsers to only communicate over HTTPS, preventing SSL stripping. |
| X-Frame-Options | SAMEORIGIN |
Prevents clickjacking by blocking malicious framing of your pages. |
| X-Content-Type-Options | nosniff |
Stops MIME-type confusion attacks and executable script injection. |
| Referrer-Policy | strict-origin-when-cross-origin |
Protects internal URL query parameters from leaking to external referrers. |
| Permissions-Policy | camera=(), microphone=(), geolocation=(self) |
Restricts invasive browser hardware access to unauthorized scripts. |
4. Application-Layer Rate Limiting & Brute-Force Defense
Login portals and public submission endpoints (such as contact forms or OTP verification) must be shielded from automated brute-force attacks. We implement a lightweight rate-limiting model using Redis or atomic file caches:
- Track requests keyed by
hash('sha256', $clientIp . $endpoint). - Enforce maximum thresholds (e.g. max 5 login attempts per 15 minutes, or max 3 form submissions per hour).
- Return
HTTP 429 Too Many Requestswith aRetry-Afterresponse header when the threshold is exceeded.
5. Strict Cookie Flags (Session Hardening)
Session hijacking is prevented by setting strict security flags on all authentication cookies:
session_set_cookie_params([
'lifetime' => 0, // Expires on browser close
'path' => '/',
'domain' => 'indosys.in',
'secure' => true, // HTTPS only
'httponly' => true, // Inaccessible to JavaScript (XSS defense)
'samesite' => 'Lax' // Cross-site request mitigation
]);