Skip to content

Validate Model Target JWT signatures - #3325

Merged
adamtheturtle merged 2 commits into
mainfrom
adamtheturtle/model-target-fix-v5
Aug 5, 2026
Merged

Validate Model Target JWT signatures#3325
adamtheturtle merged 2 commits into
mainfrom
adamtheturtle/model-target-fix-v5

Conversation

@adamtheturtle

Copy link
Copy Markdown
Member

Summary

  • reject empty and malformed base64url JWT signature segments with Vuforia-compatible 401 responses
  • add verified-fake cases that run against real Vuforia and both mock backends
  • update mock bearer-token fixtures, documentation, and the changelog fragment for the stricter syntax

Why

The Model Target mock already validated JWT header and payload segments, but accepted any signature segment, including an empty or malformed one. Real Vuforia distinguishes these cases and returns stable error messages, so matching them improves authentication fidelity toward #3192.

Impact

Callers using malformed Model Target bearer tokens now receive the same observable errors as real Vuforia. The mock still does not cryptographically verify signatures or payload claims.

Root cause

Bearer-token validation returned after checking only JWT structure, header, and payload. The signature segment was never decoded or checked for emptiness.

Validation

  • uv run pytest -q tests/mock_vws/test_model_target_web_api.py::TestAuthentication::test_invalid_bearer_token tests/mock_vws/test_model_target_generation_failure.py tests/mock_vws/test_model_target_generation_warning.py tests/mock_vws/test_requests_mock_usage.py::TestModelTargetWebAPI tests/mock_vws/test_respx_mock_usage.py::TestModelTargetWebAPI (44 passed, including live Vuforia)
  • uv run pytest -q tests/mock_vws/test_model_target_web_api.py --skip-real tests/mock_vws/test_model_target_generation_failure.py tests/mock_vws/test_model_target_generation_warning.py tests/mock_vws/test_requests_mock_usage.py::TestModelTargetWebAPI tests/mock_vws/test_respx_mock_usage.py::TestModelTargetWebAPI (82 passed, 32 skipped)
  • uv run prek run --all-files
  • pre-push type and manifest checks

A non-empty base64url string can never decode to empty bytes with
validate=True, so the check was dead code and left the file below the
100% coverage requirement.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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