Skip to content

Commit 6bc5135

Browse files
committed
fix: string comparison hardening
Signed-off-by: Danny Kopping <dannykopping@gmail.com>
1 parent 9d5d955 commit 6bc5135

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

provider/workspace.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"reflect"
66
"strconv"
7+
"strings"
78

89
"github.com/google/uuid"
910
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
@@ -160,12 +161,12 @@ func workspaceDataSource() *schema.Resource {
160161

161162
// isPrebuiltWorkspace returns true if the workspace is an unclaimed prebuilt workspace.
162163
func isPrebuiltWorkspace() bool {
163-
return helpers.OptionalEnv(IsPrebuildEnvironmentVariable()) == "true"
164+
return strings.EqualFold(helpers.OptionalEnv(IsPrebuildEnvironmentVariable()), "true")
164165
}
165166

166167
// isPrebuiltWorkspaceClaim returns true if the workspace is a prebuilt workspace which has just been claimed.
167168
func isPrebuiltWorkspaceClaim() bool {
168-
return helpers.OptionalEnv(IsPrebuildClaimEnvironmentVariable()) == "true"
169+
return strings.EqualFold(helpers.OptionalEnv(IsPrebuildClaimEnvironmentVariable()), "true")
169170
}
170171

171172
// IsPrebuildEnvironmentVariable returns the name of the environment variable that

0 commit comments

Comments
 (0)