Članci s tagom #security
-
GDPR-compliant monitoring: what EU founders need to know
US-hosted monitoring tools collect your customers' IPs, your cron outputs, your incident payloads. If you sell to EU customers, you need to think about this. Here's what matters and what to actually do.
-
SSL certificate expiry: 5 ways to monitor (and why most teams pick wrong)
Your Let's Encrypt cert auto-renews until it doesn't. Here are 5 ways to know in advance — and which one actually saves you when renewal fails silently.
-
Proof-of-Work CAPTCHA in PHP: blocking bots without Google reCAPTCHA
PoWChallengeService: SHA-256 leading-zero-bits puzzle, 18-bit difficulty (~1s modern CPU), server-side HMAC integrity + 5-minute TTL, IP-bound 1-hour verified cookie. No reCAPTCHA, no hCaptcha, no Turnstile, no external API call. The cookie format: {ip}|{issued_at}|{hmac}, timing-safe verification.
-
Attack chain reconstruction in PHP: forensic timeline for NIS2 early-warning
AttackChainReconstructor: 5 phases (recon/probe/exploit/exfiltration/benign), EXPLOIT_SCORE_THRESHOLD=75, SENSITIVE_PATH_PATTERN for exfiltration, 4 data sources merged chronologically with ±2s dedup, exfiltration heuristic score (suspect_routes*20 + min(40,bytes/100k)), NIS2 Art. 23(4) 24h early-warning forensic export.
-
Self-tuning WAF rules in PHP: automatic false-positive decay without disabling rules
RuleTuningService: weekly FP-rate analysis via blocked-then-manually-unblocked signal, FP_RATE_THRESHOLD=0.5, MIN_SAMPLE_SIZE=10, DECAY_AMOUNT=10, FLOOR_SCORE=25. Stale rules (0 hits in REVIEW_DAYS=30) flagged for admin review — never auto-disabled. Atomic applyTuning() in DB transaction with security_borna_rules_history audit trail. revertRule() restores original_score.
-
Behavioral baseline security in PHP: detecting anomalies without rule signatures
BehaviorBaselineComparator: per-(IP, tenant) hourly baseline over 168 hours, Cohen's d on 5 dimensions (request_count, endpoint_entropy, status_2xx/4xx/5xx rate), directional gating (request_count only flags upward spikes), confidence from sample count, minimum 14 samples. Same Cohen's d engine as KIKA and LUKA.
-
Building a WAF in PHP: per-tenant attack attribution that Cloudflare doesn't do
BORNAsecurity: a PHP WAF that knows which tenant is being attacked. FCrDNS-verified crawler bypass, 5σ behavioral anomaly detection, attack chain reconstruction across tenants, self-tuning rules via operator feedback, and a PoW CAPTCHA that requires no Google. No Cloudflare subscription needed.
-
Sensitive data masking in PHP logs: OIB, IBAN, credit card, email auto-redacted
Shinobi Apps framework Logger: maskSensitiveData() applied once to context before any handler receives it. Two-pass: (1) key-based — SENSITIVE_KEYS list (password/token/secret/api_key/credit_card/ssn/pin/cvv/authorization) → '***MASKED***'. (2) value-based — regex patterns: credit card (13-19 digit groups → ****-****-****-last4), JWT (eyJ.*.* → prefix***JWT_MASKED***), Bearer token (Bearer .{20,} → prefix***MASKED***), hex hash (32+ hex chars → first8***MASKED***). Control-char sanitization on log message string.
-
PHP input validation with 18+ built-in rules: OIB, phone, decimal and more
Shinobi Apps framework Validator: pipe-separated rule string 'required|oib|max:11' or array form. OIB: 11-digit regex + Luhn-variant checksum (mod 10+11 ISO 7064 MOD 11-2). PATTERNS const for alpha_spaces/alpha_num/phone/decimal/currency/time_24h/oib/plain_text/comment. Conditional-required gates: required_if, required_unless, required_with, required_without. Unknown rule → throw InvalidArgumentException (fail-loud). Dot-notation for nested arrays. Stop on first failure per field.
-
PHP query builder: building type-safe SQL without an ORM
Shinobi Apps framework QueryBuilder: fluent interface over PDO, all params bound automatically (zero interpolation). ALLOWED_OPERATORS allowlist for where/orWhere/having. validateQualifiedColumnName regex for orderBy/groupBy (prevents backtick injection). whereIn empty array → 1=0 sentinel (never returns all rows). select() trusted-caller design (no user input). aggregate helpers (sum/avg/max/min) validate column before SQL fragment.
-
2FA and magic links in PHP: TOTP and passwordless login without packages
Pure-PHP RFC 6238 TOTP: HMAC-SHA1 with dynamic truncation, base32 encode/decode, ±30-second drift window. Magic link login: 32-byte random token, 15-minute TTL, hash stored, raw in URL. Neither requires a Composer package.
-
PHP session security: database-backed sessions, salted fingerprinting, and deferred writes
Database-backed sessions only (file driver removed). Salted SHA-256 fingerprint that an attacker can't reproduce without server-side salt. Deferred write: session lock released immediately after start(), in-memory delta flushed at end of request. flock-based regeneration lock for parallel requests.
-
Rate limiting in PHP: two-lane defense against DDoS and brute force
One rate limiter, two lanes per protected route. Lane 1 counts every POST per IP (anti-DDoS, high threshold). Lane 2 counts only failed auth attempts per email (anti-brute-force, 5 tries). Sliding window with weighted previous window. BORNA enrichment via events.
-
Content Security Policy in PHP: the nonce approach that actually works
A strict CSP with per-request nonces, no 'unsafe-inline', and no X-XSS-Protection (which causes more bugs than it prevents). How we handle dynamic styling in a CSP-compliant way: CSS custom properties via setProperty() instead of inline style attributes.
-
CSRF protection in PHP without a framework: rotating tokens, grace periods, and the @csrf directive
How the Shinobi Apps framework implements CSRF protection: bin2hex(random_bytes(32)) tokens stored in session, 30-minute rotation with a 10-minute grace period for tabs left open, hash_equals() for timing-safe comparison, and an @csrf directive that outputs window.CSRF_TOKEN instead of a meta tag.