Commit graph

35 commits

Author SHA1 Message Date
mountford
42795074a8 Add next page navigation for RDAP domain searches
In addition, while adding the tests, I became discontented with the thoroughness of the cursor navigation tests, which checked only the number of items returned, not their proper ordering. So I updated them to be more careful, and backported the changes to the nameserver and entity search tests as well.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179442118
2017-12-27 11:15:18 -05:00
guyben
b8970bfe1b Rename all testdata loading files to conform to a single naming scheme
The scheme is:
- loadBytes: returns a ByteSource of the data
- loadFile: returns a string using UTF8 encoding, optionally applying
  substitutions

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177606406
2017-12-01 22:14:06 -05:00
mountford
67a41273bb Add RDAP pretty-printing option
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176529676
2017-11-21 18:51:56 -05:00
mountford
6083ef9ba0 Add RDAP entity search metric information
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175984429
2017-11-21 18:38:22 -05:00
mountford
8521c69caa Add metrics for RDAP domain search
This CL also includes a minor refactor of the query size limit calculation; it is computed and stored in a local variable, to be used in two places, rather than computing it separately in each place.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175824713
2017-11-21 18:31:31 -05:00
mountford
358fe68f09 Add RDAP metrics for non-search endpoints
This CL uses the previously-defined RDAP metrics class to record basic metrics
for all RDAP endpoints, and handles testing of non-search endpoints. Searches
are more complicated, and will be handled in future CLs.

The default wildcard type is now INVALID rather than NO_WILDCARD.

A change to getMatchingResources() (adding an additional parameter) is also included in this CL, as it was needed to set the incompleteness warning type correctly.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175719265
2017-11-21 18:25:57 -05:00
mountford
11a218f9c3 Derive RDAP link paths from the received query
The former method -- a config string -- was cumbersome, as each Nomulus system would have to configure the link base to its own URL.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=173567021
2017-11-07 17:24:20 -05:00
mountford
74873f90c8 Order RDAP domain searches by TLD in domain name order
I am not happy that another index is required, but the Pantheon console shows that domain indexes are much smaller than the other indexes (because there are fewer domains), so it's not adding an appreciable amount of storage space.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=173561771
2017-11-07 17:21:26 -05:00
mountford
4267fa7e48 Return proper RDAP error messages when invalid IP addresses are specified
We were relying on Dagger to validate the IP address, but that resulted in 500 errors when the IP address was not valid, which is undesirable. Instead, accept the parameters as strings, then convert them to IP addresses and throw a proper error when conversion fails.

Also fixes an improperly specified test.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=173172516
2017-10-24 16:53:47 -04:00
mountford
52fd9d8c4e Correctly order RDAP domain searches by nameserver
Usually, the correct order happens automatically, because we are searching on either the key or a specific field like fullyQualifiedDomainName, and the results come back in that order. But when searching by nameserver, where we split the query into multiple "IN" chunks, we have to assemble the result set and order after the fact.

The tests didn't pick up the problem, because the domains and hosts were created in alphabetical order, so it happened to work anyway. The tests have now been changed to create things in reverse order, to test the reordering. Also, the previous arbitrary limit of 1000 nameservers in the intermediate query has been reduced to 300, because we now loop through all nameservers no matter what, rather than stopping when we collect enough domains, so there's more of a penalty for having way too many nameservers.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=173163121
2017-10-24 16:53:47 -04:00
mountford
03087ddc85 Add RDAP support for deleted domains and filtering by registrar
This CL adds the functionality for domain searches. Entities and nameservers have already been handled by previous CLs.

Deleted items can only be seen by admins, and by registrars viewing their own deleted items.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172097922
2017-10-24 16:53:47 -04:00
mountford
326cf698e0 Don't validate RDAP nameserver names using validateDomainName
The nameserver may be external, in which case its TLD will not appear in our
list of valid TLDs, and the search will be rejected erroneously.

Tests for letter case canonicalizations also added at reviewer's suggestion.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171985702
2017-10-24 16:53:47 -04:00
mcilwain
c0f8da0c6e Switch from Guava Optionals to Java 8 Optionals
This was a surprisingly involved change. Some of the difficulties included
java.util.Optional purposely not being Serializable (so I had to move a
few Optionals in mapreduce classes to @Nullable) and having to add the Truth
Java8 extension library for assertion support.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171863777
2017-10-24 16:53:47 -04:00
mountford
07e5536988 Revise RDAP domain action tests to check results more completely
Also fixed a bug discovered as a result of the more complete testing!

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171156304
2017-10-05 11:51:29 -04:00
mountford
1bb655267c Add RDAP warning when domain searches by nameserver may be incomplete
When searching for domains by nameserver name or IP address, we fetch the matching nameserver keys, then search for domains by those keys. We limit the number of nameserver keys returned, to avoid arbitrarily large domain queries. This CL adds a warning to the RDAP response if we retrieved the maximum number of nameservers. This may indicate that we have not found all the domains.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168885124
2017-09-20 10:27:17 -04:00
mountford
80ff106e4c Prohibit some RDAP domain and nameserver lookups by nameserver name
We had been allowing lookups by nameserver name using a wildcard and suffix if the suffix was a domain name. That's ok if the domain name is one we manage, but doesn't work efficiently otherwise. A lookup of ns*.zombo.com would require us to search for all nameservers beginning with ns (which could be almost all of them), then loop through until we found those ending with .zombo.com. So we are going to prohibit suffixes after the TLD unless the suffix is an in-bailiwick domain.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168835732
2017-09-20 10:27:17 -04:00
mountford
5b444d93fb Add administrator privileges to RDAP
RDAP filters some contact data when the request is not authenticated as coming from a user associated with the registrar owning the contact. This CL adds an exception for admin users, which for the App Engine Users API are defined as App Engine project viewers. This means that the registry team will always get all information when logged in. This will also be useful when building tools that use RDAP output.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168293820
2017-09-12 15:52:02 -04:00
mountford
985d14b51f Add more tests for RDAP contact data permissioning
This CL adds extra tests to make sure that contact data is hidden for RDAP domain and contact requests when not logged in as the proper registrar.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168234733
2017-09-12 15:51:50 -04:00
mountford
c85dc0c089 Avoid showing personal contact data in RDAP when not logged in
This CL changes the RDAP responses. When the requester asks for information about a domain, and is not logged in as the owning registrar, no contact information is shown. When the requester asks for information about a contact, and is not logged in as the owner registrar, the existence of the contact is shown, but not any personal data (the existence is shown to make things easier to test).

The login uses the same functionality as the registrar console.

For the most part, this CL does not include the necessary tests to make sure that data is not returned when not logged in. The CL is so large that I didn't want to burden it further. Those tests will be added in a follow-on CL.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168022034
2017-09-12 15:51:50 -04:00
mountford
5a31be12ba RDAP: Allow domain and nameserver queries with no initial string under certain circumstances
Up to now, our search wildcard rules have been that there must be an initial string of at least two characters. If a wildcard is present after that, it can optionally be followed by a suffix specifying the TLD (for domains) or domain (for nameservers). So domain queries can look like:

example.tld
ex*
ex*.tld

and nameserver queries can look like:

ns1.example.tld
ns*.example.tld
ns*

But you can't do a domain query for *.tld, nor a nameserver query for *.example.tld. It would be nice to support such queries, and the presence of a valid TLD or domain makes them relatively efficient. This CL relaxes the restrictions to allow wildcards with no initial string if the suffix is present. For nameservers, the suffix must be a valid domain in the system, to avoid having to loop through all nameservers.

A side effect of the changes is to fix a shortcoming in the logic which caused wildcard nameserver searches to fail if the specified domain suffix referred to an external domain.

