Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sso client should not check for creds #207

Open
benjamin-asdf opened this issue Feb 19, 2022 · 4 comments
Open

sso client should not check for creds #207

benjamin-asdf opened this issue Feb 19, 2022 · 4 comments
Assignees

Comments

@benjamin-asdf
Copy link

benjamin-asdf commented Feb 19, 2022

Dependencies

e.g.

{:deps         com.cognitect.aws/api {:mvn/version "0.8.539"},
        com.cognitect.aws/endpoints {:mvn/version "1.1.12.110"},
        com.cognitect.aws/identitystore
        {:mvn/version "811.2.958.0",
         :aws/serviceFullName "AWS SSO Identity Store"},
}

Repro

(ns
    sso
    (:require
     [cognitect.aws.client.api
      :as
      aws]))

(def client (aws/client {:api :sso}))

;; obtain an access token
;; this will fail, if you  do not have a default profile configured

(aws/invoke
 client
 {:op :GetRoleCredentials
  :request {:accessToken "fo"
            :roleName "role"
            :accountId "id"}})
            
;; expectation: get some validation err because the accessToken is "fo"''

Feb 19, 2022 4:19:57 PM clojure.tools.logging$eval15553$fn__15556 invoke
INFO: Unable to fetch credentials from environment variables.
Feb 19, 2022 4:19:57 PM clojure.tools.logging$eval15553$fn__15556 invoke
INFO: Unable to fetch credentials from system properties.
Feb 19, 2022 4:19:57 PM clojure.tools.logging$eval15553$fn__15556 invoke
INFO: Unable to fetch credentials from aws profiles file.
Feb 19, 2022 4:20:00 PM clojure.tools.logging$eval15553$fn__15556 invoke
INFO: Unable to fetch credentials from any source.

It fails too early in this case.
Sso should be a specail case where it doesn't look for creds because the use
case is that you fetch exactly those creds.

workaround:

configure a default profile (with keys)

set system props to some dummy values etc.

@benjamin-asdf
Copy link
Author

@benjamin-asdf benjamin-asdf changed the title sso sso client should not check for creds Mar 19, 2022
@dchelimsky dchelimsky self-assigned this Apr 4, 2022
@dchelimsky
Copy link
Contributor

dchelimsky commented Apr 4, 2022

We're looking into this. We have a few possible ways to handle this case, and need to figure out which solves the problem in the most general way without breaking things or introducing new dependencies. Please stand by.

@dchelimsky
Copy link
Contributor

@benjamin-asdf when I run your example with a dummy profile configured, I get this:

{:cognitect.anomalies/category :cognitect.anomalies/fault,
 :cognitect.anomalies/message
 "HTTP protocol violation: Authentication challenge without WWW-Authenticate header",
 ,,,}

Is that the validation err you get?

@benjamin-asdf
Copy link
Author

benjamin-asdf commented Apr 11, 2022

(aws/invoke
 (aws/client {:api :sso})
 {:op :GetRoleCredentials
  :request {:accessToken "fo"
            :roleName "role"
            :accountId "id"}})

;; without dummy

#:cognitect.anomalies{:category :cognitect.anomalies/fault, :message "Unable to fetch credentials. See log for more details."}

;; with dummy ~/.aws/credentials

[default]
aws_secret_access_key = _
aws_access_key_id = _
aws_session_token = _
{:cognitect.anomalies/category :cognitect.anomalies/fault, :cognitect.anomalies/message "HTTP protocol violation: Authentication challenge without WWW-Authenticate header", :cognitect.http-client/throwable #error {
 :cause "HTTP protocol violation: Authentication challenge without WWW-Authenticate header"
 ,,,

yea seems to be the same
@dchelimsky

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

No branches or pull requests

2 participants