Commit graph

1138 commits

Author SHA1 Message Date
mcilwain
3ca9bb6aeb Read from bloom filter for premium pricing checks
This also cleans up the PremiumList API so that it only has one
method for checking premium prices, which is by TLD, rather than two.

I will be refactoring a lot of the static methods currently residing in
the PremiumList class into a separate utils class, but I don't want to
include too many changes in this one CL.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=148475345
2017-02-27 11:22:21 -05:00
mountford
3ac74fa449 Add more tests to new authentication framework
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=148459400
2017-02-27 11:19:27 -05:00
mcilwain
dd400f30f5 Don't allow duplicates in premium/reserved lists
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=148458642
2017-02-27 11:17:58 -05:00
nickfelt
ea3a8dfa9d Make Router reject classes with no @Action-returning methods
This provides a safeguard against using TypeInstantiator to resolve the component class, where if resolution is done incorrectly, you end up with java.lang.Object.  Formerly, that would have "succeeded" in generating a Router for Object, which of course has no methods that return @Action classes.  Such a router is pretty useless, so it's better to make Router stricter and have it fail if you give it such a class by accident.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=148353224
2017-02-27 11:16:30 -05:00
nickfelt
1e7fc4d64d Remove Builder type param on RequestComponentBuilder/RequestHandler
It turns out this type parameter was never necessary.  A builder only needs the reflexive second type parameter when you want to have a builder inheritance hierarchy where the descendant builders have methods that the ancestor builder doesn't.  In that case, the type param enables the ancestor builder's setter methods to automatically return the correct derived type, so that if you start with a derived builder, you can call a setter method inherited from an ancestor and then continue the chain with setters from the derived builder (e.g. new ContactResource.Builder().setCreationTime(now).setContactId(), which otherwise would have returned an EppResource.Builder from setCreationTime(), at which point the call to setContactId() would not compile).

Even then, it's not strictly necessary to use the type parameter, since you could instead just have each derived type override every inherited method to specify itself as the return type.  But that would be a lot of extra boilerplate and brittleness.

Anyway, in this case, there is a builder hierarchy, but RequestComponentBuilder specifies all the methods that we're ever going to want on our builders, so there's never any need to be able to call specific derived builder methods.  We only even need the individual builder classes so that Dagger can generate them separately for each component.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=148269178
2017-02-27 11:12:07 -05:00
nickfelt
16832323d0 Make ListObjectsAction return 200 when sending JSON error
This fixes a bug in the interaction between ListObjectsAction and ListObjectsCommand/AppEngineConnection.  ListObjectsAction was returning HTTP status code 400 when it caught an IAE, but also attempting to return a JSON response payload of {"status": "error", "error": "<exception message>"}.  However, AppEngineConnection treats any HTTP error response as more like a crash on the server side - it attempts to scrape the error message out of the autogenerated HTML that AppEngine produces for uncaught exceptions, and throws an exception, killing ListObjectsCommand before it can extract the JSON which contains the nicer error (that stating the missing field, etc versus just "400 Bad Request").

The fix is just to have ListObjectsAction return a 200 and the error message so that ListObjectsCommand can correctly handle it.

I also de-scoped the catch to only catching IAE, since catching Exception was overbroad, and the only "expected" exception to be thrown is an IAE from the checkArgument() that tests if the requested fields all exist.  Any other kinds of exceptions should actually just bubble up and kill the action, and get the regular AppEngineConnection error treatment.

I also added "billingId" as an alias for "billingIdentifier", parallel to clientId/clientIdentifier, since that's why I came across this issue in the first place.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=148248834
2017-02-27 11:10:37 -05:00
mmuller
acc7d19106 Put the path to client_secrets in a config option.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=148214513
2017-02-22 11:49:03 -05:00
mmuller
68bac57da5 Store credentials under scope-qualified name
Store the auth credentials under a name qualified by the set of OAuth scopes
as well as the client id.  This is implemented as the base64 encoded SHA1 hash
of the concatenation of client id and sorted auth scopes.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=148127911
2017-02-22 11:47:37 -05:00
ctingue
b3b4bba9aa Align parameter formats for zone data commands
Seems silly that one command uses --tlds for the required parameter, while the other one doesn't.

As part of this change, create a DateParameter for commands that require only a date (i.e. a DateTime parameter restricted to midnight UTC).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=148106721
2017-02-22 11:46:07 -05:00
mountford
0417f3d3a1 Daggerize XsrfTokenManager
The one-day validity period is also moved from the caller into XsrfTokenManager.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147857716
2017-02-22 11:43:10 -05:00
ctingue
4a92d97a70 Filter domains w/disallowed statuses from zone file generation MR
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147839827
2017-02-17 12:26:29 -05:00
cgoldfeder
c23bbe35bb Improve handling of lastSubordinateChange and beef up tests
See [] for the comments that led to this.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147796087
2017-02-17 12:23:36 -05:00
shikhman
be30ecdf66 Add Cloud KMS based secret storage
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147791972
2017-02-17 12:22:12 -05:00
mmuller
177bf4a5f1 Add Client-side OAuth2 to HTTP connections
Implement client-side OAuth in non-local HTTP connections.  Also add tests to
verify that the different modes of connection are set up correctly.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147636222
2017-02-17 12:17:53 -05:00
mcilwain
32b236e940 Delete the unsafe DeleteEppResourceCommand
It was somewhat unsafe to run because it bypassed some of the checks
that are usually run when attempting to delete EPP resources. The
DeleteDomainCommand is a recommended replacement that uses SOY templates
to delete a domain using EPP. Similar commands to delete hosts and
contacts can be written if required.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147634146
2017-02-17 12:16:27 -05:00
mcilwain
e8c5720826 Save bloom filters for premium list entries
This is the first step in the migration to remove the need to load all of
the premium list entries every time the cache expires (which causes slow-
downs). Once this is deployed, we can re-save all premium lists, creating
the bloom filters, and then the next step will be to read from them to
more efficiently determine if a label might be premium.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147525017
2017-02-17 12:15:02 -05:00
mcilwain
cdadb54acd Refer to Datastore everywhere correctly by its capitalized form
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147479683
2017-02-17 12:12:12 -05:00
ctingue
e0cb4e465c Fix resource mismatch problem in FixDomainNameserverKeysCommand
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147476075
2017-02-14 12:16:55 -05:00
ctingue
07625ce81b Add history entry to FixDomainNameserverKeysCommand
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147468517
2017-02-14 12:15:29 -05:00
ctingue
53262d82bb Add period restriction to domain flows
Specifically, Domain[Create,Allocate,ApplicationCreate]Flow

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147458283
2017-02-14 12:14:04 -05:00
ctingue
335b3f0cf8 Scrap tool to fix DomainResource keys to deleted nameservers
There are about 25 active domains that have keys that point to deleted nameservers. In all cases, there are active nameservers with the same FQDN that these domains should be pointing to. Given the domains in question (pulled via BigQuery, see the bug), update the domain with the correct keys whenever a deleted host is found.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147346660
2017-02-14 12:08:16 -05:00
ctingue
3ec6c7d346 Fix a few typos
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147187320
2017-02-14 12:06:47 -05:00
mcilwain
dc66cef8ae Add request/auth package to Nomulus release
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147087621
2017-02-14 12:00:49 -05:00
mountford
c41f5bb31c Make first pass at new OAuth-aware server authentication framework
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147081745
2017-02-14 11:59:19 -05:00
ctingue
cb215adac3 Cut over to synthetic OneTime billing events
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147048115
2017-02-09 14:24:42 -05:00
Wolfgang Meyers
da1f83a7b4 Add host linker mapreduce for RDE imports
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147025088
2017-02-09 14:24:27 -05:00
Wolfgang Meyers
6cdb3d81d3 Generate authInfo for imported domains
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146956307
2017-02-08 17:42:57 -05:00
Wolfgang Meyers
b9222759dc Refactor common domain transfer logic into a utility class
These methods will also be used for RDE imports (in a follow-up).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146955581
2017-02-08 17:42:51 -05:00
cgoldfeder
135b1f95f4 Fix a javadoc error
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146934558
2017-02-08 17:42:49 -05:00
mcilwain
590a176100 Remove local server restriction in unit tests config
Unit tests still won't be able to fire up a local server for other
reasons, but it is reasonable to at least allow URLs to be constructed
from within tests so as to be able to make assertions about
conditions that would allow connections to be made successfully.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146917889
2017-02-08 17:42:49 -05:00
shikhman
0916219c3e Fix javadoc placement
The prior placement was error prone.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146825173
2017-02-08 17:42:49 -05:00
mcilwain
fb10005cba Remove unneeded WEB-INF/*.yaml resource paths
The YAML configuration files are now being built directly into the
JAR, and not stored in the WEB-INF/ directory, so this is unnecessary.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146815937
2017-02-08 17:42:49 -05:00
Wolfgang Meyers
60a3d2a53b Synchronize domains with DNS on import
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146813124
2017-02-08 17:42:43 -05:00
nickfelt
5d4a88e5ce Add @VirtualEntity checking to Ofy's deleteWithoutBackup()
This was an oversight I noticed ages ago, so resurrecting some old local changes I had to correct it.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146812322
2017-02-08 17:31:07 -05:00
mcilwain
d2bc569b4b Tighten up restrictions on domain/host naming on EPP resources
All domain/host names should be stored in their canonical forms (puny-
coded and lower-cased). This validation is already in the flows, but
this adds protection against bad data from other sources, e.g. admin
consoles or RDE imports.

This also removes an old work-around that temporarily suspended this
validation for superusers, because we used to have non-canonicalized
data in the system. The non-canonicalized data has since all been
cleaned up, so this work-around is no longer necessary.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146799558
2017-02-07 13:29:03 -05:00
mcilwain
ec55aa5361 Resolve some Guava 20 TODOs (mostly unnecessary asList() calls)
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146799536
2017-02-07 13:27:40 -05:00
mcilwain
f212a53232 Make dependency injection and construction of DnsQueue nicer
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146783008
2017-02-07 13:26:13 -05:00
nickfelt
7986be139d Add @Deprecated to DomainApplication.cloneProjectedAtTime()
DomainApplications have nothing to project, so it's a mistake to call their cloneProjectedAtTime() method.  Marking it @Deprecated helps prevent such inadvertent use.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146716189
2017-02-07 13:24:47 -05:00
mcilwain
bf068e61d9 Move the environment configuration YAML files into the main JAR
This allows configuration to work properly from the nomulus tool.

TESTED=I built and ran it against several environments, and all worked
properly.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146697124
2017-02-06 16:46:52 -05:00
Wolfgang Meyers
a904f2c6ee Add mapper to import domains from RDE deposits
With some additional cleanup by Ben McIlwain.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146695665
2017-02-06 16:46:46 -05:00
mcilwain
d6e6e8a49c Re-add some accidentally removed license headers
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146694719
2017-02-06 16:45:23 -05:00
cgoldfeder
91049d2c53 Replace 'host.getSubordinateHost() != null' with 'host.isSubordinate()'
This is a cleanup in preparation for the next change that does a lot
of work with subordinate hosts, to make it easier to reason about in
complex code.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146689904
2017-02-06 16:45:23 -05:00
nickfelt
07c2dfb976 Reword descriptions on some StatusValues
Follow-up to comments on [] in particular to clarify that INACTIVE can be combined with other statuses and doesn't have any special relationship to OK.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146683905
2017-02-06 16:45:23 -05:00
nickfelt
2a32f9048e Fix CommandUtilities to fail gracefully if stdin is unavailable
Right now, it just NPEs, which is harder to debug.  Also make it handle end-of-input more cleanly by assuming that means a negative response.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146674937
2017-02-06 16:45:23 -05:00
mountford
6fd3592a54 Change BigQuery call from update to patch
For invoicing, we have been using the BigQuery update() call, but it turns out that that's not what we want to do. That replaces all values, clearing out any that you don't specify. What we want is patch(), which updates only the values you specify.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146673068
2017-02-06 16:45:23 -05:00
cgoldfeder
6f00059a80 Make the allowed-on restrictions in StatusValue easier to read
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146671718
2017-02-06 16:45:23 -05:00
mcilwain
8830224cc5 Add MOE equivalence for sync on 2017-02-02
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146422375
2017-02-06 16:45:23 -05:00
mcilwain
61230b035c Finish YAMLification of last necessary config values
There are still some options in RegistryConfig that can't be configured
in YAML, but it's not clear why anyone would need to change them from
their default values.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146482435
2017-02-03 12:37:38 -05:00
mcilwain
4031988409 Fix connection error in nomulus tool caused by YAML configs
This is a temporary work-around that fixes the tool for all of our
environments. Next up I'm working on a generalizable way to get this
working by adding some kind of configuration between environment name
and App Engine project ID. The current configuration system doesn't
quite work for that because it's all based on a separate config per
environment, whereas the tool needs to be able to access all
environments. Either we bundle all configs that currently go into
WEB-INF/ with nomulus and have it select based on the -e flag, or we
make it a separate configuration.

TESTED=I built and ran locally and was able to successfully run
commands against alpha, production, and sandbox.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146481850
2017-02-03 12:36:17 -05:00
mcilwain
8e9b2d3483 Convert Braintree configuration to YAML
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146477578
2017-02-03 12:34:52 -05:00