Skip to content

Commit c76ec3a

Browse files
committed
Fix env0 validation
This fixes some issues in env0 token validation: - azp check is disabled since it's set to a random (ish) value - Use correct audience URL (their docs specified the wrong value)
1 parent 41dd123 commit c76ec3a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/join/env0/validator.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323

2424
"github.com/gravitational/trace"
2525
"github.com/jonboulle/clockwork"
26+
"github.com/zitadel/oidc/v3/pkg/client/rp"
2627

2728
"github.com/gravitational/teleport/lib/oidc"
2829
)
@@ -33,7 +34,7 @@ const (
3334

3435
// env0Audience is the audience for the token. This is unfortunately hard
3536
// coded.
36-
env0Audience = "https://app.env0.com"
37+
env0Audience = "https://prod.env0.com"
3738
)
3839

3940
// IDTokenValidator can be used to validate env0 OIDC tokens.
@@ -52,7 +53,13 @@ func (v *IDTokenValidator) ValidateToken(
5253
return nil, trace.Wrap(err)
5354
}
5455

55-
claims, err := validator.ValidateToken(ctx, string(token))
56+
// Env0 issues tokens with a randomized azp, which we can't verify. It's
57+
// an optional check, so we'll disable it.
58+
withoutAZPVerifier := rp.WithAZPVerifier(func(string) error {
59+
return nil
60+
})
61+
62+
claims, err := validator.ValidateToken(ctx, string(token), withoutAZPVerifier)
5663
if err != nil {
5764
return nil, trace.Wrap(err, "validating OIDC token")
5865
}

0 commit comments

Comments
 (0)