Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 603186040
Change-Id: I645bb84640eabae2b8ffe432bb968ce8bef6d276
  • Loading branch information
cpovirk authored and copybara-github committed Feb 1, 2024
1 parent 8a0af07 commit 5720437
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package com.google.tsunami.plugins.cve20232843;

import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static com.google.common.truth.extensions.proto.ProtoTruth.assertThat;
import static com.google.tsunami.common.data.NetworkEndpointUtils.forHostnameAndPort;
import static com.google.tsunami.plugins.cves.cve202328432.Cve202328432VulnDetector.DESCRIPTION;
Expand All @@ -26,6 +25,7 @@

import com.google.common.collect.ImmutableList;
import com.google.common.io.Resources;
import com.google.common.truth.Truth8;
import com.google.inject.Guice;
import com.google.protobuf.util.Timestamps;
import com.google.tsunami.common.net.http.HttpClientModule;
Expand Down Expand Up @@ -103,11 +103,11 @@ public void buildSignedHttpRequest_whenValidKey_signedHttpRequest() {
assertEquals(signedRequest.url().toString(), uri);
assertEquals("GET", signedRequest.method().toString());
assertThat(signedRequest.headers().names()).hasSize(5);
assertThat(signedRequest.headers().get("Host")).hasValue("foo.bar:9000");
assertThat(signedRequest.headers().get("x-amz-content-sha256"))
Truth8.assertThat(signedRequest.headers().get("Host")).hasValue("foo.bar:9000");
Truth8.assertThat(signedRequest.headers().get("x-amz-content-sha256"))
.hasValue(Digest.ZERO_SHA256_HASH);
assertEquals(signedRequest.headers().get("x-amz-date").get(), requestDate);
assertThat(signedRequest.headers().get("Authorization"))
Truth8.assertThat(signedRequest.headers().get("Authorization"))
.hasValue(
"AWS4-HMAC-SHA256 Credential=this_is_the_access_key/20230405/us-east-1/s3/aws4_request,"
+ " SignedHeaders=host;x-amz-content-sha256;x-amz-date,"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
package com.google.tsunami.plugins.detectors.directorytraversal.genericpathtraversaldetector;

import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;

import com.google.common.collect.ImmutableList;
import com.google.common.truth.Truth8;
import com.google.tsunami.common.net.http.HttpRequest;
import com.google.tsunami.proto.NetworkService;
import org.junit.Test;
Expand Down Expand Up @@ -138,7 +138,7 @@ public void injectPayload_whenPromisingParameterName_assignsPriorityOnlyToPromis
INJECTION_POINT.injectPayload(
MINIMAL_NETWORK_SERVICE, requestWithPromisingParameterName, PAYLOAD);

assertThat(exploits.stream().map(PotentialExploit::priority))
Truth8.assertThat(exploits.stream().map(PotentialExploit::priority))
.containsExactly(PotentialExploit.Priority.LOW, PotentialExploit.Priority.HIGH);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
package com.google.tsunami.plugins.fingerprinters.web.data;

import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static com.google.common.truth.extensions.proto.ProtoTruth.assertThat;

import com.google.common.collect.ImmutableMap;
import com.google.common.truth.Truth8;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Provides;
Expand Down Expand Up @@ -152,26 +152,26 @@ public void matchSoftwareForHash_whenValidFingerprintDataAndSingleMatch_returnsM

@Test
public void getFingerprints_whenEmptyFingerprintData_returnsEmpty() {
assertThat(
Truth8.assertThat(
new FingerprintRegistry(ImmutableMap.of())
.getFingerprintData(SoftwareIdentity.getDefaultInstance()))
.isEmpty();
assertThat(
Truth8.assertThat(
new FingerprintRegistry(ImmutableMap.of())
.getFingerprintData(SoftwareIdentity.newBuilder().setSoftware("whatever").build()))
.isEmpty();
}

@Test
public void getFingerprints_whenValidFingerprintDataAndNoMatchingSoftware_returnsEmpty() {
assertThat(registry.getFingerprintData(SoftwareIdentity.getDefaultInstance())).isEmpty();
Truth8.assertThat(registry.getFingerprintData(SoftwareIdentity.getDefaultInstance())).isEmpty();
}

@Test
public void getFingerprints_whenValidFingerprintDataAndMatchingSoftware_returnsFingerprint() {
assertThat(registry.getFingerprintData(FINGERPRINTS_1.getSoftwareIdentity()))
Truth8.assertThat(registry.getFingerprintData(FINGERPRINTS_1.getSoftwareIdentity()))
.hasValue(FingerprintData.fromProto(FINGERPRINTS_1));
assertThat(registry.getFingerprintData(FINGERPRINTS_2.getSoftwareIdentity()))
Truth8.assertThat(registry.getFingerprintData(FINGERPRINTS_2.getSoftwareIdentity()))
.hasValue(FingerprintData.fromProto(FINGERPRINTS_2));
}

Expand Down

0 comments on commit 5720437

Please sign in to comment.