# GHSA-jcjx-c3j3-44pr: Insufficient Session Expiration in @cyyynthia/tokenize

> Attackers can use tokens that never expire due to a generation bug, bypassing session expiration controls in applications using this library.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 10 Nov 2021

## What is GHSA-jcjx-c3j3-44pr?

GHSA-jcjx-c3j3-44pr is a vulnerability in @cyyynthia/tokenize, published on 10 Nov 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

### Impact
A bug introduced in version 1.1.0 made Tokenize generate faulty tokens with NaN as a generation date. As a result, tokens would not properly expire and remain valid regardless of the `lastTokenReset` field.

### Patches
Version 1.1.3 contains a patch that'll invalidate these faulty tokens and make new ones behave as expected.

### Workarounds
None. Tokens do not hold the necessary information to perform invalidation anymore.

### References
PR #1

### For more information
If you have any questions or comments about this advisory:
* Open an issue in [github.com/cyyynthia/tokenize](https://github.com/cyyynthia/tokenize)
* Email us at [cynthia@cynthia.dev](mailto:cynthia@cynthia.dev)

## Which versions are affected by GHSA-jcjx-c3j3-44pr?

2 open source packages ship an affected version, including @cyyynthia/tokenize.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `@cyyynthia/tokenize` | npm | From 1.1.0 | 1.1.3 |
| `@cyyynthia/tokenize` | npm | From 1.1.0 | 1.1.3 |

## How do I fix GHSA-jcjx-c3j3-44pr?

Upgrade @cyyynthia/tokenize to 1.1.3 or later.

## Is GHSA-jcjx-c3j3-44pr being exploited?

There is no known exploitation of GHSA-jcjx-c3j3-44pr in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-jcjx-c3j3-44pr and fix it if it is affected.

What it is: GHSA-jcjx-c3j3-44pr is a vulnerability in @cyyynthia/tokenize, published on 10 Nov 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-jcjx-c3j3-44pr in the wild and no public exploit code.

Affected packages and fixed versions:
- @cyyynthia/tokenize (npm): affected from 1.1.0; fixed in 1.1.3
- @cyyynthia/tokenize (npm): affected from 1.1.0; fixed in 1.1.3

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-jcjx-c3j3-44pr/ (Markdown: https://insights.sbomify.com/GHSA-jcjx-c3j3-44pr/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-jcjx-c3j3-44pr

---
From sbomify Insights: https://insights.sbomify.com/GHSA-jcjx-c3j3-44pr/
Summaries are generated and may contain mistakes; the official description above is the record.
