Skip to content

Commit

Permalink
Merge pull request #69 from IABTechLab/gdm-UID2-1504-operator-plainte…
Browse files Browse the repository at this point in the history
…xt-key-field-removal

Operator plaintext key field removal
  • Loading branch information
gmsdelmundo authored Sep 27, 2023
2 parents 242e629 + 07d98b7 commit 4240dd4
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<vertx.verticle>com.uid2.core.vertx.CoreVerticle</vertx.verticle>
<launcher.class>io.vertx.core.Launcher</launcher.class>

<uid2-shared.version>5.3.0-c5ed833119</uid2-shared.version>
<uid2-shared.version>5.7.0-b6571a9981</uid2-shared.version>
<image.version>${project.version}</image.version>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import io.vertx.core.json.JsonObject;
import io.vertx.core.net.SocketAddress;
import io.vertx.ext.web.RoutingContext;
import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -41,15 +40,13 @@ private void logAttestationFailure(RoutingContext context) {
final AttestationFailureReason attestationFailureReason = context.get(Const.RoutingContextData.ATTESTATION_FAILURE_REASON_PROP);
final String attestationFailureDataJson = getAttestationFailureDataJson(context);

final String operatorKeyHash = DigestUtils.sha256Hex(operatorKey.getKey());

final String originatingIpAddress = getOriginatingIpAddress(context);

LOG.warn("Attestation failed. StatusCode={} Reason={} Data={} OperatorKeyHash={} OperatorKeyName={} SiteId={} Protocol={} OperatorType={} OriginatingIpAddress={}",
context.response().getStatusCode(),
attestationFailureReason,
attestationFailureDataJson,
operatorKeyHash,
operatorKey.getKeyHash(),
operatorKey.getName(),
operatorKey.getSiteId(),
operatorKey.getProtocol(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ private String getUrlForEndpoint(String endpoint) {
}

private void fakeAuth(OperatorType operatorType, int siteId) {
OperatorKey clientKey = new OperatorKey("test-key", "test-key-hash", "test-key-salt", "", "", attestationProtocol, 0, false, siteId, new HashSet<>(), operatorType);
when(authProvider.get(any())).thenReturn(clientKey);
OperatorKey operatorKey = new OperatorKey("test-key-hash", "test-key-salt", "", "", attestationProtocol, 0, false, siteId, new HashSet<>(), operatorType);
when(authProvider.get(any())).thenReturn(operatorKey);
}

private void get(Vertx vertx, String endpoint, String body, Handler<AsyncResult<HttpResponse<Buffer>>> handler) {
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/uid2/core/vertx/TestCoreVerticle.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ private String getUrlForEndpoint(String endpoint) {
}

private void fakeAuth(Role... roles) {
OperatorKey clientKey = new OperatorKey("test-key", "test-key-hash", "test-key-salt", "test-name", "test-contact", attestationProtocol, 0, false, 88, new HashSet<>(Arrays.asList(roles)), OperatorType.PRIVATE);
when(authProvider.get(any())).thenReturn(clientKey);
OperatorKey operatorKey = new OperatorKey("test-key-hash", "test-key-salt", "test-name", "test-contact", attestationProtocol, 0, false, 88, new HashSet<>(Arrays.asList(roles)), OperatorType.PRIVATE);
when(authProvider.get(any())).thenReturn(operatorKey);
}

private void post(Vertx vertx, String endpoint, String body, Handler<AsyncResult<HttpResponse<Buffer>>> handler) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ private String getUrlForEndpoint(String endpoint) {
}

private void fakeAuth(OperatorType operatorType, int siteId) {
OperatorKey clientKey = new OperatorKey("test-key", "test-key-hash", "test-key-salt", "", "", attestationProtocol, 0, false, siteId, new HashSet<>(), operatorType);
when(authProvider.get(any())).thenReturn(clientKey);
OperatorKey operatorKey = new OperatorKey("test-key-hash", "test-key-salt", "", "", attestationProtocol, 0, false, siteId, new HashSet<>(), operatorType);
when(authProvider.get(any())).thenReturn(operatorKey);
}

private void get(Vertx vertx, String endpoint, String body, Handler<AsyncResult<HttpResponse<Buffer>>> handler) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ private String getUrlForEndpoint(String endpoint) {
}

private void fakeAuth(OperatorType operatorType, int siteId) {
OperatorKey clientKey = new OperatorKey("test-key", "test-key-hash", "test-key-salt", "", "", attestationProtocol, 0, false, siteId, new HashSet<>(), operatorType);
when(authProvider.get(any())).thenReturn(clientKey);
OperatorKey operatorKey = new OperatorKey("test-key-hash", "test-key-salt", "", "", attestationProtocol, 0, false, siteId, new HashSet<>(), operatorType);
when(authProvider.get(any())).thenReturn(operatorKey);
}

private void get(Vertx vertx, String endpoint, String body, Handler<AsyncResult<HttpResponse<Buffer>>> handler) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ private String getUrlForEndpoint(String endpoint) {
}

private void fakeAuth(OperatorType operatorType, int siteId) {
OperatorKey clientKey = new OperatorKey("test-key", "test-key-hash", "test-key-salt", "", "", attestationProtocol, 0, false, siteId, new HashSet<>(), operatorType);
when(authProvider.get(any())).thenReturn(clientKey);
OperatorKey operatorKey = new OperatorKey("test-key-hash", "test-key-salt", "", "", attestationProtocol, 0, false, siteId, new HashSet<>(), operatorType);
when(authProvider.get(any())).thenReturn(operatorKey);
}

private void get(Vertx vertx, String endpoint, String body, Handler<AsyncResult<HttpResponse<Buffer>>> handler) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ private String getUrlForEndpoint(String endpoint) {
}

private void fakeAuth(OperatorType operatorType, int siteId) {
OperatorKey clientKey = new OperatorKey("test-key", "test-key-hash", "test-key-salt", "", "", attestationProtocol, 0, false, siteId, new HashSet<>(), operatorType);
when(authProvider.get(any())).thenReturn(clientKey);
OperatorKey operatorKey = new OperatorKey("test-key-hash", "test-key-salt", "", "", attestationProtocol, 0, false, siteId, new HashSet<>(), operatorType);
when(authProvider.get(any())).thenReturn(operatorKey);
}

private void get(Vertx vertx, String endpoint, String body, Handler<AsyncResult<HttpResponse<Buffer>>> handler) {
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/uid2/core/vertx/TestSitesMetadataPath.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ private String getUrlForEndpoint(String endpoint) {
}

private void fakeAuth(OperatorType operatorType, int siteId) {
OperatorKey clientKey = new OperatorKey("test-key", "test-key-hash", "test-key-salt", "", "", attestationProtocol, 0, false, siteId, new HashSet<>(), operatorType);
when(authProvider.get(any())).thenReturn(clientKey);
OperatorKey operatorKey = new OperatorKey("test-key-hash", "test-key-salt", "", "", attestationProtocol, 0, false, siteId, new HashSet<>(), operatorType);
when(authProvider.get(any())).thenReturn(operatorKey);
}

private void get(Vertx vertx, String endpoint, String body, Handler<AsyncResult<HttpResponse<Buffer>>> handler) {
Expand Down

0 comments on commit 4240dd4

Please sign in to comment.