Commit graph

1187 commits

Author SHA1 Message Date
mountford
ac822053cc Change behavior when searching contacts by name
We no longer find contacts by name if the request is not authorized to see the name.

Several changes cascade from this. Previously, the code assumed that deleted contacts might still have full names, and therefore be searchable. This is not possible in all cases, because Datastore doesn't have the right index to find deleted contacts by name with a matching registrar. However, luckily, this situation can never occur, because contacts always have their name fields nulled out when they are deleted.

So instead, we simply ignore deleted records when searching by name, knowing that none can ever match.

The tests were then changed so that deleted records look the way the really will, meaning devoid of personal information.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172776926
2017-10-24 16:53:47 -04:00
mcilwain
4828417c73 Convert domain label list code to use Java 8 streams features
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172774927
2017-10-24 16:53:47 -04:00
larryruili
f1c76d035f Prepare ICANN reporting for production
This originally started as a small change, but quickly grew into a major refactor as I realized the original parameter structure wasn't conducive to a cron task and manual re-runs.

The changes are as follows:
1. Adds DNS metrics to activity reports, thanks to Nick's work with the Zoneman Dremel -> #plx workflow.
2. Surrounds registrar names in transactions reports with quotes, to escape possible commas.
3. Factors out the report generation logic into IcannReportingStager.
4. Assigns default values to the three main parameters
  - yearMonth defaults to the previous month
  - subdir defaults to "icann/monthly/yearMonth", i.e. "gs://domain-registry-reporting/icann/monthly/yyyy-MM"
  - reportType defaults to both reports
5. Adds "Total" row generation logic to transactions reports
  - This was a previously overlooked requirement.
6. Adds "MANIFEST.txt" generation and upload logic.
  - The MANIFEST lists out which files need to be uploaded in the subdirectory.
7. Increases urlfetch timeout from 5s to 10s in backend tasks.
  - Backend tasks should be more latency tolerant anyway, and this reduces the number of incorrect timeouts we see for services like Bigquery which might take some time to respond.

TESTED=Extensive testing in alpha, and ran FOSS test.
TODO: send out an e-mail for report generation and upload, and add reporting to cron.xml

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172738344
2017-10-24 16:53:47 -04:00
guyben
06f0ec4f2f Remove reference to TLD in Locks' ResourceName
The TLD is added separately to the lock (the lock is unique per
TLD-ResourceName pair), so there's no need to add it to the resourceName.

The current status is that the TLD was included twice in the lockId. After the fix - it'll only be included once.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172659986
2017-10-24 16:53:47 -04:00
mcilwain
e62e1af863 Rename ClaimsCheckFlow to DomainClaimsCheckFlow
This way it is consistent with the rest of our domain-related flows, which
consistently use the Domain* prefix. Note that claims checks are just a
special case of domain checks anyway, which run under DomainCheckFlow. This
will make dashboards looking at domain commands "just work" with a regexp of
Domain.*, without having to special-case in ClaimsCheck.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172608964
2017-10-24 16:53:47 -04:00
guyben
77ee3e3544 Add metric for lock contention
Also - remove logging from TransactNew, to prevent double logging on transient
failures (TransactNew retries on failure)

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172500772
2017-10-24 16:53:47 -04:00
mountford
108deb7f9d Fix NPE in GetHistoryEntriesCommand
The code was not checking the value returned by getTrid() to make sure it was
not null.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172384499
2017-10-24 16:53:47 -04:00
guyben
af99f64b88 Convert CreateCdnsTld into a ConfirmingCommand
This will result is a prompt like

Creating TLD with:
  projectId= domain-registry-alpha
  description= some description
  dnsName= mytld.
  name= mytld.
  nameServerSet= cloud-dns-registry-test
Perform this command? (y/N):

