mirror of
https://github.com/google/nomulus.git
synced 2025-07-22 10:46:10 +02:00
Prefer re2 over java.util.regex
Java's stock regex implementation doesn't guarantee linear time complexity which makes it a security liability. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=121159875
This commit is contained in:
parent
3291eb8b70
commit
6082146d55
42 changed files with 64 additions and 39 deletions
|
@ -37,6 +37,7 @@ java_library(
|
|||
"//third_party/java/junit",
|
||||
"//third_party/java/mockito",
|
||||
"//third_party/java/objectify:objectify-v4_1",
|
||||
"//third_party/java/re2j",
|
||||
"//third_party/java/servlet/servlet_api",
|
||||
"//third_party/java/truth",
|
||||
"//java/google/registry/config",
|
||||
|
|
|
@ -19,6 +19,8 @@ import static java.nio.charset.StandardCharsets.UTF_8;
|
|||
import static org.mockito.Mockito.when;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.re2j.Matcher;
|
||||
import com.google.re2j.Pattern;
|
||||
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.testing.AppEngineRule;
|
||||
|
@ -31,9 +33,6 @@ import org.junit.Test;
|
|||
import org.junit.runner.RunWith;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** Test setup for EppServletTest subclasses. */
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class EppTlsServletTest extends EppServletXmlLoginTestCase<EppTlsServlet> {
|
||||
|
|
|
@ -32,6 +32,7 @@ java_library(
|
|||
"//third_party/java/junit",
|
||||
"//third_party/java/mockito",
|
||||
"//third_party/java/objectify:objectify-v4_1",
|
||||
"//third_party/java/re2j",
|
||||
"//third_party/java/truth",
|
||||
"//java/google/registry/config",
|
||||
"//java/google/registry/flows",
|
||||
|
|
|
@ -44,7 +44,6 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Base class for all command tests.
|
||||
|
@ -154,10 +153,6 @@ public abstract class CommandTestCase<C extends Command> {
|
|||
assertThat(stdout.toString(UTF_8.toString())).contains(expected);
|
||||
}
|
||||
|
||||
void assertInStdout(Pattern expected) throws Exception {
|
||||
assertThat(stdout.toString(UTF_8.toString())).containsMatch(expected);
|
||||
}
|
||||
|
||||
void assertNotInStdout(String expected) throws Exception {
|
||||
assertThat(stdout.toString(UTF_8.toString())).doesNotContain(expected);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ java_library(
|
|||
"//third_party/java/junit",
|
||||
"//third_party/java/mockito",
|
||||
"//third_party/java/objectify:objectify-v4_1",
|
||||
"//third_party/java/re2j",
|
||||
"//third_party/java/servlet/servlet_api",
|
||||
"//third_party/java/truth",
|
||||
"//java/google/registry/groups",
|
||||
|
|
|
@ -18,6 +18,7 @@ java_library(
|
|||
"//third_party/java/hamcrest",
|
||||
"//third_party/java/junit",
|
||||
"//third_party/java/mockito",
|
||||
"//third_party/java/re2j",
|
||||
"//third_party/java/truth",
|
||||
"//java/google/registry/ui/forms",
|
||||
],
|
||||
|
|
|
@ -30,6 +30,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Range;
|
||||
import com.google.common.testing.NullPointerTester;
|
||||
import com.google.re2j.Pattern;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
@ -40,7 +41,6 @@ import org.junit.runners.JUnit4;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** Unit tests for {@link FormField}. */
|
||||
@RunWith(JUnit4.class)
|
||||
|
|
|
@ -23,6 +23,7 @@ java_library(
|
|||
"//third_party/java/jsr305_annotations",
|
||||
"//third_party/java/junit",
|
||||
"//third_party/java/mockito",
|
||||
"//third_party/java/re2j",
|
||||
"//third_party/java/truth",
|
||||
"//java/google/registry/util",
|
||||
"//javatests/google/registry/testing",
|
||||
|
|
|
@ -16,6 +16,7 @@ java_library(
|
|||
"//third_party/java/hamcrest",
|
||||
"//third_party/java/jsr305_annotations",
|
||||
"//third_party/java/junit",
|
||||
"//third_party/java/re2j",
|
||||
"//third_party/java/truth",
|
||||
"//java/google/registry/util",
|
||||
"//java/google/registry/xjc",
|
||||
|
|
|
@ -21,6 +21,8 @@ import static google.registry.xjc.XjcXmlTransformer.unmarshal;
|
|||
import static java.nio.charset.StandardCharsets.UTF_16;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import com.google.re2j.Pattern;
|
||||
|
||||
import google.registry.testing.ExceptionRule;
|
||||
import google.registry.xjc.rde.XjcRdeDeposit;
|
||||
import google.registry.xjc.rde.XjcRdeDepositTypeType;
|
||||
|
@ -33,7 +35,6 @@ import org.junit.runners.JUnit4;
|
|||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** Unit tests for {@code XjcObject}. */
|
||||
@RunWith(JUnit4.class)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue