Commit graph

858 commits

Author SHA1 Message Date
nickfelt
70fbdccea2 Restrict domain transfer pricing to 1 year
This CL restricts domain transfer pricing lookups (on domain check and info) to
only support a 1-year period for inquiring about transfer fees.  That treatment
matches what we do for domain restores, which are also always one year.  This is
a followup to [] which disallowed actual transfer request flows from
specifying multi-year periods.

Since it's no longer necessary, this CL also changes the domain transfer pricing
logic to drop the years parameter, including removing the parameter from the
custom pricing logic TransferPriceParameters object.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150367839
2017-03-21 15:33:29 -04:00
mountford
ff70494bd8 Capitalize the Bloom in Bloom filter in comments
(Because it's someone's name.)

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150353742
2017-03-21 15:30:30 -04:00
nickfelt
bd6a2d02dd Fix stale documentation on {ForeignKeyed,}DesignatedContact
Noticed that this is a bit out-out-date ever since these were
split into two types versus using the converters.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150352102
2017-03-21 15:28:58 -04:00
mountford
c2cbb9ea5a Define Stackdriver metrics for premium list checks
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150349564
2017-03-21 15:25:59 -04:00
ctingue
443e260f91 Disallow renaming of external hosts
EPP host spec section 3.2.5 requires that attempts to update hosts that are linked to different registrars must fail with error code 2305. This is complicated to do, as linked status is eventually consistent, and even more painful when checking links to those of different registrars.

This change forbids external-to-anything renames entirely.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150336754
2017-03-21 15:24:28 -04:00
nickfelt
e1c9395749 Simplify blocking of renews for domains in pending transfer
This tweaks the logic that prohibits domain renews during pending transfers to just use the regular verifyNoDisallowedStatuses() check instead of a special check on TransferData with a custom exception.  This is simpler and produces a better error message: we get "Operation disallowed by status: pendingTransfer" instead of "Object with given ID (foo.com) already has a pending transfer" (which is intended for use when denying a transfer request for an object already being transferred, not for this case).

For the record, we originally prohibited renews for domains in pending transfer because there's no good reason to do such a renew: b/12533793.  But in fact our transfer server-approve logic relies heavily on this behavior, because otherwise the domain's expiration time computed in cloneProjectedAtTime() will reflect the transfer year added to the post-renew expiration time, whereas all the transfer server approve entities (e.g. new autorenew billing event) will reflect the pre-renew expiration time at the moment the transfer was requested.  As such, it would be quite difficult to ever support a renew during pending transfer, since it would need to change many fields within the transfer server approve entities.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150325501
2017-03-21 15:21:28 -04:00
nickfelt
4d20490258 Remove unused method from PollMessage.OneTime
This was created during the Registry 2.0 migration for use by a scrap servlet ([] and never removed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150325126
2017-03-21 15:20:01 -04:00
nickfelt
d8349aa0ee Standardize usage of some transfer flow verification helpers
We were using verifyHasPendingTransfer() only in the domain transfer flows; now we use it in both.  I also added a helper verifyTransferInitiator() even though it's only used in two places (the transfer cancel flows), because I think it streamlines the flow and makes it more consistent with the whole section of verification checking.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150324823
2017-03-21 15:18:33 -04:00
mcilwain
7622e71dcf Add Cloud KMS as dependency of eclipse package
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150321468
2017-03-21 15:17:04 -04:00
guyben
9984c92386 Apply ComparatorGenerator to Keyring
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150274599
2017-03-21 15:15:31 -04:00
nickfelt
6a8b25360c Use StatusValue XML names in EPP error messages
This changes ResourceStatusProhibitsOperationException so that we print out the list of StatusValues using their XML names rather than the literal enum name, i.e. we use "pendingDelete" rather than "PENDING_DELETE".

This seems more correct given that EPP clients will be used to seeing the status values in the XML representation, and it also matches the existing ResourceHasClientUpdateProhibitedException that hardcodes "clientUpdateProhibited":
http://[]/third_party/java_src/gtld/java/google/registry/flows/exceptions/ResourceHasClientUpdateProhibitedException.java?l=22&rcl=146111211

Also reorganized related test methods and added some missing tests, including for ContactTransferRequestFlow which previously had none.  I also renamed the "clientProhibitedStatusValue" tests to instead say "statusValueNotClientSettable" to be clearer about what's being tested, and that it's not related to the "clientXXProhibited" statuses.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150248562
2017-03-21 15:14:02 -04:00
mountford
e60c01c2f7 Fix incorrect pluralization in reserved list metric name.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150241148
2017-03-21 15:12:35 -04:00
nickfelt
f28104ad03 Restrict domain transfer periods to 1 year
It turns out that this ICANN policy appears to prohibit transfers with
registration extensions other than 1 year (section A.8):
https://www.icann.org/resources/pages/policy-2012-03-07-en

This is backed up by the practical fact that we've never seen a registrar
request a transfer for any period other than one year.

And removing the support for multi-year transfers vastly simplifies
transfer logic and eliminates a bunch of annoying corner cases.  Users
still can achieve the same thing by doing a 1-year transfer plus a
manual renewal afterwards for the remainder of the desired extension.

This change leaves in place lots of infrastructure to support multi-year
transfers that is now obsolete (e.g. TransferData.extendedRegistrationYears).
This should all be cleaned up, but it's a lower priority than fixing the
gap itself and insulating ourselves against needing to handle any real
multi-year transfer case.  Once this CL goes in, we can start ignoring
extendedRegistrationYears entirely because it'll always be 1 year, which
makes the cleanup process easier.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150212864
2017-03-21 15:11:07 -04:00
mountford
852f1afb6c Add logging to OAuth authentication mechanism
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150194950
2017-03-21 15:09:38 -04:00
guyben
e6a5083b55 Rename .toString and .equals to be less confusing.
There will now be "resultToString" and "resultEquals" to stringify / compare
the method results.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150135475
2017-03-21 15:06:44 -04:00
mcilwain
3a13a4d6b6 Add monitoring/metrics/contrib package to Nomulus release
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150007228
2017-03-21 14:59:31 -04:00
jianglai
c426a80563 Add a new reservation type to support nameserver restrictions
A new field (allowedNameservers) is added to ReservedListEntry that stores the allow nameservers for the label. The field itself is a comma separated string, but the actual lines within a reserved list file (from which the field is parsed) uses colon to separate nameservers, to avoid conflicting with the commas used as primary separators in a CSV file.

Combined with upcoming update(s) that enables locking down an entire TLD to only delegate domains with a nameserver restricted reservation type, this change will enable us to restrict domain delegation to nameservers specifically specified in the allowed nameservers list, in order to prevent malicious delegation in case the registrar for a brand TLD is compromised.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149989330
2017-03-21 14:56:31 -04:00
mountford
5253f6fd6b Define Stackdriver metrics for premium and reserved lists
This CL defines metrics for both premium and reserved lists, but actually uses only the reserved list metrics. The premium list metrics will be used in a future CL.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149982639
2017-03-21 14:55:00 -04:00
nickfelt
2353bcd8c5 Cut over to generating new HMAC-based XSRF tokens
This is the second step of migrating to our new XSRF token format.  The
first step ([] made validate() start accepting new tokens
(basically, dual-read).  This step cuts over our "writing" to write the
new token format.  The third and final step will drop support for
validating the old token format (back to single-read).  We'll do that
in a subsequent push so that we don't invalidate all the current XSRF
tokens that people might have in their browsers.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149790648
2017-03-13 11:22:56 -04:00
jianglai
ebcdae7361 Return all applicable reserved list entries associated with a label
Instead of only returning the most severe one, return all applicable ones. This is because the reserved list has grown to a list of types that are not strictly comparable but orthogonal to each other. We can no longer depend on the fact that the most severe type incorporates all properties of those beneath it. Therefore returning all of them and treat them one by one in the calling site is the correct behavior.

Due to constraint imposed in eppcom.xsd, during domain checks the response can only contain a reservation reason of fewer than 32 characters, therefore we are returning the message for the type with highest severity, in case of multiple reservation types for a label.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149776106
2017-03-13 11:22:56 -04:00
Ben McIlwain
9a11f125ff Remove "@ForOverride" from .toString and .equals
Inheriting classes reimplementing these methods might want to call the super.
version of them in some cases (only change the default behavior for some
methods).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149772767
2017-03-13 11:22:56 -04:00
cgoldfeder
9174855a47 Remove the ofy().load() inside of HostResource.cloneProjectedAtTime
In fact, completely eviscerate cloneProjectedAtTime (to be removed in
a followup CL) in favor of doing the projection of transfers and the
loading of values from the superordinate domain at call sites. This
is one of the issues that blocked the memcache audit work, since the
load inside of cloneProjectedAtTime could not be controlled by the
caller.

Note: fixed a minor bug where a subordinate host created after its superordinate domain was last transferred should have lastTransferTime==null but was previously reporting the domain's lastTransferTime.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149769125
2017-03-13 11:22:55 -04:00
mountford
1f000b94e6 Set correct auth settings for all actions
A test has been added to RequestHandlerTest, making sure that, while we merely log errors for the time being, the correct dummy AuthResult is being created.

Most actions use the default settings, which have been changed to INTERNAL / APP / IGNORED. Actions with non-default settings are:

INTERNAL/NONE/PUBLIC (non-auth public endpoints)

CheckApiAction
WhoisHttpServer
Rdap*Action

INTERNAL,API/APP/ADMIN (things currently protected by web.xml)

EppTlsAction
EppToolAction
CreateGroupsAction
CreatePremiumListAction
DeleteEntityAction
List*sAction
UpdatePremiumListAction
VerifyOteAction
WhoisServer

INTERNAL,API,LEGACY/USER/PUBLIC (registrar console)

RegistrarPaymentAction
RegistrarPaymentSetupAction
RegistrarSettingsAction
EppConsoleAction

INTERNAL,API,LEGACY/NONE/PUBLIC (registrar console main page)

ConsoleUiAction

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149761652
2017-03-13 11:22:55 -04:00
Ben McIlwain
f5e76868f0 Add generic implementation comparator
This is an alternative to the "manually constructed" version in []

This generator recieves two objects implementing some interface. It returns a new implementation that exactly duplicates the behavior (return values, exceptions etc.) of the first ("original") object, but also logs any differences (in either return value or thrown exception) from the second object.

Nothing in the second object's execution will affect the results - not even thrown exceptions - it's only used for logging any differences.

This is useful when switching backend architecture for the some interface (say... from keystore to datastore+KMS for the Keyring interface :)) as we can make sure everything was OK for some extended period of real data before doing the switch.

This is better than just comparing the outputs once because having a completely different backend out of our control can result in "glitches" that are rare but relevant: maybe the new backend has lower availability, or sometimes fails and gives wrong results, or... well, that's it.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149706165
2017-03-13 11:22:55 -04:00
mcilwain
fa5d23bc19 Clarify what affects the size of the premium list entry cache
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149680785
2017-03-13 11:22:55 -04:00
mcilwain
3b2a014524 Don't log premium list nomulus tool usage errors as SEVERE
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149661618
2017-03-13 11:22:55 -04:00
mcilwain
ad840ad4d6 Better handle syncing contacts when creating RegistrarContacts
This also adds a test that should've been there already.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149583500
2017-03-13 11:22:55 -04:00
mcilwain
27b9244126 Fix non-determinism in RegistryTest duplicate auth code test
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149576311
2017-03-13 11:22:55 -04:00
mcilwain
815dae2749 Refactor WhoisReader.readCommand() method to take a now param
This obviates the need for the use of @AutoFactory.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149570411
2017-03-13 10:45:40 -04:00
mcilwain
01bb3a30f2 Fix handling around size of batches of mapreduce entities to process
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149562105
2017-03-13 10:42:44 -04:00
shikhman
1dfb6afa4b Add command description to get_resource_by_key command
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149561503
2017-03-13 10:41:15 -04:00
mcilwain
d2ca4b7234 Refactor main loop of MapreduceEntityCleanupAction
This also tightens up some error-checking conditions.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149552065
2017-03-13 10:38:21 -04:00
shikhman
b05afd2153 Fix nomulus tool NPEs on login/logout commands when printing usage
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149535358
2017-03-13 10:35:23 -04:00
jart
0c7443815a Add generates_api to Auto Factory too
We're going to play it safe, since the third_party definition of Auto Factory seems to have it too.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149534930
2017-03-13 10:32:24 -04:00
mcilwain
3fcb564251 Record metrics for WHOIS commands
Note that this does not write out metrics for invocations of the
nomulus tool.

This requires a slight refactoring of the existing WhoisResponse
interface so as to also support returning the number of results found
by the WHOIS query.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149461208
2017-03-13 10:30:53 -04:00
mmuller
4eef02f17f Inject token manager into LoadTestAction constructor
Inject into constructor instead of an instance variable, since it gets used
in the constructor before the instance variables get injected.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149452717
2017-03-13 10:29:22 -04:00
mcilwain
ce4f3c0d56 Don't allow setting reserved lists with conflicting auth codes
This is an error condition that will soon throw an exception when
attempting to register the domain name, so it's good to let the registry
operator know of the error when it is first introduced.

Unfortunately there's still a backdoor that allows duplicate labels
that's harder to protect against (that this commit doesn't cover): the
case where reserved lists are already applied to a TLD, then one of the
reserved lists is updated to add another auth code, which then conflicts
with one on a different reserved list.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149443007
2017-03-13 10:27:51 -04:00
mountford
5d4287a375 Add mapreduce cleanup action
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149432516
2017-03-13 10:24:57 -04:00
mcilwain
bd7db61606 Use Dagger to @Inject WhoisReader instances
This is a precursor to adding metrics to WHOIS queries (as I'd like
to be able to @Inject the metrics builders).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149418018
2017-03-07 14:02:46 -05:00
mcilwain
53785c2fc7 Add WHOIS metrics classes
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149344437
2017-03-07 14:01:16 -05:00
mmuller
b6f3d60e0f Refactor command running around auth exceptions
Refactor command and component code in RegistryCli so that we can handle a
LoginRequiredException from whereever we are likely to ever get one.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149329171
2017-03-07 13:59:40 -05:00
Ben McIlwain
c0e195e144 Use Immutable types for static final fields
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149260890
2017-03-07 13:56:41 -05:00
Ben McIlwain
65fb0aee6a Use Immutable types for static final fields
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149260762
2017-03-07 13:55:13 -05:00
Ben McIlwain
0cbc2bdab6 Use Immutable types for static final fields
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149260759
2017-03-07 13:53:46 -05:00
Ben McIlwain
2bba5660c2 Use Immutable types for static final fields
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149172966
2017-03-07 13:50:53 -05:00
mountford
034312c17d Fix bug in authentication code
[] changed RequestHandler to log a warning instead of returning an error to the user when authentication failed. Unfortunately, it didn't handle the resulting absent value of AuthResult. I don't yet know why the tests pass, and plan to add a test to check for this situation, but I wanted to start by fixing the problem as soon as possible, as it seems like this would result in exceptions any time a request was handled which didn't pass authentication.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149136265
2017-03-07 13:49:27 -05:00
mountford
9a15f08b3a Add Truth subjects for incrementable and event metrics
This CL adds Truth framework subjects to some metrics in the Stackdriver metrics library, in a contrib subpackage. It doesn't deal with gauge metrics, and for event metrics, the assertions can only be that a metric has or does not have a distribution for a particular set of label values. Asserting more fine-grained propositions regarding the distribution will require a distribution subject.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149112692
2017-03-07 13:46:38 -05:00
mmuller
5614760d53 Implement login/logout commands
Refactor the auth code into its own dagger module, add tests and use the new interfaces to implement the login and logout commands.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149108266
2017-03-07 13:45:11 -05:00
mountford
ee2bd594c8 Change new authorization logic to log a warning rather than rejecting the request
This is the first step in rolling out the changes so that we can check via logging whether turning on the logic would reject anything it should not.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149050878
2017-03-07 13:42:16 -05:00
nickfelt
3a7f67b7f3 Fix DomainTransferRequestFlow to correctly cancel autorenew graces
This fixes longstanding bug b/19430703 in which domain transfers that were
server-approved would only handle the autorenew grace period correctly if
the autorenew grace period was going to start within the transfer window.
If the autorenew grace period was already active (e.g. the domain had
recently autorenewed, before the transfer was requested), the logic would
miss it, even if it was going to be active throughout the transfer window
(i.e. it would still be active at the server-approval time).

