Skip to content

Commit bc51731

Browse files
authored
Merge pull request #584 from IABTechLab/UID2-6240-remove-eu-regioncheck
UID2-6240-remove-eu-regioncheck
2 parents 6838168 + 2ca74cd commit bc51731

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/main/java/com/uid2/shared/secure/gcpoidc/PolicyValidator.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ public class PolicyValidator implements IPolicyValidator {
3030
public static final String ENV_DEBUG_MODE = "DEBUG_MODE";
3131
public static final String ENV_SKIP_VALIDATIONS = "SKIP_VALIDATIONS";
3232

33-
public static final String EU_REGION_PREFIX = "europe";
34-
3533
private static final List<String> REQUIRED_ENV_OVERRIDES = ImmutableList.of(
3634
ENV_ENVIRONMENT,
3735
ENV_OPERATOR_API_KEY_SECRET_NAME
@@ -88,13 +86,13 @@ private static String checkWorkload(TokenPayload payload) throws AttestationExce
8886
return payload.getWorkloadImageDigest();
8987
}
9088

91-
// We don't support to launch UID2 instance in EU.
92-
// Currently, there's no GCP serving options in China mainland, so we will skip the check for CN.
89+
// Verify that region is specified.
90+
// Currently, there's no GCP serving options in China mainland, so we skip the check for CN.
9391
// More details about zone in https://cloud.google.com/compute/docs/regions-zones.
9492
private static String checkRegion(TokenPayload payload) throws AttestationException{
9593
var region = payload.getGceZone();
96-
if(Strings.isNullOrEmpty(region) || region.startsWith(EU_REGION_PREFIX)){
97-
throw new AttestationClientException("Region is not supported. Value: " + region, AttestationFailure.BAD_FORMAT);
94+
if(Strings.isNullOrEmpty(region)){
95+
throw new AttestationClientException("Region is not specified.", AttestationFailure.BAD_FORMAT);
9896
}
9997
return region;
10098
}

src/test/java/com/uid2/shared/secure/gcpoidc/PolicyValidatorTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,12 @@ public void testValidationFailure_NotConfidentialSpace() {
8787
}
8888

8989
@Test
90-
public void testValidationFailure_EURegion() {
90+
public void testValidationSuccess_EURegion() {
9191
var validator = new PolicyValidator(ATTESTATION_URL);
9292
var payload = generateBasicPayload().toBuilder()
9393
.gceZone("europe-north1-a")
9494
.build();
95-
var e = assertThrows(AttestationException.class, () -> validator.validate(payload));
96-
assertEquals(AttestationFailure.BAD_FORMAT, ((AttestationClientException) e).getAttestationFailure());
95+
assertDoesNotThrow(() -> validator.validate(payload));
9796
}
9897

9998
@Test

0 commit comments

Comments
 (0)