Skip to content

Security: JWT tokens have no expiry and admin page bypasses authentication #1115

Closed

Description

@bilalahmadsheikh

While exploring the codebase I found two security issues worth discussing:

1. JWT tokens never expire
create_token in worker.py encodes no exp or iat claim.
verify_token never checks expiry. A stolen token is valid forever.

2. Admin page bypasses Basic Auth
wrangler.toml sets run_worker_first = ["/api/*"] only.
Requests to /admin are served directly by Cloudflare Assets,
bypassing the Basic Auth check in _dispatch entirely.

Happy to work on fixes for both if the team confirms these are
in scope. Tagging for discussion before writing any code.

Activity

  1. Shubhashish-Chakraborty commented on Mar 31, 2026

    @Shubhashish-Chakraborty
    Contributor

    Hey @bilalahmadsheikh
    I've too taken a look at this, and yeah you are right regarding both the vulnerabilities, good catch.
    Happy to see you've waited and first started with the discussion before going for a PR.
    Just i would suggest: that do mention this on Slack (and also from the next time any of your ideas/discussions on there first) and take suggestions on your next step from there, the community is more active on slack.

  2. jayati04 commented on Jun 12, 2026

    @jayati04

    Hi, I would like to work on this issue.

    I am interested in implementing JWT expiration support by adding exp and iat claims during token creation and validating token expiry during verification.

    Please let me know if there are any implementation preferences before I start.

  3. ayesha1145 commented on Sep 20, 2026

    @ayesha1145
    Contributor

    Update on the admin-auth-bypass half: I built and verified a fix for this (routing /admin through the Worker via run_worker_first, plus a related fix in serve_static), opened as PR alphaonelabs/learn#82.

    While resolving a merge conflict against main, I found this half is already fixed there — run_worker_first already includes /admin, /admin/, /admin-, and serve_static already has a proper env.ASSETS fallback with backward compatibility for the old binding. Looks like this was resolved independently, possibly around the same time I was working on it.

    Confirmed locally that /admin on current main correctly requires Basic Auth. I'm closing alphaonelabs/learn#82 since it's now redundant. The JWT-expiry half of this issue still looks open and unclaimed.

  4. added
    project: learn
    on Nov 1, 2026
  5. transferred this issue fromon Nov 1, 2026
  6. added
    good first issue
    2026-03
    on Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    2026-03good first issueproject: learn

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions