You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation and code samples both say that the federation_endpoint argument to the InstancePrincipalsSecurityTokenSigner constructor is optional. However, there's a logic error in the constructor's implementation that requires the federation endpoint to be supplied, otherwise it will default to a value of nil and will result in an ArgumentError in creating a URI from the federation client:
irb(main):001:0> instance_principals_signer = OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner.new
ArgumentError: bad argument (expected URI object or URI string)
from /opt/graalvm/jre/languages/ruby/lib/mri/uri/common.rb:739:in `URI'
from /opt/graalvm/jre/languages/ruby/lib/ruby/gems/2.4.0/gems/oci-2.3.5/lib/oci/auth/federation_client.rb:40:in `initialize'
from /opt/graalvm/jre/languages/ruby/lib/ruby/gems/2.4.0/gems/oci-2.3.5/lib/oci/auth/signers/instance_principals_security_token_signer.rb:77:in `new'
from /opt/graalvm/jre/languages/ruby/lib/ruby/gems/2.4.0/gems/oci-2.3.5/lib/oci/auth/signers/instance_principals_security_token_signer.rb:77:in `initialize'
from (irb):2:in `new'
from (irb):2
from /opt/graalvm/jre/languages/ruby/bin/irb:29:in `<main>'
The issue is in the following block used to conditionally assign the federation endpoint value:
@federation_endpoint = if defined?(federation_endpoint)
federation_endpoint
else
"#{OCI::Regions.get_service_endpoint(@region, :Auth)}/v1/x509"
end
Since federation_endpoint is a keyword argument with a default value, it is always defined. defined?(federation_endpoint) => local-variable. The simple fix is to change the predicate to if federetion_endpoint. It's not clear if the code was implemented in this way to support an end user explicitly passing a false-y value. However, if a user does explicitly do that, the code is still going to error out several layers removed from where the error occurs.
On a side note, the published docs for the federation_endpoint value is truncated because the yard doc comment wraps. I don't know off-hand if there's a way to wrap it and generate properly or if you'd just need to accept wider-than-you-want comments for fields like this.
The text was updated successfully, but these errors were encountered:
The documentation and code samples both say that the
federation_endpoint
argument to theInstancePrincipalsSecurityTokenSigner
constructor is optional. However, there's a logic error in the constructor's implementation that requires the federation endpoint to be supplied, otherwise it will default to a value ofnil
and will result in anArgumentError
in creating aURI
from the federation client:The issue is in the following block used to conditionally assign the federation endpoint value:
Since
federation_endpoint
is a keyword argument with a default value, it is always defined.defined?(federation_endpoint) => local-variable
. The simple fix is to change the predicate toif federetion_endpoint
. It's not clear if the code was implemented in this way to support an end user explicitly passing a false-y value. However, if a user does explicitly do that, the code is still going to error out several layers removed from where the error occurs.On a side note, the published docs for the
federation_endpoint
value is truncated because the yard doc comment wraps. I don't know off-hand if there's a way to wrap it and generate properly or if you'd just need to accept wider-than-you-want comments for fields like this.The text was updated successfully, but these errors were encountered: