399 Commits

Author SHA1 Message Date
Jim Kalafut
bf549d30d2
Add fields to support UI/display uses, along with OpenAPI mappings (#6082) 2019-01-29 15:35:37 -08:00
Jeff Mitchell
57a316c271
First part of perf standby entity race fix (#6106) 2019-01-25 14:08:42 -05:00
Thomas L. Kula
8a43842b6d Incredibly tiny comment fix on secret.go (#6078) 2019-01-21 16:57:39 -05:00
Jim Kalafut
fb5eb3509a
Add Sprintf capability to logical.ErrorResponse (#6076)
Roughly 25% of calls to logical.ErrorResponse() include an inner fmt.Sprintf() call.
This PR would simplify these cases:

`return logical.ErrorResponse(fmt.Sprintf("unable to read role '%s'", role))`

  could become

`return logical.ErrorResponse("unable to read role '%s'", role)`

With only a single parameter passed in, behavior is unchanged.
2019-01-18 15:12:38 -08:00
Jim Kalafut
8017af2504
Support for AllowedValues in FieldSchema (#6008)
Currently used for enum output in OpenAPI.
2019-01-08 16:50:24 -08:00
Jim Kalafut
a54603039d Run goimports across the repository (#6010)
The result will still pass gofmtcheck and won't trigger additional
changes if someone isn't using goimports, but it will avoid the
piecemeal imports changes we've been seeing.
2019-01-08 16:48:57 -08:00
Jim Kalafut
cefe45d3e2
Add tests for OpenAPI operation ids (#5998) 2019-01-04 11:46:54 -08:00
Jeff Mitchell
ca55573d38
Strip empty strings from database revocation stmts (#5955)
* Strip empty strings from database revocation stmts

It's technically valid to give empty strings as statements to run on
most databases. However, in the case of revocation statements, it's not
only generally inadvisable but can lead to lack of revocations when you
expect them. This strips empty strings from the array of revocation
statements.

It also makes two other changes:

* Return statements on read as empty but valid arrays rather than nulls,
so that typing information is inferred (this is more in line with the
rest of Vault these days)

* Changes field data for TypeStringSlice and TypeCommaStringSlice such
that a client-supplied value of `""` doesn't turn into `[]string{""}`
but rather `[]string{}`.

The latter and the explicit revocation statement changes are related,
and defense in depth.
2018-12-14 09:12:26 -05:00
Jim Kalafut
ffb61ea5f7
Add operationId field to OpenAPI output (#5876)
Fixes #5842
2018-12-12 13:59:23 -08:00
Brian Kassouf
e9b8dffd76
fix panic when listing nil resp (#5886) 2018-12-03 09:18:28 -08:00
Becca Petrin
fb89af7cfa
Run all builtins as plugins (#5536) 2018-11-06 17:21:24 -08:00
Jim Kalafut
583003cf42
Update OpenAPI path parsing of alternation parameters (#5710)
This will handle patterns of the form:
  `^plugins/catalog/(?P<type>auth|database|secret)/(?P<name>.+)$`
2018-11-06 15:04:30 -08:00
Jim Kalafut
35328c50e7
Framework and API changes to support OpenAPI (#5546) 2018-11-05 12:24:39 -08:00
Vishal Nayak
448eb98987
Remove namespace.TestContext and namespace.TestNamespace (#5682) 2018-11-05 11:11:32 -05:00
Vishal Nayak
9a222b0faf
Allow @ to be part of key name in TOTP secret engine (#5652)
* Allow @ to be part of key name in TOTP secret engine

* Allow @ for key name while generating the code
2018-10-31 12:57:18 -04:00
Jeff Mitchell
9975ace215
Add token type to sentinel docs, fix up some names, and better codify what Sentinel reports for various token types (#5630) 2018-10-27 11:07:27 -07:00
Matthew Irish
8c78bb54b2 Merge branch 'oss-master' into 1.0-beta-oss 2018-10-19 20:40:36 -05:00
Brian Kassouf
3dcb20fdd2
Plugin version negotiation (#5434)
* Plugin version updates

* Update datatbase plugins

* Revert netRPC deletions

* Revert netRPC deletions

* Update plugins to serve both versions

* Update database plugins

* Add Initialize back in

* revert pointer changes

* Add deprecation warning

* Update tests

* Update go-plugin

* Review Feedback
2018-10-19 15:56:17 -07:00
Jeff Mitchell
231c325770 Merge branch 'master-oss' into 1.0-beta-oss 2018-10-16 10:08:03 -04:00
Calvin Leung Huang
334e43a646
Update field data behavior (#5489)
* Update Get and getPrimitive to correctly handle nil and error values

* Return empty slice on zero length decode result
2018-10-15 10:36:13 -07:00
Jeff Mitchell
a58d313d2b
Batch tokens (#755) 2018-10-15 12:56:24 -04:00
Joel Thompson
0510b7ec35 logical/aws: Harden WAL entry creation (#5202)
* logical/aws: Harden WAL entry creation

If AWS IAM user creation failed in any way, the WAL corresponding to the
IAM user would get left around and Vault would try to roll it back.
However, because the user never existed, the rollback failed. Thus, the
WAL would essentially get "stuck" and Vault would continually attempt to
roll it back, failing every time. A similar situation could arise if the
IAM user that Vault created got deleted out of band, or if Vault deleted
it but was unable to write the lease revocation back to storage (e.g., a
storage failure).

This attempts to harden it in two ways. One is by deleting the WAL log
entry if the IAM user creation fails. However, the WAL deletion could
still fail, and this wouldn't help where the user is deleted out of
band, so second, consider the user rolled back if the user just doesn't
exist, under certain circumstances.

Fixes #5190

* Fix segfault in expiration unit tests

TestExpiration_Tidy was passing in a leaseEntry that had a nil Secret,
which then caused a segfault as the changes to revokeEntry didn't check
whether Secret was nil; this is probably unlikely to occur in real life,
but good to be extra cautious.

* Fix potential segfault

Missed the else...

* Respond to PR feedback
2018-09-27 09:54:59 -05:00
Jeff Mitchell
e7c4158e60 Fix compilation/protobuf 2018-09-22 17:58:39 -04:00
andrejvanderzee
b194b27e2d Fix for using ExplicitMaxTTL in auth method plugins. (#5379)
* Fix for using ExplicitMaxTTL in auth method plugins.

* Reverted pb.go files for readability of PR.

* Fixed indenting of comment.

* Reverted unintended change by go test.
2018-09-21 14:31:29 -07:00
Jeff Mitchell
f9d85c3d68 BoundCidrs -> BoundCIDRs 2018-09-20 12:45:49 -04:00
Clint
f39bafbf9c
Translate AWS Rate limiting errors to 502 errors (#5270)
* Initial implemntation of returning 529 for rate limits

- bump aws iam and sts packages to v1.14.31 to get mocking interface
- promote the iam and sts clients to the aws backend struct, for mocking in tests
- this also promotes some functions to methods on the Backend struct, so
  that we can use the injected client

Generating creds requires reading config/root for credentials to contact
IAM. Here we make pathConfigRoot a method on aws/backend so we can clear
the clients on successful update of config/root path. Adds a mutex to
safely clear the clients

* refactor locking and unlocking into methods on *backend

* refactor/simply the locking

* check client after grabbing lock
2018-09-18 15:26:06 -05:00
Jeff Mitchell
b7d6d55ac1
The big one (#5346) 2018-09-17 23:03:00 -04:00
Clint Shryock
c5ad933ab0
Add error logical.ErrUpstreamRateLimited and return 502 from RespondCommonError 2018-09-05 11:07:50 -05:00
Jeff Mitchell
2d9ed65175
Re-add injecting into top routes (#5244) 2018-09-05 11:45:17 -04:00
Jeff Mitchell
b80170787b Move sort from listresponse to file backend to solve 5141 2018-08-24 13:37:15 -04:00
Jeff Mitchell
c3eae776e2
Order list responses (#5178)
We do this already in the CLI, but because we do it there the UI doesn't
have ordered responses.

We could put it in the UI, but it seems like we might as well just make
it nice for all API users.

Fixes #5141
2018-08-24 13:31:28 -04:00
Jeff Mitchell
9cf497f688 Remove injection into top routes (#5101) 2018-08-14 15:29:22 -04:00
Becca Petrin
13a2bb152e
Add a header type field (#4993) 2018-08-13 11:02:44 -07:00
Jeff Mitchell
a8c1f7bed5 Port over ns identity proto info 2018-08-10 12:45:34 -04:00
Jim Kalafut
bb180b8661
Add PluginEnv to SystemView (#5028) 2018-08-03 09:32:17 -07:00
Jeff Mitchell
b9adaf9c69 Add request timeouts in normal request path and to expirations (#4971)
* Add request timeouts in normal request path and to expirations

* Add ability to adjust default max request duration

* Some test fixes

* Ensure tests have defaults set for max request duration

* Add context cancel checking to inmem/file

* Fix tests

* Fix tests

* Set default max request duration to basically infinity for this release for BC

* Address feedback
2018-07-24 14:50:49 -07:00
Jeff Mitchell
24b032aad5
Pass identity metadata through to plugins (#4967)
It's not obvious why this should be secret, and if it were considered
secret, when and what anything would ever be allowed to access it.
Likely the right way to tie secret values to particular
entities/aliases/groups would be to use the upcoming templated ACL
feature.
2018-07-23 12:45:06 -04:00
Brian Kassouf
e3dc93c50c plugins: Allow the server to receive large messages (#4958) 2018-07-20 14:11:00 -04:00
Becca Petrin
d78934de05 Disallow negative TypeDurationSecond (#4910)
* add mount ttl helper

* disallow negative TypeDurationSecond values
2018-07-17 17:46:03 -07:00
Jeff Mitchell
5269abb64c Fix tests 2018-07-12 10:18:50 -04:00
Jeff Mitchell
a831fb4c5a Make single-lease revocation behave like expiration (#4883)
This change makes it so that if a lease is revoked through user action,
we set the expiration time to now and update pending, just as we do with
tokens. This allows the normal retry logic to apply in these cases as
well, instead of just erroring out immediately. The idea being that once
you tell Vault to revoke something it should keep doing its darndest to
actually make that happen.
2018-07-11 15:45:35 -04:00
Jeff Mitchell
ff8becca15 Make proto
It appears the only thing that actually change is that the tag got
`proto3` values added.
2018-07-10 20:49:48 -04:00
Seth Vargo
8ac73469a3 Handle multierr when altering response codes (#4881) 2018-07-09 13:08:44 -07:00
Becca Petrin
b3a711d717 Add bound cidrs to tokens in AppRole (#4680) 2018-06-19 22:57:11 -04:00
Jeff Mitchell
765fe529d6
Changes the way policies are reported in audit logs (#4747)
* This changes the way policies are reported in audit logs.

Previously, only policies tied to tokens would be reported. This could
make it difficult to perform after-the-fact analysis based on both the
initial response entry and further requests. Now, the full set of
applicable policies from both the token and any derived policies from
Identity are reported.

To keep things consistent, token authentications now also return the
full set of policies in api.Secret.Auth responses, so this both makes it
easier for users to understand their actual full set, and it matches
what the audit logs now report.
2018-06-14 09:49:33 -04:00
Jeff Mitchell
e1a89e0d55
Some atomic cleanup (#4732)
Taking inspiration from
https://github.com/golang/go/issues/17604#issuecomment-256384471
suggests that taking the address of a stack variable for use in atomics
works (at least, the race detector doesn't complain) but is doing it
wrong.

The only other change is a change in Leader() detecting if HA is enabled
to fast-path out. This value never changes after NewCore, so we don't
need to grab the read lock to check it.
2018-06-09 15:35:22 -04:00
Jeff Mitchell
a73d55b591
Move TokenEntry into logical. (#4729)
This allows the HTTP logicalAuth handler to cache the value in the
logical.Request, avoiding a lookup later when performing acl
checks/counting a use.
2018-06-08 17:24:27 -04:00
Jeff Mitchell
cc003bb239 Offline token revocation fix 2018-06-05 18:53:27 -04:00
Chris Hoffman
3b1ade706c
adding option go_package to protos (#4687)
* adding option go_package to protos

* switching proto output dir to relative paths
2018-06-04 10:19:26 -04:00
Chris Hoffman
51bc3d8891
Add entity information request to system view (#4681)
* Add entity information request to system view

* fixing a few comments

* sharing types between plugin and logical

* sharing types between plugin and logical

* fixing output directory for proto

* removing extra replacement

* adding mount type lookup

* empty entities return nil instead of error

* adding some comments
2018-06-03 20:48:12 -04:00