Skip to content

fix: audit expert vault unlock failures#3

Open
luojiyin1987 wants to merge 3 commits into
CyberSunil:mainfrom
luojiyin1987:fix/local-only-docker-and-unlock-audit
Open

fix: audit expert vault unlock failures#3
luojiyin1987 wants to merge 3 commits into
CyberSunil:mainfrom
luojiyin1987:fix/local-only-docker-and-unlock-audit

Conversation

@luojiyin1987

@luojiyin1987 luojiyin1987 commented Jul 17, 2026

Copy link
Copy Markdown

What changed

  • Treat only Fernet authentication failures as invalid Expert Access Keys.
  • Verify both the encrypted vault and its metadata against release-maintained SHA-256 digests before JSON parsing or PBKDF2 work.
  • Configure root logging to emit INFO audit events to stderr under Gunicorn.
  • Audit successful, invalid-key, and loading-error unlock outcomes without recording access keys or player names.
  • Add tests for vault failures, valid metadata tampering, audit events, and secret redaction.

Why

The previous broad exception handler converted operational vault failures into an indistinguishable invalid-key response, which concealed deployment faults and left no unlock-attempt audit trail. Fernet intentionally uses InvalidToken for both wrong keys and invalid tokens, so independent integrity anchors are required to distinguish vault corruption before key derivation and decryption.

Validation

  • python3 -m py_compile app.py challenges/expert_vault.py tests/test_expert_unlock.py
  • pytest -q — 13 passed
  • git diff --check

Closes #2

@luojiyin1987
luojiyin1987 marked this pull request as ready for review July 17, 2026 10:35
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.

fix: distinguish expert vault failures from invalid keys

1 participant