Loosen API key format assertion to is_binary + byte_size > 0#1151
Merged
Conversation
The assertion locked in a 32-byte API key length. With hexpm now issuing hex_-prefixed v2 tokens (44 bytes) alongside v1 (32 bytes), pinning the exact length makes the integration test brittle to hexpm-side format changes. Check that the secret is a non-empty string and let the rest of the test verify the key actually works for authentication.
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.
The integration test asserted `byte_size(key) == 32`, which pinned the
hexpm response to a specific format. Hexpm is rolling out `hex_`-prefixed
v2 tokens (44 bytes, see hexpm/hexpm#1536) so the strict length check
now fails for any hexpm version that issues them.
Loosening to `is_binary/1` + `byte_size/1 > 0`. The remaining test
assertions (auth still works, key list still contains it, deletion
still works) cover whether the returned secret is functionally usable.
This avoids re-pinning to a different exact length and stays
forward-compatible with future hexpm token format changes.
Plan: once main is green, the same change will be applied to v2.4,
v2.3, v2.2, v2.1 maintenance branches.