Skip to content

test: 32-byte JWT secrets; cache fixtures stop depending on a live Redis - #55

Merged
iklobato merged 1 commit into
devfrom
fix/ci-fixtures
Oct 12, 2026
Merged

iklobato merged 1 commit into
devfrom
fix/ci-fixtures

Conversation

@iklobato

Copy link
Copy Markdown
Owner

The release PR #53 runs test-dev.yml, which installs the package with pip and no lock, on a runner with no Redis. That run was the first time this suite met those two conditions, and 48 tests failed plus 10 fixtures errored. Both causes were in the tests and examples, not in the library:

  1. PyJWT 2.15 warns at every encode and decode when the HMAC key is shorter than 32 bytes (RFC 7518, 3.2), and the suite runs with warnings as errors. Every test, example and doc snippet used a short secret (test-secret-key, secret, my-secret). They now use values of 32 bytes or more; docs/advanced/authentication.md says why.
  2. The Meta.cache tests built their app against whatever Redis was on localhost:6379. On my machine one is always up, so the startup ping passed and the warning never fired; on the runner it did, and the warning became an error inside the fixture. The fixtures now patch the backend's ping while building the app, like the tests already patch its get, set and delete.

Reproduced and verified locally under the runner's conditions, LIGHTAPI_REDIS_URL pointing at a closed port and the versions pip resolved there layered over the lock (uv run --with anyio==4.15.1 --with starlette==0.52.1 --with pyjwt==2.15.1 --with sqlalchemy==2.0.54 --with pydantic==2.14.1): 632 passed, 0 failed. Under the locked versions: 633 passed. ruff, mypy and mkdocs build --strict clean.

…n a live Redis

The release PR's CI run installs the package with pip, unpinned, on a
runner with no Redis, and 48 tests failed plus 10 fixtures errored.
Both causes sat in the tests and examples:

PyJWT 2.15 warns at every encode and decode when the HMAC key is
shorter than 32 bytes (RFC 7518, 3.2), and the suite runs with warnings
as errors. Every test, example and doc snippet used a short secret; all
of them now use values of 32 bytes or more, and the authentication guide
says why.

The Meta.cache tests built their app against whatever Redis answered on
localhost:6379. A local one always did, so the startup ping passed; on
the runner the warning fired inside the fixture. The fixtures now patch
the backend's ping while building the app, as the tests already patch
its get, set and delete.

Verified under the runner's conditions (LIGHTAPI_REDIS_URL at a closed
port, pip's versions layered over the lock): 633 passed. Locked: 633.
@gitguardian

gitguardian Bot commented Oct 12, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
38113857 Triggered Bearer Token b5b2299 docs/superpowers/plans/2026-10-11-e2e-curl-suite.md View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@iklobato
iklobato merged commit 20a9ef8 into dev Oct 12, 2026
1 check failed
@iklobato
iklobato deleted the fix/ci-fixtures branch October 12, 2026 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant