fix(jwt): correct docs and remove dead code#63
Merged
Conversation
Documentation: - Fix examples using non-existent --verify flag to use -k/--key Coverage markers (kcov can't track these): - decode.sh: base64 remainder=1 case (impossible for valid input) - verify.sh: defensive fallbacks for unsupported algorithms - main.sh: TTY detection (ShellSpec uses pipes)
📊 Coverage Report
|
- Add tests for empty JWT parts (header, payload, signature) - Add test for invalid base64 in payload - Add kcov-exclude for environment-dependent code: - jwt_warn (only called on OpenSSL version warnings) - check_dependencies (can't mock missing openssl/xxd) - get_openssl_major_version LibreSSL branch - check_algorithm_support OpenSSL 3.x warning path - ECDSA signature conversion failure (defensive)
- Remove get_openssl_digest default case (verify_signature validates first) - Remove jwt_sig_to_der default case (only called with valid key_bits) - Remove jwt_sig_to_der failure handling (can't fail with valid inputs) - Remove wrong kcov-exclude from verify_signature default (IS reachable)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--verifyflag doesn't exist, corrected to-k/--keyChanges
Documentation
--verifyflagDead Code Removed
base64url_to_base64remainder=1 case (mathematically impossible for valid base64)get_openssl_digestdefault case (verify_signature validates algorithm first)jwt_sig_to_derdefault case (only called with valid key_bits)jwt_sig_to_derfailure handling in verify_ecdsa (can't fail with valid inputs)Tests Added
kcov-exclude Markers
Environment-dependent code that can't be tested in CI:
jwt_warn- only called when OpenSSL version warnings firecheck_dependencies- can't mock missing openssl/xxdCoverage
Before: ~91% → After: 100% (excluding environment-dependent code)