google-nomulus/javatests/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 Add @VirtualEntity checking to Ofy's deleteWithoutBackup() 2017-02-08 17:31:07 -05:00
batch Refer to Datastore everywhere correctly by its capitalized form 2017-02-17 12:12:12 -05:00
bigquery 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 Remove unnecessary line to load configs 2017-02-27 11:07:40 -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
export Add Cloud KMS based secret storage 2017-02-17 12:22:12 -05:00
flows Improve handling of lastSubordinateChange and beef up tests 2017-02-17 12:23:36 -05:00
groups Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
keyring/kms Fix bugs in KmsConnectionImpl 2017-03-07 13:25:51 -05:00
mapreduce/inputs Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
model Rewrite ServerSecret caching and accessor logic 2017-03-07 13:30:18 -05:00
module Fix stale doPost references in servlet test method names 2017-02-27 11:15:01 -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 Make RdeUploadActionTest compatible with IPv6-only mode 2017-03-07 13:19:56 -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
server Refer to Datastore everywhere correctly by its capitalized form 2017-02-17 12:12:12 -05:00
storage/drive Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
testing Perform minor refactors on premium list code 2017-02-27 11:30:45 -05:00
tldconfig/idn Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
tmch Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
tools Perform minor refactors on premium list code 2017-02-27 11:30:45 -05:00
ui Refactor a few new XsrfTokenManager methods 2017-03-07 13:24:21 -05:00
util Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
whois Tighten up restrictions on domain/host naming on EPP resources 2017-02-07 13:29:03 -05:00
xjc Add mapper to import domains from RDE deposits 2017-02-06 16:46:46 -05:00
xml Update copyright year on all license headers 2017-02-02 16:27:22 -05:00