When the autorenew grace period is active at the time a transfer is approved
(whether by the server or explicitly via DomainTransferApproveFlow), the
correct behavior is to essentially "cancel" the autorenew - the losing registrar
receives a refund for the autorenew charge, and the gaining registrar's transfer
extended registration years are applied to the expiration time as it was prior
to that autorenew.  The way we implement this is that we just have the transfer
essentially "subsume" the autorenew - we deduct 1 year from the transfer's
extended registration years before extending the registration period from what
the expiration time is post-autorenew at the moment of transfer approval.

See b/19430703#comment17 for details on the policy justification; the only real
ICANN document about this is https://www.icann.org/news/advisory-2002-06-06-en,
but registrars informally document in many places that transfers will trigger
autorenew grace, e.g. see https://support.google.com/domains/answer/3251236

There are still a few parts of this bug that remain unfixed:

  1) RdeDomainImportAction repeats a lot of logic when handling imported domains
     that are in pending transfer, so it will also need to address this case in
     some way, but the policy choices there are unclear so I'm waiting until we
     know more about RDE import goals to figure out how to fix that.

  2) Behavior at the millisecond edge cases is inconsistent - specifically, for
     the case where a transfer is requested such that the automatic transfer
     time is exactly the domain's expiration time (down to the millisecond),
     the correct behavior is a little unclear and this CL for now ignores this
     issue in favor of getting a fix for 99.999% of the issue into prod.  See
     newly created b/35881941 for the gory details.

Also, there are parts of this bug that will be fixed as parts of either
b/25084229 (transfer exDate computations) or b/35110537 (disallowing transfers
with extended registration years other than 1), both of which are less pressing.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149024269
2017-03-07 13:39:15 -05:00