google-nomulus/java/google/registry
nickfelt 2e969d6ed1 Change XsrfTokenManager to support new HMAC token format
This follows up on Brian's work to transition not just to a new format
with an empty scope value, but instead to replace the existing format
entirely with a new one that:

  1) includes a version number to support future format migrations
  2) doesn't include a field for the scope at all, since scoping the
     tokens adds no real security benefit and just makes verification
     more difficult
  3) replaces the raw SHA-256 hash with a SHA-256 HMAC instead, as a
     best practice to avoid length-extension attacks [1], even though
     in our particular case they would only be able to extend the
     timestamp and would thus be relatively innocuous

The new format will be produced by calling generateToken(), and the
scope-accepting version is renamed to generateLegacyToken() in addition
to its existing deprecation, for maximum clarity.

I changed the validateToken() logic to stop accepting a scope entirely;
when validating a legacy-style token, we'll test it against the two
existing legacy scope values ("admin" and "console") and accept it if
it matches either one.

Note that this means the xsrfScope parameter in @Action is now wholly
obsolete; I'll remove it in a follow-up to avoid bringing extra files
into this CL.

After this CL hits production, the next one will replace all calls to
generateLegacyToken() with generateToken().  Once that CL is deployed,
the last step will be removing the legacy fallback in validateToken().

[1] See https://en.wikipedia.org/wiki/Length_extension_attack

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=148936805
2017-03-07 13:31:46 -05:00
..
backup Refer to Datastore everywhere correctly by its capitalized form 2017-02-17 12:12:12 -05:00
batch Replace 'host.getSubordinateHost() != null' with 'host.isSubordinate()' 2017-02-06 16:45:23 -05:00
bigquery Change BigQuery call from update to patch 2017-02-06 16:45:23 -05:00
braintree Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
builddefs Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
config Add missing newline to default-config.yaml 2017-03-07 13:22:52 -05:00
cron Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
dns Refer to Datastore everywhere correctly by its capitalized form 2017-02-17 12:12:12 -05:00
eclipse Restructure Maven dependencies in build 2017-01-09 11:59:04 -05:00
env Refer to Datastore everywhere correctly by its capitalized form 2017-02-17 12:12:12 -05:00
export Refer to Datastore everywhere correctly by its capitalized form 2017-02-17 12:12:12 -05:00
flows Remove duplicate version of lookupSuperordinateDomain() function 2017-03-07 13:12:09 -05:00
gcs Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
groups Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
idn Run buildifier on codebase to format BUILD files 2016-11-28 18:15:21 -05:00
keyring Fix bugs in KmsConnectionImpl 2017-03-07 13:25:51 -05:00
loadtest Change XsrfTokenManager to support new HMAC token format 2017-03-07 13:31:46 -05:00
mapreduce Refer to Datastore everywhere correctly by its capitalized form 2017-02-17 12:12:12 -05:00
model Rewrite ServerSecret caching and accessor logic 2017-03-07 13:30:18 -05:00
module Remove Builder type param on RequestComponentBuilder/RequestHandler 2017-02-27 11:12:07 -05:00
monitoring Re-add some accidentally removed license headers 2017-02-06 16:45:23 -05:00
pricing Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
rdap Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
rde Remove duplicate version of lookupSuperordinateDomain() function 2017-03-07 13:12:09 -05:00
request Change XsrfTokenManager to support new HMAC token format 2017-03-07 13:31:46 -05:00
security Change XsrfTokenManager to support new HMAC token format 2017-03-07 13:31:46 -05:00
storage/drive Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
tldconfig/idn Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
tmch Refer to Datastore everywhere correctly by its capitalized form 2017-02-17 12:12:12 -05:00
tools Change XsrfTokenManager to support new HMAC token format 2017-03-07 13:31:46 -05:00
ui Change XsrfTokenManager to support new HMAC token format 2017-03-07 13:31:46 -05:00
util Refer to Datastore everywhere correctly by its capitalized form 2017-02-17 12:12:12 -05:00
whois Refer to Datastore everywhere correctly by its capitalized form 2017-02-17 12:12:12 -05:00
xjc Add mapper to import domains from RDE deposits 2017-02-06 16:46:46 -05:00
xml Replace Throwables.propagate and variants with Guava 20 versions 2017-02-02 17:01:23 -05:00
BUILD Move the environment configuration YAML files into the main JAR 2017-02-06 16:46:52 -05:00
repositories.bzl Set generates_api=1 for Dagger component processor 2017-03-07 13:27:21 -05:00