before actually performing the command, and adds a --force flag to bypass the
prompt.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172369944
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
048ae4b4ba Add term to contact index
RDAP searches for contacts with a specific desired registrar need an additional
index term. The tests were not extensive enough to catch this particular case.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172013843
2017-10-24 16:53:47 -04:00
mmuller
bf818a0139 Translate multi-part TLD zone names
Convert periods to hyphens in multi-part TLDs when using them as a zone name
(cloud-dns doesn't allow periods in zone names).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172007089
2017-10-24 16:53:47 -04:00
mountford
7e85ae9964 Fix problem with RDAP help information
Soon this will be rewritten with much more complete information. But this fixes
an obviously wrong bit in the meantime.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172004672
2017-10-24 16:53:47 -04:00
mcilwain
05f6ad80ab Format some imports using fix_imports.py
Unfortunately this tool isn't smart enough to deal with the assertThat
situation (which has two static imports of a function with the same name).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172000753
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
mountford
9d1eb0d429 Set content type for RDAP responses before setting the payload
Also sets the charset to UTF8 explicitly, to avoid confusion, and removes apparently unneeded Truth8 include.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171963981
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
nickfelt
184b2b56ac Persist transferredRegistrationExpirationTime (exDate) on TransferData
This CL adds transferredRegistrationExpirationTime as a TransferData field
persisted to Datastore.  It's only relevant for domains, and it represents the
registration expiration time resulting from the approval of the most recent
transfer request.  For pending transfers, we assume the transfer will be
server-approved, and thus in DomainTransferRequestFlow we set this field to the
existing computed value serverApproveNewExpirationTime, which is what we use
for setting up the server-approve autorenew billing event and poll message.
In DomainTransferApproveFlow we overwrite this field with the freshly computed
newExpirationTime, whereas in DomainTransferCancel/RejectFlow (and in the
implicit cancel of DomainDeleteFlow during a pending transfer) we null it out.

There are two key benefits to having this field, which are described in more
detail in b/36405140.

1) b/25084229 - it allows storage of a frozen value to back the "exDate" field
   of DomainTransferResponse, which we can use to fix various errors with how
   exDate display currently works.

2) b/36354434 - it allows DomainResource.cloneProjectedAtTime() to just directly
   set the registrationExpirationTime to this value, without computing it de
   novo, which reduces duplicated logic and ensures that the new expiration time
   matches the autorenew child objects.

This CL only starts writing the field on TransferData as persisted directly on
the DomainResource itself.  We'll then want to backfill the field for at
least pending transfers, whether expired or not (so we can do (2) above), but
I think we might as well backfill it for all pending and approved transfers
so that we also fix (1) even for historical transfers.  And then we can start
actually reading the field for both purposes.  (Note that for (1), this will
only fix synchronous transfer responses served via DomainTransferQueryFlow,
not async transfer responses served via poll messages, since these have already
been persisted with a potentially bad exDate, but I don't think it's worth a
backfill for those).

One last naming note: I chose the verbose transferredRegistrationExpirationTime
rather than the extendedRegistrationExpirationTime of DomainTransferResponse
because (as is the case in autorenew grace, or for a superuser transfer) the
new registration time isn't necessarily extended at all; it may be the same as
the pre-transfer expiration time.  Also, including "registration" helps clarify
w.r.t. pendingTransferExpirationTime which refers confusingly to the expiry of
the transfer itself, rather than the domain registration.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171858083
2017-10-24 16:53:47 -04:00
bbilbo
9a3877fdb2 Add a log message indicating that the restore is complete
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171719014
2017-10-24 16:53:47 -04:00
guyben
840d53c819 Allow EventSample.record to accept numSamples=0
There's really no reason not to.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171037754
2017-10-24 16:50:30 -04:00
mmuller
69d33e928a Use a direct reference to jsch 0.1.53
Use a direct reference to the jsch 0.1.53 package instead of going through the
target link, which doesn't exist after MOE transformation.  Also change the
target's visibility (since the whitelist referenced by the current rule isn't
preserved by the moe transform).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171554085
2017-10-10 12:09:42 -04:00
bbilbo
6d80482875 Remove all jar_urls pointing to maven.ibiblio.org and add missing mirrors
com_google_template_soy wasn't sorted, so I fixed that as well.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171347611
2017-10-10 12:09:42 -04:00
mmuller
a790ec27db Upgrade domain-registry to jsch 0.1.53
TESTED=Verified on Alpha with an updated build using Java 8, Verified on alpha
against the latest java 8 based build.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171297613
2017-10-10 12:09:42 -04:00
bbilbo
24d58bf505 Add cron/commitLogCheckpoint to cron.xml for the crash environment
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171297448
2017-10-10 12:09:41 -04:00
mcilwain
13408532b3 Convert Registrar entity class to use more Java 8 features
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171207262
2017-10-10 12:09:41 -04:00
mcilwain
5edb7935ed Run automatic Java 8 conversion over codebase
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171174380
2017-10-10 12:09:41 -04:00
mmuller
44df5da771 Add "create_cdns_tld" command to nomulus
Automated g4 rollback of changelist 171011304.  Please see history below, the original CL was []  Rolling back and re-mailing
so I can get a readability review on it.

*** Reason for rollback ***

Re-opening for readability review.

