Passport.js 0.7.0

Last reviewed Sep 19, 2026

Export as PDF

Prompt Details

Prompt Composition

3prompts
  1. JavaScript ES2026102 lines · 3.1K tokens
  2. Node.js 24101 lines · 5.3K tokens
  3. Passport.js 0.7.063 lines · 2.7K tokens
Total266 lines · 11.2K tokens

CWE Coverage

  • 20
  • 22
  • 59
  • 78
  • 79
  • 88
  • 89
  • 95
  • 113
  • 117
  • 208
  • 209
  • 214
  • 250
  • 287
  • 295
  • 297
  • 306
  • 307
  • 308
  • 319
  • 323
  • 330
  • 338
  • 346
  • 347
  • 352
  • 354
  • 362
  • 367
  • 377
  • 384
  • 426
  • 444
  • 459
  • 471
  • 488
  • 494
  • 502
  • 522
  • 524
  • 532
  • 601
  • 602
  • 613
  • 614
  • 653
  • 732
  • 770
  • 807
  • 829
  • 838
  • 841
  • 862
  • 863
  • 908
  • 916
  • 918
  • 922
  • 942
  • 943
  • 1004
  • 1275
  • 1321
  • 1333

Prompt Preview

Apply the Node.js 24 and JavaScript ES2026 prompts first. These rules target the passport package at 0.7.0. Check each installed strategy and session adapter separately: Passport core delegates credential and protocol verification to them.

Middleware and strategy boundaries

  • Register strategies with passport.use() from trusted startup configuration and map requests only to approved names and options; review strategy publishers, exact versions, runtime compatibility, and advisories independently of Passport core.
  • For login sessions, install session middleware before passport.session() and run restoration before handlers that consume the user. Place passport.initialize() before authentication when using its compatibility layer or userProperty setting; initialization alone does not authenticate a request.
  • Guard every protected route and method after session restoration. Both passport.session() and passport.authenticate('session') continue when no login exists; require an authenticated user explicitly before applying tenant, role, and object permissions.
  • Treat req.isAuthenticated() as a truthiness check of the configured user property, not evidence of fresh credentials or MFA. Keep pending authentication separate and require verified factors for the same account before granting elevated access.
  • Use passport.authenticate(strategy, { session: false }) for APIs that require credentials on every request, and exclude ambient cookie sessions from satisfying those routes. This option disables saving login state; it does not disable earlier session