Skip to content

Commit 35313c5

Browse files
feat: move web SSO token to POST request body (#304)
1 parent df9b8ad commit 35313c5

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### SECURITY
6+
7+
* Move web SSO token from URL query parameter to POST request body for `/login/token/sso` endpoint to prevent token exposure in server logs, browser history, and proxy logs
8+
39
## 2.5.3 (Feb 5, 2026)
410

511
* Add `golangci-lint` to the project [#293](https://github.com/okta/okta-aws-cli/pull/293) by [](https://github.com/pranav-okta)

internal/webssoauth/webssoauth.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ type roleTemplateData struct {
9292
// - CLI polls for access token from device auth at /oauth2/v1/token
9393
// - Access token granted by Okta once user is authorized
9494
//
95-
// - CLI presents access token to Okta AWS Fed app for a SAML assertion at /login/token/sso
95+
// - CLI presents web SSO token to Okta AWS Fed app via POST to /login/token/sso for a SAML assertion
9696
// - CLI presents SAML assertion to AWS STS for temporary AWS IAM creds
9797
type WebSSOAuthentication struct {
9898
config *config.Config
@@ -640,14 +640,18 @@ func (w *WebSSOAuthentication) extractIDPAndRolesMapFromAssertion(encoded string
640640

641641
// fetchSAMLAssertion Gets the SAML assertion from Okta API /login/token/sso
642642
func (w *WebSSOAuthentication) fetchSAMLAssertion(at *okta.AccessToken) (assertion string, err error) {
643+
apiURL := fmt.Sprintf("https://%s/login/token/sso", w.config.OrgDomain())
644+
645+
// Send token in POST body as form data to prevent exposure in URL/logs
643646
params := url.Values{"token": {at.AccessToken}}
644-
apiURL := fmt.Sprintf("https://%s/login/token/sso?%s", w.config.OrgDomain(), params.Encode())
647+
body := strings.NewReader(params.Encode())
645648

646-
req, err := http.NewRequest(http.MethodGet, apiURL, nil)
649+
req, err := http.NewRequest(http.MethodPost, apiURL, body)
647650
if err != nil {
648651
return assertion, err
649652
}
650653
req.Header.Add(utils.Accept, "text/html")
654+
req.Header.Add(utils.ContentType, utils.ApplicationXFORM)
651655
req.Header.Add(utils.UserAgentHeader, w.config.UserAgent())
652656
req.Header.Add(utils.XOktaAWSCLIOperationHeader, utils.XOktaAWSCLIWebOperation)
653657

0 commit comments

Comments
 (0)