*** Original change description ***

Automated g4 rollback of changelist 170906329.

*** Reason for rollback ***

Forgot to send this for readability review.

*** Original change description ***

Add "create_cdns_tld" command to nomulus

Add a command to allow us to create the managed zone for a new TLD in cloud
dns.

Note: this implementation is problematic, it's currently doing its own thing
as far as credentials and http transport, making it unusable with the []
channel and the credentials generated by login.  Unfortunately, fixing the plumbing to make it work right is difficult, and we have an immediate need for
this functionality.

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171161371
2017-10-10 12:09:41 -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
jianglai
373e174deb Upgrade to Truth 0.36
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171079195
2017-10-05 11:48:54 -04:00
mcilwain
302a27f0db Record a version of EPP metrics with TLD for domain commands
Also fixes the issue that dry run EPP commands were incorrectly being
reported on.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171062984
2017-10-05 11:47:31 -04:00
nickfelt
7e68ffa16a Change transfer flow tests to assert on entire TransferData contents
This CL changes the domain and contact transfer flows to check the entire
TransferData on the post-transfer resource, rather than just spot-checking
certain fields.  This approach provides much better code coverage - in
particular, it checks that the non-request flows (approve, cancel, reject)
don't modify the fields that they shouldn't be modifying, and that they do
actually clear out the transfer server-approve entities fields written by
the transfer request flow.  It's slightly orthogonal, but I also added
testing that the server-approve entities fields are actually set in the
request flows, which was previously untested.

This is pre-work for introducing an exDate-storing field into TransferData,
by making it easier to test everywhere that exDate is set *and* unset only
in the correct places.

As part of this CL, I've introduced a TransferData.copyConstantFieldsToBuilder()
method that is like asBuilder() but instead of copying all the fields to the new
builder, it only copies the logically constant ones: losing/gaining client IDs,
the request time and TRID, and transferPeriod.  This is useful both in tests but
is also used in the resolvingPendingTransfer() helper that centralizes the core
transfer resolution logic (as of []  That method has its own tests,
and in the process I removed a bunch of crufty defunct TransferData tests.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171053454
2017-10-05 11:44:46 -04:00
bbilbo
3584bbde53 Allow restore commit logs action in the crash environment
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171042730
2017-10-05 11:43:23 -04:00
guyben
0b5b16e97c Allow EventSample.record to accept numSamples=0
There's really no reason not to.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171037754
2017-10-05 11:41:59 -04:00
bbilbo
6b113603db Add nocron ear and deployer rules for the crash environment
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171027505
2017-10-04 16:16:45 -04:00
jianglai
9d8e48cf24 Refector metrics truth subject
The concrete implementation of a Metric is not of importance when asserting on the values it contains. Therefore this CL removes Metric<T> as a type parameter of AbstractMetricSubject. As a result the two implementations of the abstract subject can be used on any Metric<Long> and Metric<Distribution>, respectively.

Also migrate to Subject.Factory from deprecated SubjectFactory.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171012012
2017-10-04 16:16:45 -04:00
mmuller
a9ecccf672 Automated g4 rollback of changelist 170906329.
*** Reason for rollback ***

Forgot to send this for readability review.

*** Original change description ***

Add "create_cdns_tld" command to nomulus

Add a command to allow us to create the managed zone for a new TLD in cloud
dns.

Note: this implementation is problematic, it's currently doing its own thing
as far as credentials and http transport, making it unusable with the []
channel and the credentials generated by login.  Unfortunately, fixing the
plumbing to make it work right is difficult, and we have an immediate need for
this functionality.

b/67367533 created to clean this up, along with...

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171011304
2017-10-04 16:16:45 -04:00
mmuller
6e84401271 Add "create_cdns_tld" command to nomulus
Add a command to allow us to create the managed zone for a new TLD in cloud
dns.

Note: this implementation is problematic, it's currently doing its own thing
as far as credentials and http transport, making it unusable with the []
channel and the credentials generated by login.  Unfortunately, fixing the
plumbing to make it work right is difficult, and we have an immediate need for
this functionality.

b/67367533 created to clean this up, along with related warts in the codebase.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170906329
2017-10-04 16:16:45 -04:00
jakubvrana
939c18bbce Remove autoescape="strict" attributes from Soy templates.
Strict autoescaping is the default so they serve no purpose.

Design doc: []

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170905337
2017-10-04 16:16:45 -04:00
mcilwain
51b04f7340 Add TODO for better handling of public suffix lists for hosts
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170854701
2017-10-04 16:16:45 -04:00
guyben
01591ff88e Clarify diff display of MutatingCommand
Tools inheriting from MutatingCommand print out the change they are going to
make and then ask the user to confirm that this is indeed what they wanted to
do.

The change is outputted as a list of updated values in the form

key -> [oldValue, newValue]

e.g.

dnsPaused -> [true, false]

This CL will change the output to be clearer:

key: oldValue -> newValue

e.g.

dnsPaused: true -> false

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170853745
2017-10-04 16:16:45 -04:00
nickfelt
fd62f4a74e Streamline transfer resolving helpers in ResourceFlowUtils
In the great flow flattening, ResourceFlowUtils grew a couple nice helpers
for rebuilding transferrable resources (Domains and Contacts) upon the
resolution of a transfer - approvePendingTransfer() and denyPendingTransfer().

Most transfer-resolving callsites use one of these two helpers, but for legacy
reasons the deletion flows (DomainDeleteFlow and DeleteContactsAndHostsAction)
were instead using the "manual" resolvePendingTransfer() method or its even more
low-level createResolvedTransferData() helper instead of denyPendingTransfer().
It's simpler to just have two options - approve and deny - so this CL inlines
createResolvedTransferData() into resolvePendingTransfer() and makes the latter
a private helper for the approve/denyPendingTransfer() public helpers.

This CL also adds sanity checks that approve/denyPendingTransfer() are called
only with the logically appropriate values of TransferStatus.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170819358
2017-10-04 16:16:45 -04:00
mountford
a5c931a152 Add RDAP support for deleted contacts and registrars
This CL adds the functionality for contact and registrar searches. A future CL will handle domains and entities.

Support is also added for filtering results by registrar.

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=170734664
2017-10-04 16:16:45 -04:00
jakubvrana
6740e9270f Remove autoescape="strict" attributes from Soy templates.
Strict autoescaping is the default so they serve no purpose.

Design doc: []

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170725633
2017-10-04 16:16:45 -04:00
bbilbo
7aa5629517 Allow domain transfers with 0 period and in auto-renew grace period
Normally, if a domain is in the auto-renew grace period, a transfer will cancel the auto-renew billing event. In the event of a transfer with no change to registration end date, the auto-renew billing event should not be cancelled and the gaining registrar should not be charged for the transfer.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170576726
2017-10-04 16:16:45 -04:00
mcilwain
a50ef39c04 Fix mismatch in types of Predicates being used
We're going to need to switch away from Guava's Functions and Predicates for
everything and replace them with the java.util versions. Unfortunately there
does not appear to be an automated tool to do this all at once. Refaster got
close but doesn't seem to care about these particular types of mismatch (I
suspect we're using a different version of the JDK than the outside world;
ours is OK with Guava classes).

This also bumps up Guava to 0.23, which is needed for some new functionality
used in combination with Java 8 features.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170531539
2017-10-04 16:16:45 -04:00
nickfelt
447b83f7db Fix typo in DomainTransferResponse.Builder method namename
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170529902
2017-10-04 16:16:45 -04:00
nickfelt
bc02b701b5 Use transaction time when cloneProjectedAtTime()-ing within transaction
It's bad practice in terms of data model consistency to use DateTime.now(UTC) for cloneProjectedAtTime() within a transactional context - instead, we should always use ofy().getTransactionTime() when it's available.  The ofy transaction time is frozen at the start of the transaction attempt, whereas DateTime.now(UTC) will continue marching ahead.  So using it for a cloneProjectedAtTime() could mean materializing the outcome of logical-time-dependent events (like autorenews, or transfers, or grace period expirations) at a logical time (i.e. commit log time) prior to when they should actually have occurred.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170501277
2017-10-04 16:16:45 -04:00
jianglai
dc41d7923e Remove injectable constructors in metrics library
Users of the client library should be responsible for providing the bindings required. By removing the injectable constructors and named bindings in their parameters, the client library is no longer forcing its users to provide bindings with specific named annotations.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170490834
2017-10-04 16:16:45 -04:00
jianglai
ac0718079d Fix typo
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170487675
2017-10-04 16:16:45 -04:00
mcilwain
f70a7e6342 Upgrade Nomulus to Java8
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170486775
2017-10-04 16:16:45 -04:00
mcilwain
1c4e79f99e Don't allow non-active registrars to create domains or applications
Specifically, this prevents suspended registrars from creating domains or applications. Pending registrars already can't perform these actions because they get an error message when attempting to log in.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170481338
2017-10-04 16:16:45 -04:00