Skip to content

Token verified without saying which algorithm is allowed

Partialmedium severity · reads .ts .tsx .js .jsx .mjs .cjs .pyBeta

Without a fixed list, some library versions accept a token signed with a different algorithm than you meant, for example one signed with your public key (CWE-347). When Lintsure finds this, it marks it as Partial: it may be fine, depending on context only you can confirm.

How to fix it

Pass the algorithm you sign with, for example jwt.verify(token, key, { algorithms: ["RS256"] }), or algorithms=["HS256"] in PyJWT.

Through a coding agent, Lintsure suggests the change and waits. Nothing is edited until you approve it.

Controls it relates to

  • OWASP Top 10A07:2025Authentication Failures
  • API2:2023Broken Authentication

What the framework asks

OWASP Top 10 A07:2025: Authentication Failures

Logins and sessions that hold up: no passwords in code, strong secrets, tokens that expire and are verified, and session cookies protected from scripts and plain HTTP.

Evidence a reviewer may ask for: Login, session and token settings.

API2:2023: Broken Authentication

Sign-in, tokens and password resets must resist guessing, forgery and theft: verified tokens that expire, strong password hashing and limits on attempts.

Evidence a reviewer may ask for: How tokens are issued, checked and revoked, and the limits on sign-in attempts.

Summaries are our own reading of the public texts, not the official wording.

Check your code for this

Runs on your machine. Your code is never uploaded.

npx lintsure scan

Quickstart · Use it in Claude Code or Cursor

This rule is in Beta: its mapping to framework controls is our own reading of the public texts, not independently reviewed. Lintsure is a readiness tool, not an audit or legal advice. A finding, or the lack of one, doesn't make you compliant. Disclaimer

We improve these rules all the time. If you see a false alarm, a missed problem or anything that could work better, tell us in a review and we will use it to improve your experience.

Related rules

Did this rule flag something that's fine, or miss a real problem? Tell us on GitHub. Every report becomes a test case, so the same mistake can't come back.