Entity searches are not affected, since they do not support suffixes.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=159856563
2017-07-10 11:16:03 -04:00
mmuller
b70f57b7c7 Update copyright year on all license headers
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146111211
2017-02-02 16:27:22 -05:00
mountford
c59b738b5b Inject RDAP help information in ConfigModule
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140849879
2016-12-06 11:52:46 -05:00
mcilwain
fd09d825e3 Add MOE equivalences for pushes on 2016-10-19
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136617858
2016-11-02 15:19:34 -04:00
shikhman
f76bc70f91 Preserve test logs and test summary output for Kokoro CI runs
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135494972
2016-10-14 16:57:43 -04:00
mountford
179bd22531 RDAP: Display truncation notice for large domain result sets
The ICAAN Operational Profile dictates that a notice be added to the RDAP search results response when there are more objects than the server's chosen result set size. This CL handles the fixes for domain searches.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135407203
2016-10-07 15:29:48 -04:00
mountford
d0c102e680 RDAP: Fixes for domain search by nameserver
Use ordered sets to make sure that we don't pick up the same domain more than once if we find more than one of its nameservers, while preserving the order in which the domains are found. Add tests to make sure it works.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=134821458
2016-10-03 16:21:32 -04:00
mcilwain
c517c98d17 Fix confusing "now" parameters on persist deleted helper methods
They were taking a DateTime "now", which would seem like it would be the time of
when the resource was deleted, but it was actually the time by which the
resource was deleted, with the actual deletion time being hardcoded to a day
prior.  The confusion was evident because a fair number of tests were passing
the wrong thing.  I renamed the parameter "deletionTime" to make it exactly
clear what it's doing and fixed up some callsites where necessary.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=134818032
2016-10-03 16:20:03 -04:00
mountford
b5e421cee3 RDAP: Display summary data for search result items
It appears to be standard RDAP practice when returning result sets for domain, nameserver and entity searches to give only summary data for each result item. Any information that can be gleaned from the object itself is included, but related resources are not included. For a domain, for instance, the domain information is included, but nameservers, entities and events (which come from history entries) are suppressed. In their place, there is a standard boilerplate remark in the object indicating that only summary data is included, and that the user should query the item directly to get the full data. Note that summary data is used only for searches; direct queries for an item will still return full data.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=133973835
2016-09-26 13:15:31 -04:00
mountford
aa2af68af0 RDAP: Add result set sizing logic for domain name searches
Because we cannot weed out deleted domains in the query itself, the RDAP code must pull all domains with matching names, then throw out the deleted domains. So we don't know how many domains to fetch up front to fill up the desired maximum result set size. This CL adds a loop to attempt to fetch addition domains if the first fetch did not yield enough, while giving up after a while to avoid bogging down the system.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=133420297
2016-09-19 12:10:14 -04:00
cgoldfeder
5098b03af4 DeReference the codebase
This change replaces all Ref objects in the code with Key objects. These are
stored in datastore as the same object (raw datastore keys), so this is not
a model change.

Our best practices doc says to use Keys not Refs because:
 * The .get() method obscures what's actually going on
   - Much harder to visually audit the code for datastore loads
   - Hard to distinguish Ref<T> get()'s from Optional get()'s and Supplier get()'s
 * Implicit ofy().load() offers much less control
   - Antipattern for ultimate goal of making Ofy injectable
   - Can't control cache use or batch loading without making ofy() explicit anyway
 * Serialization behavior is surprising and could be quite dangerous/incorrect
   - Can lead to serialization errors. If it actually worked "as intended",
     it would lead to a Ref<> on a serialized object being replaced upon
     deserialization with a stale copy of the old value, which could potentially
     break all kinds of transactional expectations
 * Having both Ref<T> and Key<T> introduces extra boilerplate everywhere
   - E.g. helper methods all need to have Ref and Key overloads, or you need to
     call .key() to get the Key<T> for every Ref<T> you want to pass in
   - Creating a Ref<T> is more cumbersome, since it doesn't have all the create()
     overloads that Key<T> has, only create(Key<T>) and create(Entity) - no way to
     create directly from kind+ID/name, raw Key, websafe key string, etc.

(Note that Refs are treated specially by Objectify's @Load method and Keys are not;
we don't use that feature, but it is the one advantage Refs have over Keys.)

The direct impetus for this change is that I am trying to audit our use of memcache,
and the implicit .get() calls to datastore were making that very hard.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131965491
2016-09-02 13:50:20 -04:00
mountford
0cab13e6d8 RDAP: Remove port43 element from JSON output
According to Gustavo Lozano of ICANN: "In the case of the RDAP profile (gTLD space), the “port43” element is not expected to be used, because Whois/43 tcp will be deprecated in the future." So it sounds like we should not include the port43 element for the moment.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130017966
2016-08-15 16:42:06 -04:00
mcilwain
aa2f283f7c Convert entire project to strict lexicographical import sort ordering
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127234970
2016-07-13 15:59:53 -04:00
Corey Goldfeder
86f3287761 Typo in comment
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122449880
2016-05-16 18:40:40 -04:00
Michael Muller
c458c05801 Rename Java packages to use the .google TLD
The dark lord Gosling designed the Java package naming system so that
ownership flows from the DNS system. Since we own the domain name
registry.google, it seems only appropriate that we should use
google.registry as our package name.
2016-05-13 20:04:42 -04:00
Justine Tunney
5012893c1d mv com/google/domain/registry google/registry
This change renames directories in preparation for the great package
rename. The repository is now in a broken state because the code
itself hasn't been updated. However this should ensure that git
correctly preserves history for each file.
2016-05-13 18:55:08 -04:00
Renamed from javatests/com/google/domain/registry/rdap/RdapDomainSearchActionTest.java (Browse further)