open-vault/vault
Jeff Mitchell af802275bd
Fix response wrapping from K/V version 2 (#4511)
This takes place in two parts, since working on this exposed an issue
with response wrapping when there is a raw body set. The changes are (in
diff order):

* A CurrentWrappingLookupFunc has been added to return the current
value. This is necessary for the lookahead call since we don't want the
lookahead call to be wrapped.

* Support for unwrapping < 0.6.2 tokens via the API/CLI has been
removed, because we now have backends returning 404s with data and can't
rely on the 404 trick. These can still be read manually via
cubbyhole/response.

* KV preflight version request now ensures that its calls is not
wrapped, and restores any given function after.

* When responding with a raw body, instead of always base64-decoding a
string value and erroring on failure, on failure we assume that it
simply wasn't a base64-encoded value and use it as is.

* A test that fails on master and works now that ensures that raw body
responses that are wrapped and then unwrapped return the expected
values.

* A flag for response data that indicates to the wrapping handling that
the data contained therein is already JSON decoded (more later).

* RespondWithStatusCode now defaults to a string so that the value is
HMAC'd during audit. The function always JSON encodes the body, so
before now it was always returning []byte which would skip HMACing. We
don't know what's in the data, so this is a "better safe than sorry"
issue. If different behavior is needed, backends can always manually
populate the data instead of relying on the helper function.

* We now check unwrapped data after unwrapping to see if there were raw
flags. If so, we try to detect whether the value can be unbase64'd. The
reason is that if it can it was probably originally a []byte and
shouldn't be audit HMAC'd; if not, it was probably originally a string
and should be. In either case, we then set the value as the raw body and
hit the flag indicating that it's already been JSON decoded so not to
try again before auditing. Doing it this way ensures the right typing.

* There is now a check to see if the data coming from unwrapping is
already JSON decoded and if so the decoding is skipped before setting
the audit response.
2018-05-10 15:40:03 -04:00
..
acl.go Spelling (#4119) 2018-03-20 14:54:10 -04:00
acl_test.go Spelling (#4119) 2018-03-20 14:54:10 -04:00
audit.go Defer setting views read/write until the end of postUnseal (#4392) 2018-04-19 13:29:43 -04:00
audit_broker.go Errwrap everywhere (#4252) 2018-04-05 11:49:21 -04:00
audit_test.go Move to "github.com/hashicorp/go-hclog" (#4227) 2018-04-02 17:46:59 -07:00
audited_headers.go Errwrap everywhere (#4252) 2018-04-05 11:49:21 -04:00
audited_headers_test.go Add context to the NewSalt function (#4102) 2018-03-08 11:21:11 -08:00
auth.go Defer setting views read/write until the end of postUnseal (#4392) 2018-04-19 13:29:43 -04:00
auth_test.go Port some ent mount changes (#4330) 2018-04-11 14:32:55 -04:00
barrier.go Spelling (#4119) 2018-03-20 14:54:10 -04:00
barrier_access.go Fix compile 2018-01-19 05:31:55 -05:00
barrier_aes_gcm.go Clean up error string formatting (#4304) 2018-04-09 14:35:21 -04:00
barrier_aes_gcm_test.go Move to "github.com/hashicorp/go-hclog" (#4227) 2018-04-02 17:46:59 -07:00
barrier_test.go Add context to storage backends and wire it through a lot of places (#3817) 2018-01-19 01:44:44 -05:00
barrier_view.go Fix race condition caught by detector in barrier view (#4261) 2018-04-03 21:39:11 -04:00
barrier_view_test.go Make mount view read only until after mount persist (#3910) 2018-02-09 14:04:25 -05:00
capabilities.go Kv preflight (#4430) 2018-04-23 15:00:02 -07:00
capabilities_test.go Add context to storage backends and wire it through a lot of places (#3817) 2018-01-19 01:44:44 -05:00
cluster.go Errwrap everywhere (#4252) 2018-04-05 11:49:21 -04:00
cluster_test.go Move to "github.com/hashicorp/go-hclog" (#4227) 2018-04-02 17:46:59 -07:00
core.go physical/cache: Add a list of prefixes to not cache (#4515) 2018-05-10 10:29:26 -07:00
core_test.go Kv preflight (#4430) 2018-04-23 15:00:02 -07:00
cors.go Kv preflight (#4430) 2018-04-23 15:00:02 -07:00
dynamic_system_view.go Core handling of TTLs (#4230) 2018-04-03 12:20:20 -04:00
expiration.go Add ability for revoke-prefix and revoke-force to work on single leases (#4450) 2018-04-26 16:26:07 -04:00
expiration_integ_test.go Don't call LeaseExtend on login renewal paths when period is provided (#3803) 2018-01-18 12:19:18 -05:00
expiration_test.go Add ability for revoke-prefix and revoke-force to work on single leases (#4450) 2018-04-26 16:26:07 -04:00
generate_root.go Errwrap everywhere (#4252) 2018-04-05 11:49:21 -04:00
generate_root_test.go Add context to storage backends and wire it through a lot of places (#3817) 2018-01-19 01:44:44 -05:00
identity_lookup.go Spelling (#4119) 2018-03-20 14:54:10 -04:00
identity_lookup_test.go Pass context to backends (#3750) 2018-01-08 10:31:38 -08:00
identity_store.go disable identity for local mounts (#4407) 2018-04-23 13:46:14 -04:00
identity_store_aliases.go disable identity for local mounts (#4407) 2018-04-23 13:46:14 -04:00
identity_store_aliases_ext_test.go disable identity for local mounts (#4407) 2018-04-23 13:46:14 -04:00
identity_store_aliases_test.go port missed items from identity store to oss (#4242) 2018-04-02 22:17:33 -04:00
identity_store_entities.go Add ability to disable an entity (#4353) 2018-04-13 21:49:40 -04:00
identity_store_entities_ext_test.go Use permission denied for entity disabling 2018-04-23 16:50:04 -04:00
identity_store_entities_test.go port missed items from identity store to oss (#4242) 2018-04-02 22:17:33 -04:00
identity_store_group_aliases.go disable identity for local mounts (#4407) 2018-04-23 13:46:14 -04:00
identity_store_group_aliases_ext_test.go disable identity for local mounts (#4407) 2018-04-23 13:46:14 -04:00
identity_store_group_aliases_test.go Update group alias by ID (#4237) 2018-04-02 10:42:01 -04:00
identity_store_groups.go Add missing entries in path-help (#4370) 2018-04-17 13:54:04 -04:00
identity_store_groups_ext_test.go external identity groups across mounts (#4365) 2018-04-17 12:01:43 -04:00
identity_store_groups_test.go Pass context to backends (#3750) 2018-01-08 10:31:38 -08:00
identity_store_schema.go External identity groups (#3447) 2017-11-02 16:05:48 -04:00
identity_store_structs.go port missed items from identity store to oss (#4242) 2018-04-02 22:17:33 -04:00
identity_store_test.go AppRole/Identity: Fix for race when creating an entity during login (#3932) 2018-02-09 10:40:56 -05:00
identity_store_upgrade.go Pass context to backends (#3750) 2018-01-08 10:31:38 -08:00
identity_store_util.go Add identity store nil checks 2018-04-24 23:10:22 -04:00
init.go Errwrap everywhere (#4252) 2018-04-05 11:49:21 -04:00
init_test.go Move to "github.com/hashicorp/go-hclog" (#4227) 2018-04-02 17:46:59 -07:00
keyring.go Errwrap everywhere (#4252) 2018-04-05 11:49:21 -04:00
keyring_test.go Spelling (#4119) 2018-03-20 14:54:10 -04:00
logical_cubbyhole.go Errwrap everywhere (#4252) 2018-04-05 11:49:21 -04:00
logical_cubbyhole_test.go Add context to storage backends and wire it through a lot of places (#3817) 2018-01-19 01:44:44 -05:00
logical_passthrough.go Errwrap everywhere (#4252) 2018-04-05 11:49:21 -04:00
logical_passthrough_test.go Add context to storage backends and wire it through a lot of places (#3817) 2018-01-19 01:44:44 -05:00
logical_system.go Fix response wrapping from K/V version 2 (#4511) 2018-05-10 15:40:03 -04:00
logical_system_helpers.go Port some ent mount changes (#4330) 2018-04-11 14:32:55 -04:00
logical_system_integ_test.go Resultant acl (#4386) 2018-04-20 14:19:04 -04:00
logical_system_test.go Rename up path to internal/ui/mounts/<path> (#4435) 2018-04-23 18:16:10 -04:00
mount.go Defer setting views read/write until the end of postUnseal (#4392) 2018-04-19 13:29:43 -04:00
mount_test.go Port some ent mount changes (#4330) 2018-04-11 14:32:55 -04:00
plugin_catalog.go Errwrap everywhere (#4252) 2018-04-05 11:49:21 -04:00
plugin_catalog_test.go Spelling (#4119) 2018-03-20 14:54:10 -04:00
plugin_reload.go Errwrap everywhere (#4252) 2018-04-05 11:49:21 -04:00
policy.go Errwrap everywhere (#4252) 2018-04-05 11:49:21 -04:00
policy_store.go Resultant acl (#4386) 2018-04-20 14:19:04 -04:00
policy_store_test.go Fix output-related tests (#4288) 2018-04-05 20:43:29 -04:00
policy_test.go Fix output-related tests (#4288) 2018-04-05 20:43:29 -04:00
rekey.go Errwrap everywhere (#4252) 2018-04-05 11:49:21 -04:00
rekey_test.go Move to "github.com/hashicorp/go-hclog" (#4227) 2018-04-02 17:46:59 -07:00
request_forwarding.go Move to "github.com/hashicorp/go-hclog" (#4227) 2018-04-02 17:46:59 -07:00
request_forwarding_service.pb.go Revert "proto changes (#4503)" (#4504) 2018-05-03 15:38:53 -04:00
request_forwarding_service.proto Add replication state to EchoReply (#3810) 2018-01-17 22:17:47 -05:00
request_handling.go Fix response wrapping from K/V version 2 (#4511) 2018-05-10 15:40:03 -04:00
request_handling_test.go Add context to storage backends and wire it through a lot of places (#3817) 2018-01-19 01:44:44 -05:00
rollback.go Move to "github.com/hashicorp/go-hclog" (#4227) 2018-04-02 17:46:59 -07:00
rollback_test.go Move to "github.com/hashicorp/go-hclog" (#4227) 2018-04-02 17:46:59 -07:00
router.go Kv preflight (#4430) 2018-04-23 15:00:02 -07:00
router_access.go Sync 2017-10-23 15:35:28 -04:00
router_ext_test.go Remove old workaround for a rollback error (#4206) 2018-03-27 16:34:06 -04:00
router_test.go Move to "github.com/hashicorp/go-hclog" (#4227) 2018-04-02 17:46:59 -07:00
seal.go Errwrap everywhere (#4252) 2018-04-05 11:49:21 -04:00
seal_access.go Remove context from a few extraneous places 2018-01-19 03:44:06 -05:00
seal_test.go Use atomic values in seal to avoid some data races (#4040) 2018-02-23 17:18:48 -05:00
seal_testing.go Use atomic values in seal to avoid some data races (#4040) 2018-02-23 17:18:48 -05:00
sealunwrapper.go Errwrap everywhere (#4252) 2018-04-05 11:49:21 -04:00
sealunwrapper_test.go Move to "github.com/hashicorp/go-hclog" (#4227) 2018-04-02 17:46:59 -07:00
testing.go Clean up error string formatting (#4304) 2018-04-09 14:35:21 -04:00
token_store.go Add the ability to restrict token usage by IP. Add to token roles. (#4412) 2018-04-21 10:49:16 -04:00
token_store_ext_test.go Add the ability to restrict token usage by IP. Add to token roles. (#4412) 2018-04-21 10:49:16 -04:00
token_store_test.go update token store error assertions (#4485) 2018-04-29 07:47:42 -04:00
ui.go adds ability to override default CSP with warning (#395) 2018-04-03 09:34:14 -05:00
ui_test.go Fix compilation and tests failures (#4254) 2018-04-03 14:07:43 -04:00
util.go Removed unused methods 2017-01-03 12:51:35 -05:00
util_test.go Utility Enhancements 2016-04-05 20:32:59 -04:00
wrapping.go Allow returning warnings and other data in 404s in the Go API (#4256) 2018-04-03 22:35:45 -04:00