fix(auth): validate options parameter in ServiceAccountCredentials.make_creds - #588
Merged
Conversation
aandreassa
force-pushed
the
clarify-json-key-io
branch
from
July 23, 2026 21:05
f083f0b to
b174fc5
Compare
…AccountCredentials.make_creds - Warn on unrecognized options passed to `ServiceAccountCredentials.make_creds`. - Raise `InitializationError` when required credential fields or valid `json_key_io` objects are missing. - Fix `unescape(nil)` bug to handle `nil` inputs safely. - Update `make_creds` docstring to document all supported options. Fixes #482 Fixes #544
aandreassa
force-pushed
the
clarify-json-key-io
branch
from
July 24, 2026 00:07
b174fc5 to
767dcb9
Compare
aandreassa
marked this pull request as ready for review
July 24, 2026 00:15
torreypayne
approved these changes
Jul 27, 2026
| # | ||
| # @param options [Hash] The options hash to validate. | ||
| def self.validate_make_creds_options options | ||
| return unless options.is_a? Hash |
Member
There was a problem hiding this comment.
Nit: based on the feedback from issue #482 would it make sense to add a warn or raise an error on some of the input types? There seemed to be confusion around String vs IO input for json_key and json_key_io so I'm wondering if we can clarify the typing a bit more.
Contributor
Author
There was a problem hiding this comment.
There is a warn just down below on using incorrect entry names (most common mistake). I also defined the types in the docstrings.
json_key_io.respond_to? :read above is to check IO vs String, which will raise an error.
Do you think that's sufficient?
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.
ServiceAccountCredentials.make_creds.InitializationErrorwhen required credential fields or validjson_key_ioobjects are missing.unescape(nil)bug to handlenilinputs safely.make_credsdocstring to document all supported options.Fixes #482
Fixes #544