Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
H
haiyen-payment
  • Overview
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Giang Tran
  • haiyen-payment
  • Repository

Switch branch/tag
  • haiyen-payment
  • package-lock.json
Find file
BlameHistoryPermalink
  • tdgiang's avatar
    Rate-limit POST /admin/login to bound bcrypt-induced event-loop stalls · 4bb319e9
    Async bcryptjs measured to still not yield the event loop for realistic
    hash costs (~70ms compares finish before its 100ms yield threshold), so
    a login flood could still stall the same process's live MegaPay payment
    webhooks. Caps each client (or shared-proxy-bucket, see known limitation
    below) to 5 POST /admin/login attempts per rolling 60s window via
    express-rate-limit; requests over the limit get a 429 with a Vietnamese
    error and never reach adminAuth.login, so the bcrypt compare never runs.
    
    Known limitation: this app has no app.set('trust proxy', ...) configured
    and runs behind a reverse proxy in production, so express-rate-limit's
    default req.ip-based bucketing will key off the proxy's address, not the
    real client IP. In production this enforces "5 attempts/minute in
    aggregate behind the proxy" rather than "5 per real client IP" — an
    accepted trade-off for this low-traffic internal tool, but not the same
    guarantee trust proxy + per-IP limiting would give. Configuring trust
    proxy is an infrastructure change, left out of scope here.
    tdgiang authored Aug 30, 2026
    4bb319e9
package-lock.json 286 KB
EditWeb IDE
×

Replace package-lock.json

Attach a file by drag & drop or click to upload


Cancel
A new branch will be created in your fork and a new merge request will be started.