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

Okta Dep Update #28121

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Okta Dep Update #28121

wants to merge 14 commits into from

Conversation

kpcraig
Copy link
Contributor

@kpcraig kpcraig commented Aug 19, 2024

Description

This PR updates our Okta SDK dependency to v4, so that we transitively remove a go-jose dependency CVE-2024-28180. There have been a series of other tasks to purge the vulnerable dependency from vault, this is the only one that requires larger code changes.

Unfortunately, to get rid of the <=v2.6.2 vulerability, we had to move the okta-sdk to at least v3, which causes these breaking changes below. There didn't appear to be additional (relevant) changes between v3 and v5, so I moved to v5 directly.

This code retains the "shim" that was written that integrates github.com/chrismalek/oktasdk-go, only in the case of operating without an API token - a mode that was deprecated in Vault 1.4. I think this might be removable, and an alternative option used for the "no token" case, but that might only be viable for a version of this PR that isn't targeted at backporting.

TODO only if you're a HashiCorp employee

  • Backport Labels: If this PR is in the ENT repo and needs to be backported, backport
    to N, N-1, and N-2, using the backport/ent/x.x.x+ent labels. If this PR is in the CE repo, you should only backport to N, using the backport/x.x.x label, not the enterprise labels.
    • If this fixes a critical security vulnerability or severity 1 bug, it will also need to be backported to the current LTS versions of Vault. To ensure this, use all available enterprise labels.
  • Jira: If this change has an associated Jira, it's referenced either
    in the PR description, commit message, or branch name.

@github-actions github-actions bot added the hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed label Aug 19, 2024
Copy link

github-actions bot commented Aug 19, 2024

CI Results:
All Go tests succeeded! ✅

@kpcraig kpcraig marked this pull request as ready for review November 22, 2024 20:36
@kpcraig kpcraig requested review from a team as code owners November 22, 2024 20:36
Copy link

github-actions bot commented Nov 22, 2024

Build Results:
All builds succeeded! ✅

@kpcraig kpcraig added this to the 1.19.0-rc milestone Nov 22, 2024
@kpcraig kpcraig added backport/ent/1.16.x+ent Changes are backported to 1.16.x+ent backport/1.18.x backport/ent/1.17.x+ent Changes are backported to 1.17.x+ent labels Nov 22, 2024
@kpcraig kpcraig marked this pull request as draft November 22, 2024 20:45
@kpcraig kpcraig marked this pull request as ready for review November 22, 2024 20:53
@@ -2070,21 +2070,25 @@ func (c *Core) validateOkta(ctx context.Context, mConfig *mfa.Config, username s
return err
}

// Okta doesn't return the transactionID as a parameter in the response, but it's encoded in the URL
// this approach comes from: https://github.com/okta/okta-sdk-golang/issues/300, but it's not ideal.
// It is, however, what the dotnet library by Okta themselves does.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is also the inverse of what GetFactorTransactionStatus does.

}
}

if !factorFound {
return fmt.Errorf("no push-type MFA factor found for user")
}

result, _, err := client.UserFactor.VerifyFactor(ctx, user.Id, userFactor.Id, okta.VerifyFactorRequest{}, userFactor, nil)
result, _, err := client.UserFactorAPI.VerifyFactor(ctx, user.GetId(), userFactor.GetId()).Execute()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The difference between the approach here and the approach in path_login.go is for 'light touch' reasons - path_login.go uses the "shim", since the setting a token is optional there. The code here already used the okta API directly, and so the updated version can be similarly updated, without using the "write the request yourself" escape hatch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/ent/1.16.x+ent Changes are backported to 1.16.x+ent backport/ent/1.17.x+ent Changes are backported to 1.17.x+ent backport/1.18.x hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant