Commit graph

4503 commits

Author SHA1 Message Date
gbrodman
4e62a8139c Refine error handling in RequestHandler and the console slightly (#2177)
If we don't explicitly handle random unexpected exceptions, the error
that the front end receives includes a big ole stacktrace, which is
unhelpful for regular users and possibly bad to expose. Instead, we
should provide a vague "something went wrong" message.

Separately, we can create a default SnackBar options and use that (we
want it longer than 1.5 seconds because that's pretty short).
2023-10-12 14:03:12 -04:00
Lai Jiang
5ff5716953 Remove OAuthAuthenticationMechanism (#2171)
Also made some refactoring to various Auth related classes to clean up things a bit and make the logic less convoluted:

1. In Auth, remove AUTH_API_PUBLIC as it is only used by the WHOIS and EPP endpoints accessed by the proxy. Previously, the proxy relies on OAuth and its service account is not given admin role (in OAuth parlance), so we made them accessible by a public user, deferring authorization to the actions themselves. In practice, OAuth checks for allowlisted client IDs and only the proxy client ID was allowlisted, which effectively limited access to only the proxy anyway.

2. In AuthResult, expose the service account email if it is at APP level. RequestAuthenticator will print out the auth result and therefore log the email, making it easy to identify which account was used. This field is mutually exclusive to the user auth info field. As a result, the factory methods are refactored to explicitly create either APP or USER level auth result.

3. Completely re-wrote RequestAuthenticatorTest. Previously, the test mingled testing functionalities of the target class with testing how various authentication mechanisms work. Now they are cleanly decoupled, and each method in RequestAuthenticator is tested individually.

4. Removed nomulus-config-production-sample.yaml as it is vastly out of date.
2023-10-11 19:12:26 -04:00
Lai Jiang
6dc97ca3a8 Remove the GAIA ID column from the User table (#2172)
The field has already been removed from the Java code base in #2170.
2023-10-11 12:47:48 -04:00
gbrodman
e849a26c72 Fix minor alignment issue on console WHOIS page (#2166) 2023-10-11 09:25:05 -04:00
Weimin Yu
9e3ddee017 Make sure unsafe names can be sent in emails (#2169)
Surround the dot in unsafe domain names with a square bracket. This
is suggested by Gmail abuse-detection and allows outgoing messages
to pass Gmail's check. This should also help with recipients' checks.
2023-10-05 11:19:31 -04:00
Lai Jiang
fda325bb98 Replace JacksonFactory with GsonFactory (#2173)
JacksonFactory is deprecated and GsonFactory is the recommended
replacement.
2023-10-04 17:02:13 -04:00
Lai Jiang
1f585ef245 Remove the GAIA ID field from User (#2170)
It is not used and it is not possible to derive the GAIA ID when
creating a new User from the email address alone.
2023-10-04 15:32:03 -04:00
Weimin Yu
811c9c7ccc Throttle outgoing emails (#2168)
Adds a delay between emails sent in a tight loop. This helps avoid
triggering Gmail abuse detections.

Also updated the recipient address for billing alerts.
2023-10-04 11:16:56 -04:00
Pavlo Tkach
91e39c4c6c Add dark theme support to the console (#2167) 2023-10-03 15:54:25 -04:00
Pavlo Tkach
7b873395fa Add console registrars paging, fix empty registrars mobile (#2162) 2023-10-03 15:51:48 -04:00
sarahcaseybot
a9456693d6 Add custom YAML serializer for Duration (#2161)
* Add custom YAML serializer for Duration

This addresses b/301119144. This changes the YAML representation of a TLD to show Duration fields as a String reperesntation using the Java Duration object's toString() format. This eliminates the previous ambiguity over the time unit that is being used for each duration.

* change standardSeconds to standardMinutes in test

* Add custom serializer to the entire mapper
2023-10-03 13:46:19 -04:00
Lai Jiang
d8024b8e6c Remove unused fields to make the linter happy (#2165) 2023-10-03 13:25:07 -04:00
Pavlo Tkach
163073a8ba Fix console nextUrl stacking routes (#2164) 2023-10-02 17:38:03 -04:00
Lai Jiang
e3041dfc71 Deprecate the OAuth header in Nomulus tool (#2160)
Unless an --oauth flag is used, the nomulus tool will only send the OIDC
header. The server still accepts both headers and the user should use
`create_user` command to create an admin User (with the --oauth flag on), which
will then allow one to use the nomulus tool without the --oauth flag.

The --oauth flag and the server's ability to support OAuth-based
authentication will be removed soon. Users are urged to create the User
object in time to avoid service interruption.

TESTED=verified on alpha.
2023-10-02 15:50:30 -04:00
gbrodman
9ca04ec5a1 Open resources link in new tab (#2163)
We want to do this because it takes the user to an external site, which
could potentially lead to confusion if they tried to use the back button
without a new tab.
2023-10-02 15:06:33 -04:00
Weimin Yu
105258d6c5 Add docs for Cloud Build status notification (#2157)
Add documentation that describes the current Cloud Build status notification
to Google Chat, as well as how to update the configuration and the
notifier service.
2023-09-29 10:49:15 -04:00
gbrodman
5e8035a320 Add page for WHOIS-editable fields in the console (#2155)
This isn't the prettiest thing, but it replicates the type of view /
edit functionality that we had in the original console.

Of note: this doesn't include input field validation, which would
probably be a good idea to add at some point.
2023-09-28 22:46:18 -04:00
Lai Jiang
e293f7a22d Use equals() method to compare equality (#2158)
It will call equalsImmutableObject(), which seems the right thing to do.
We only care if the two Tld objects have the same fields, not if they
are the same object. ErrorProne complained about comparison by identity.
2023-09-28 13:27:36 -04:00
gbrodman
2450699ffb Close sidenav on click (#2156)
It shouldn't stick around after we've clicked on one of the links
2023-09-25 14:43:07 -04:00
sarahcaseybot
8a9d85c4da Add breakglass handling to configureTldCommand (#2154)
* Add a breakglass flag to configureTldCommand

* Add tests

* small fixes
2023-09-22 11:51:02 -04:00
sarahcaseybot
b6e6190478 Change __REMOVEDOMAIN__ token to __REMOVE_BULK_PRICING__ (#2152) 2023-09-21 16:03:39 -04:00
Pavlo Tkach
9f69fabd8c Add resources widget front-end (#2151) 2023-09-21 13:59:40 -04:00
Lai Jiang
c9bf68faac Update proxy k8s manifest (#2153)
The beta API is deprecated.

TESTED=deployed the new manifest to alpha. Without the change, deploying
resulted in an error.

<!-- Reviewable:start -->
- - -
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/google/nomulus/2153)
<!-- Reviewable:end -->
2023-09-21 10:53:39 -04:00
Weimin Yu
4f017eba64 Defend against deserialization-based attacks (#2150)
* Defend against deserialization-based attacks

Added the `SafeObjectInputStream` class that defends attacks using
malformed serialized data, including remote code execution and
denial-of-service attacks.

Started using the new class to handle EPP resource VKeys and
PendingDeposits, which are passed across credential-boundaries: between
TaskQueue and AppEngine server, and between AppEngine server and the RDE
pipeline on GCE. Note that the wireformat of VKeys do not change,
therefore existing tasks sitting in the TaskQueue are not affected.

Also removed an unused class: JaxbFragment.
2023-09-20 16:56:56 -04:00
sarahcaseybot
fb5acfe143 Use PrintStream in ConfirmingCommand (#2140)
* Use PrintStream in ConfirmingCommand

* Add errorPrintStream

* remove unneccesary line
2023-09-19 12:11:18 -04:00
sarahcaseybot
2e94feccf9 Check for diffs in ConfigureTldCommand (#2146)
* Check for diffs in ConfigureTldCommand

* undo override

* Add handling for ordering sets

* Fix comments

* fix formatting

* fix test
2023-09-19 12:10:26 -04:00
gbrodman
47a18034a1 Don't include a nextUrl when accessing the console homepage (#2149)
In this case we should just display the standard page, no need to
redirect anywhere since there's nothing to redirect to.
2023-09-15 12:28:04 -04:00
Lai Jiang
6b316475bd Redact OAuth access token in prod (#2148)
This token is only ever used for logging. The GAE OAuth service will
parse the header directly when called to retrieve the current user and
user id. Logging it in prod could be a security risk if the logs are
leaked.
2023-09-14 13:53:56 -04:00
Pavlo Tkach
d3918e425d Add settings to console home page, update settings->security styles (#2144) 2023-09-14 12:37:54 -04:00
Lai Jiang
f3ef2bb024 Use constant-time comparison when validating client cert hashes (#2147)
Per b/298447714, non-constant-time comparison is prone to brute-force
attacks.
2023-09-14 12:37:20 -04:00
Lai Jiang
8f71faf49b Use Java 11 for CodeQL (#2145) 2023-09-13 12:08:33 -04:00
Lai Jiang
df832506fd Upgrade to gradle 8.3 (#2142) 2023-09-13 11:11:49 -04:00
sarahcaseybot
daae92baaa Disable test failing in cloudbuild (#2143) 2023-09-12 17:06:18 -04:00
Pavlo Tkach
941ceea1b7 Add /console/userdata endpoint (#2137)
Provides initial set of data, necessary to start the UI
2023-09-12 16:29:53 -04:00
gbrodman
dad80a6633 Pass around the full URL in RegistrarGuard (#2139)
Previously this didn't properly deal with nested routings, e.g.
"settings/whois". It tried to just pass "whois" as the next url which
doesn't work with the router because it's nested under the settings.
Using all parts of the URL allows us to handle the nesting.
2023-09-12 15:37:12 -04:00
gbrodman
1ca614c030 Use registrar ID, not name, in selector (#2138) 2023-09-12 14:11:31 -04:00
Lai Jiang
05e13bd904 Make Kythe work with Gradle 8 (#2141)
Mostly implementing the fix suggested by b/294850265. Tested by
submitting a job to GCB which ran successfully.
2023-09-12 10:47:57 -04:00
sarahcaseybot
042e2f166d Add a configureTld command that uses YAML files for configuration (#2117)
* Add a configureTld command that uses YAML

* Add more tests and edge case handling

* Add out of order test and fix wrong inject

* small changes

* Add check for ascii

* Add check for ROID suffix
2023-09-06 16:17:22 -04:00
Pavlo Tkach
d34b18faf6 Add billing details (#2136)
This adds functionality to billing details widget on home screen
2023-09-06 14:37:58 -04:00
Weimin Yu
c79a30232d Disable Hibernate error logging (#2134)
Hibernate logs certain information at the ERROR level, which for the
purpose of troubleshooting is misleading, since most affected operations
succeed after retry. ERROR-level logging should only be added by Nomulus
code.

This PR does two things:
1. Disable all logging in two Hibernate classes: we cannot disable
   logging at a finer granularity, and we cannot preserve lower-level
   logging while disabling ERROR.
2. Adds a DatabaseException which captures all error details that may
   escape the typical loggers' attention: SQLException instances can be
   chained in a different way from Throwable's `getCause()` method.
2023-09-06 13:25:21 -04:00
Pavlo Tkach
2a62159b7a Allow homepage widgets to rearrange on mobile (#2135) 2023-09-05 20:45:13 -04:00
Pavlo Tkach
b9b0419de6 Replace less with scss, add homepage widgets, add registrars selector and registrars page (#2114)
* Replace less compiler with scss

* Replace less with scss, add homepage widgets, add registrars selector and registrars page
2023-09-01 11:48:30 -04:00
Ben McIlwain
257bb2c0b7 Better configure DocumentBuilderFactory to help prevent XXE (#2132)
For more information see: https://community.veracode.com/s/article/Java-Remediation-Guidance-for-XXE
2023-08-30 10:17:37 -04:00
sarahcaseybot
3a38e03a08 Only allow CREATE EPP commands on BULK_PRICING tokens (#2131)
* Only allow CREATE EPP commands on BULK_PRICING tokens

* small fixes
2023-08-29 16:00:29 -04:00
Weimin Yu
75567e8b96 Use gmail to send invoices (#2130) 2023-08-29 14:25:54 -04:00
Ben McIlwain
7ae2f50afd Add a new MutatingFlow interface and make most flows use TransactionalFlow (#2129)
The old semantics for TransactionalFlow meant "anything that needs to mutate the
database", but then FlowRunner was not creating transactions for
non-transactional flows even though nearly every flow needs a transaction (as
nearly every flow needs to hit the database for some purpose).  So now
TransactionalFlow simply means "any flow that needs the database", and
MutatingFlow means "a flow that mutates the database". In the future we will
have FlowRunner use a read-only transaction for TransactionalFlow and then a
normal writes-allowed transaction for MutatingFlow. That is a TODO.

This also fixes up some transact() calls inside caches to be reTransact(), as we
rightly can't move the transaction outside them as from some callsites we
legitimately do not know whether a transaction will be needed at all (depending
on whether said data is already in memory). And it removes the replicaTm() calls
which weren't actually doing anything as they were always nested inside of normal
tm()s, thus causing confusion.
2023-08-28 17:04:41 -04:00
Weimin Yu
3b1c51c267 Using Gmail for most use cases (#2126)
* Using Gmail for most use cases
2023-08-28 11:11:59 -04:00
gbrodman
29a694f912 Alphabetize YAML output by property name (#2128)
This makes printing the TLDs prettier and makes it easier to find
fields.
2023-08-25 16:30:37 -04:00
Ben McIlwain
04d61c0eac Add tm().reTransact() methods and refactor away some inner transactions (#2125)
In the future, reTransact() will be the only way to initiate a transaction that
doesn't fail when called inside an outer wrapping transaction (when wrapped,
it's a no-op). It should be used sparingly, with a preference towards
refactoring the code to move transactions outwards (which this PR also
contains).

Note that this PR includes some potential efficiency gains caused by existing
poor use of transactions. E.g. in the file RefreshDnsAction, the existing code
was using two separate transactions to refresh the DNS for domains and hosts
(one is hidden in loadAndVerifyExistence(), whereas now as of this PR it has a
single wrapping transaction to do so.
2023-08-25 14:03:25 -04:00
Ben McIlwain
0695b23932 Remove a couple unnecessary inner transact() calls (#2124)
Also refactors a function to no longer unnecessarily return a low level Iterable
type.
2023-08-24 18:10:44 -04:00