backend
Technical notes on web development, DevOps, and AI integration.
157 articles
- 04:24backend
Stealth Proxies Cannot Buy a Captcha That Measures the Browser
Stealth proxies beat WAF walls and die at browser-measuring captcha gates.
TL;DR: Stealth proxies hit captcha walls, not WAFs: Jakarta Selatan hid Cloudflare Turnstile, Jakarta Pusat ran reCAPTCHA v2. Real browsers cleared both—Chromium passed Turnstile untouched; a Firefox anti-detect profile solved reCAPTCHA with Tab plus Space, no solver service. Detail pages need live sessions, so the build now tiers access: proxies for WAFs, browsers for captchas, supervised runs for Jakarta Pusat.
#scraping#captcha#browser-automation - 03:35backend
Three Gates of Public Registries Before Writing a Scraper
Probing nine public-registry hosts: two open, one captcha, two WAF. Learn the three access-gate patterns before writing a single line of scraper.
TL;DR: Read-only probes of Jakarta court SIPP portals found mixed access: two open, one captcha-gated, two WAF-blocked, others thin or refusing. SIPP is built per court, so variation is expected; each host gets one polite probe saved as a local fixture. No captcha solving or header tricks; three hosts form the pilot, classified locally since menu tokens don't filter.
#scraping#open-data#sipp - 03:26backend
A Daily Signal Ingest Pilot from Public Registries
Two registries passed probing: scrapers behind one seam, idempotency forced via content hash, and a daily 05:00 ingest with jitter.
TL;DR: A pilot ingests daily signals from the LKPP procurement blacklist and three courts' SIPP bankruptcy/PKPU case lists through a single SignalSource interface. Idempotency comes from content hashes and unique constraints, so re-runs never duplicate data, and one court failing doesn't kill the run. The job runs once daily via APScheduler under strict politeness rules, with privacy safeguards built in.
#scraping#open-data#automation - 02:49backend
A Census of 348 SIPP Endpoints Before the Scraper
Building scrapers from endpoint guesses fails fast: a census of 348 SIPP endpoints and 12 official sources sets the foundation before the first crawler runs.
TL;DR: A census of 350 Indonesian district courts found 348 active SIPP endpoints, confirming no central API exists. Twelve other official sources were tiered by verification, with the LKPP blacklist pilot first, then a phased per-court SIPP crawl. The real value comes from reading all sources as one curve covering pre-distress, distress, and post-collapse signals.
#scraping#open-data#sipp - 23:55security
A Rate Limit Alone Was Not Enough for This Login Endpoint
Sliding window dual keying plus dummy-hash timing equalization: two separate defenses for one login endpoint.
TL;DR: A live smoke test confirmed the login rate limiter kicks in with HTTP 429 and a Retry-After header on the eleventh attempt per minute. The real fix pairs that throttling with timing equalization, running bcrypt against a dummy hash so response speed never reveals whether an account exists. Docs endpoints are now dev-only, and duplicate registrations return 409.
#security#fastapi#python - 23:25backend
Red Pipeline, Green Laptop: Migrations Before pytest
CI called pytest on an empty database while production applied migrations first; one workflow line aligned both contracts.
TL;DR: A test suite that passed locally kept failing in CI with misleading database errors. The root cause was that production ran Alembic migrations before boot, while CI pointed pytest straight at an empty Postgres. Adding alembic upgrade head before tests in the workflow made starting state deterministic, so failures now point at actual code.
#ci#alembic#pytest - 23:15backend
One ruff Commit Broke Three Layers at Once
A harmless-looking ruff sweep touched runtime aliases, TYPE_CHECKING boundaries, isort classification, and the Docker build layout all at once.
TL;DR: A harmless-looking lint commit shipped runtime import moves, type-checking guards, and a new pyproject.toml in one package. Only the last piece broke CI, because setuptools' flat-layout discovery choked on the leftover build directory the Docker install created. The fix: exclude build artifacts in ruff config and clean them within the same RUN instruction.
#python#ruff#isort - 22:43backend
When EmailStr Rejects .test Fixtures Under Pydantic
email-validator rejects reserved test domains at the syntax layer; here is how to pick fixture domains that pass Pydantic validation.
TL;DR: CI failures on register and login endpoints came from Pydantic's EmailStr rejecting reserved domains like .test and .local at the syntax layer, before any DNS lookup. The simplest fix is swapping fixtures to example.com, example.net, or example.org, which pass validation. Alternatively, pass test_environment=True to email-validator, though Pydantic needs a custom wrapper for that.
#python#pydantic#email-validator - 17:43backend
A FastAPI Skeleton of Layer Contracts, Not Empty Folders
Four folders with empty __init__.py files carry real contracts: layer boundaries, a unit of work per request, JWT tenant claims, and the 72-byte bcrypt gate.
TL;DR: Four seemingly empty folders establish layered contracts in a FastAPI skeleton, keeping business logic, technical details, and HTTP translation cleanly separated. A yield-based dependency handles transactions per request, committing only on success so multi-table use cases stay atomic. Multi-tenancy rides in JWT claims, bcrypt limits get enforced at the validation gate, and swappable signal sources await future needs.
#fastapi#python#jwt