Commit Graph

17727 Commits

Author SHA1 Message Date
Max Bowsher
188bdca4bd Fix sudo paths missing from OpenAPI and docs (#21772)
* Fix sudo paths missing from OpenAPI and docs

Various sudo (a.k.a. root-protected) paths are implemented in
non-standard ways, and as a result:

* are not declared as x-vault-sudo in the OpenAPI spec

* and as a result of that, are not included in the hardcoded patterns
  powering the Vault CLI `-output-policy` flag

* and in some cases are missing from the table of all sudo paths in the
  docs too

Fix these problems by:

* Adding `seal` and `step-down` to the list of root paths for the system
  backend. They don't need to be there for enforcement, as those two
  special endpoints bypass the standard request handling code, but they
  do need to be there for the OpenAPI generator to be able to know they
  require sudo.

  The way in which those two endpoints do things differently can be
  observed in the code search results for `RootPrivsRequired`:
  https://github.com/search?q=repo%3Ahashicorp%2Fvault%20RootPrivsRequired&type=code

* Fix the implementation of `auth/token/revoke-orphan` to implement
  endpoint sudo requirements in the standard way. Currently, it has an
  **incorrect** path declared in the special paths metadata, and then
  compensates with custom code throwing an error within the request
  handler function itself.

* changelog

* As discussed in PR, delete test which is just testing equality of a constant

* Restore sudo check as requested, and add comment

* Update vault/token_store.go

Co-authored-by: Anton Averchenkov <84287187+averche@users.noreply.github.com>

---------

Co-authored-by: Anton Averchenkov <84287187+averche@users.noreply.github.com>
2023-07-19 16:28:17 +00:00
Paul Banks
def7c1b0a7 Fix drift, these docs are only in ent repo docs so not public (#21941)
* Fix drift, these docs are only in ent repo docs so not public

* Remove newline
2023-07-19 15:17:22 +00:00
Violet Hynes
f54bc0227d Fix broken docs link (#21937)
* Fix broken docs link

* Capitalize
2023-07-19 10:08:12 -04:00
claire bontempo
96bb634422 UI: catch error when verifying certificates with unsupported signature algorithms (#21926)
* wrap verify in a try..catch

* add tests

* add comments and one more test

* add test coverage

* add changelog

* remove link
2023-07-19 00:16:52 +00:00
akshya96
4b15fb96b8 Add re-run fails for release branch PR use case (#21876)
* adding release PR test case

* remove unchanged items

* fixing changes

* testing flag

* fixing wildcards

* fixing if

* fix action lint failures

* fix action lint comparison

* add shellcheck disable

* removing space

* testing change

* adding change for PR usecase

* trigger workflow

* fix filter

* add "
2023-07-18 10:40:48 -07:00
Austin Gebauer
fa094207e7 secrets/azure: update minimal permissions recommendation (#21897) 2023-07-18 09:24:37 -07:00
miagilepner
dc104898f7 VAULT-17660: create CI github comment (#21853)
* fix multiline

* shellcheck, and success message for builds

* add full path

* cat the summary

* fix and faster

* fix if condition

* base64 in a separate step

* echo

* check against empty string

* add echo

* only use matrix ids

* only id

* echo matrix

* remove wrapping array

* tojson

* try echo again

* use jq to get packages

* don't quote

* only run binary tests once

* only run binary tests once

* test what's wrong with the binary

* separate file

* use matrix file

* failed test

* update comment on success

* correct variable name

* bae64 fix

* output to file

* use multiline

* fix

* fix formatting

* fix newline

* fix whitespace

* correct body, remove comma

* small fixes

* shellcheck

* another shellcheck fix

* fix deprecation checker

* only run comments for prs

* Update .github/workflows/test-go.yml

Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com>

* Update .github/workflows/test-go.yml

Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com>

* fixes

---------

Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com>
2023-07-18 17:31:29 +02:00
Max Bowsher
00e13abf1f CreateOperation should only be implemented alongside ExistenceCheck (#18492)
* CreateOperation should only be implemented alongside ExistenceCheck

Closes #12329

Vault treats all POST or PUT HTTP requests equally - they default to
being treated as UpdateOperations, but, if a backend implements an
ExistenceCheck function, CreateOperations can be separated out when the
existence check returns false.

It follows, then, that if a CreateOperation handler is implemented
without an ExistenceCheck function, this is unreachable code - a coding
error. It's a fairly minor error in the grand scheme of things, but it
causes the generated OpenAPI spec to include x-vault-createSupported for
operations on which create can never actually be invoked - and promotes
muddled understanding of the create/update feature.

In this PR:

1) Implement a new test, which checks all builtin auth methods and
   secrets engines can be successfully initialized. (This is important
   to validate the next part.)

2) Expand upon the existing coding error checks built in to
   framework.Backend, adding a check for this misuse of CreateOperation.

3) Fix up instances of improper CreateOperation within the Vault
   repository - just two, transit and mock.

Note: At this point, the newly added test will **fail**.

There are improper uses of CreateOperation in all of the following:

    vault-plugin-auth-cf
    vault-plugin-auth-kerberos
    vault-plugin-auth-kubernetes
    vault-plugin-secrets-ad
    vault-plugin-secrets-gcpkms
    vault-plugin-secrets-kubernetes
    vault-plugin-secrets-kv
    vault-plugin-secrets-openldap
    vault-plugin-secrets-terraform

each of which needs to be fixed and updated in go.mod here, before this
new check can be added.

* Add subtests

* Add in testing of KV v2, which otherwise doesn't get tested

This is a surprisingly complicated special case

* The database plugin needs special handling as well, and add in help invocations of the builtin backends too

* Fix extra package prefix

* Add changelog

* Update 6 out of 9 plugins to needed new versions

Note, this IS an upgrade despite the apparent version numbers going
down. (That's a consequence of slightly odd release management occurring
in the plugin repositories.)

* Update to deal with code changes since branch originally created

* Perform necessary update of vault-plugin-secrets-kubernetes so that CI checks on PR can run

* Fix another instance of incorrect CreateOperation, for a test-only endpoint

By being hidden behind a Go build constraint, it had evaded notice until
now.

* Add an opportunistic test of sys/internal/specs/openapi too
2023-07-18 13:44:15 +01:00
Tom Proctor
a9977fab80 Use config's service registration in test cluster (#21907) 2023-07-18 13:43:34 +01:00
Max Bowsher
3961d7b9cc api: Separate two distinct areas of code that were interleaved in one file (#21906)
This is a code cleanup and addition of an explanatory comment. For some
reason, the code related to the CLI guessing whether a path requires
sudo, has been interleaved into plugin_helpers.go, which was previously
purely code used on the server side in the implementation of Vault
plugins.

This remedies that by dividing the sudo paths code to a separate file,
and adds a comment to plugin_helpers.go providing future readers with
information about the overall theme of the file.

No code has been changed - only moved and documented.
2023-07-18 12:20:34 +01:00
Angel Garbarino
3159aa26be fix (#21901) 2023-07-17 15:55:32 -06:00
Alexander Scheel
4ec5e22ade Fix ACME tidy to not reference acmeContext (#21870)
* Fix ACME tidy to not reference acmeCtx

acmeContext is useful for when we need to reference things with a ACME
base URL, but everything used in tidy doesn't need this URL as it is not
coming from an ACME request.

Refactor tidy to remove references to acmeContext, including dependent
functions in acme_state.go.

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Remove spurious log message

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Draft Tidy Acme Test with Backdate Storage + Backdate Sysxsx

* Fixes to ACME tidy testing

Co-authored-by: kitography <khaines@mit.edu>
Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Correctly set account kid to update account status

Co-authored-by: kitography <khaines@mit.edu>
Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add TestTidyAcmeWithSafetyBuffer

Co-authored-by: kitography <khaines@mit.edu>
Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add test for disabling tidy operation

Co-authored-by: kitography <khaines@mit.edu>
Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add acme_account_safety_buffer to auto-tidy config

Resolve: #21872

Co-authored-by: kitography <khaines@mit.edu>
Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add tests verifying tidy safety buffers

Co-authored-by: kitography <khaines@mit.edu>
Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add changelog entry

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Add account status validations and order cleanup tests

---------

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
Co-authored-by: kitography <khaines@mit.edu>
Co-authored-by: Steve Clark <steven.clark@hashicorp.com>
2023-07-17 14:54:28 -04:00
Nick Cabatoff
d79190808e Update oss go.mod to use same versions as ent go.mod (#21896) 2023-07-17 14:48:37 -04:00
Steven Clark
2ca25af823 make fmt (#21895) 2023-07-17 16:56:28 +00:00
Kuba Wieczorek
661e839906 Go test failure summaries fixes and improvements (#21888) 2023-07-17 15:59:08 +01:00
Rachel Culpepper
71841c51be Vault-17911: add support for hex values in oid extension (#21830)
* add support for hex values in oid extension

* add changelog

* add length check on split and error handling on unmarshal
2023-07-17 10:58:18 -04:00
Terrell Russell
adf0361203 grammar fix (#21607)
to -> into
2023-07-17 10:55:40 -04:00
Hamid Ghaf
f3e9d159d3 report build failures in a PR comment (#21722)
* report build failures in a PR comment

* address action linter

* linter

* add an id

* change permission

* report failure from build yaml

* linter fix

* report workflow url

* reorder jobs

* complete boolean eval

* single quote

* experiment getting failed jobs

* linter

* pass failed jobs one by one

* failed jobs are reported cancelled

* use * instead of @

* some polishing

* find comment ID, create or update it

* some clean up

* missing }
2023-07-17 07:45:32 -07:00
Laurent
366693c78d Add a parameter to allow ExtKeyUsage field usage from a role within ACME (#21702)
* imprv: Add a parameter to allow ExtKeyUsage field usage from a role

* chore: Add the changelog entry

* imprv: Reword UI and changelog

* doc: Add allow_role_extkeyusage in parameter list

* imprv: Align variable names with existing fields/codebase

* Add unit test and tweak some labels

---------

Co-authored-by: Steve Clark <steven.clark@hashicorp.com>
2023-07-17 09:31:13 -04:00
Tom Proctor
5d97159f05 Fix k8s service registration case where Vault fails to unlabel itself as a leader (#21642) 2023-07-17 13:42:32 +01:00
akshya96
e1a9d85a18 Remove caseSensitivityKey invalidation (#20965)
* removing caseSensitivityKey invalidation

* add changelog

* remove caseSensitivityKey

* removing loadCaseSensitivityKeyStore

* add go test to check caseSensitivityKey deletion

* edit return error messages during deletion of caseSensitivityKey

* adding log line to record caseSensitivityKey value

* modifying error check

* addressing comments
2023-07-14 16:10:06 -07:00
Max Coulombe
b9251da337 * wire experiments through options for tests (#21873) 2023-07-14 17:53:10 -04:00
Chelsea Shaw
88ca498fb4 UI/utils cleanup (#21863)
* key-utils: create core addon and tests

* key-util: remove lib/key-utils and replace all imports with core util
2023-07-14 14:45:57 -05:00
Peter Wilson
cc366f6cba VAULT-17074: socket sink node (#21865)
* syslog sink added, options + tests added, tweaks to file sink comments

* defaults for syslog options

* lock around Process

* Comment on 'nil' return for Process, remove buffer
2023-07-14 18:08:58 +00:00
Kuba Wieczorek
80f0015723 Make the test summary steps in the CI fail silently (#21867) 2023-07-14 18:26:38 +01:00
Peter Wilson
f351fe471a VAULT-17075: syslog sink node (#21859)
* syslog sink added, options + tests added, tweaks to file sink comments

* defaults for syslog options
2023-07-14 17:08:25 +00:00
Angel Garbarino
8834e4d16b Add empty state when there are no MFA enforcement targets (#21783)
* add empty state message for when there are no targets

* Update emptystate message

* amend
2023-07-14 17:02:23 +00:00
Chelsea Shaw
25a66dd45a UI: focus navigate-input after automatic page filter (#21767) 2023-07-14 10:19:31 -05:00
Alexander Scheel
8c7e5d7a3a Mark config dirty if read differs from state (#21835)
* Refactor CRL writing config to passthrough cache

When reading the CRL config via API endpoint, always read through to the
disk, updating the cache in the process. Similarly, when writing to the
CRL config, read first from disk (updating the cache), and on write,
also write back through the cache, providing consistency without the
need to invalidate through markConfigDirty(...).

This will form the basis of the new pattern for config caching.

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Refactor ACME writing config to passthrough cache

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

---------

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
2023-07-14 13:12:26 +00:00
Nick Cabatoff
359f1a614f Revert "Add code that would break ent if merged prior to stubmaker (#21634)" (#21693)
This reverts commit 502c2830c0.
2023-07-14 09:05:34 -04:00
Steven Clark
d01f354aa2 Update TestProperAuthing test (#21841)
- Updating existing entries in OSS so that this can be backported.
 - The proper fix on main going forward it to remove these ENT only
   entries and move them into the enterprise only file
2023-07-14 06:56:06 -04:00
Peter Wilson
ba52063705 possible typo/error in sentence - cleared up (#21831) 2023-07-14 10:05:06 +00:00
akshya96
384cdd791c Change github.base_ref to github.ref_name for Vault-17777 (#21840)
* adding ref_name instead of base-ref

* adding quotes

* fixing sheelcheck

* sing =

* disable shellcheck for rerunfails

* some shellcheck changes

* fix comment
2023-07-13 17:14:33 -07:00
Hamid Ghaf
0b0b15f968 fix double unlock issue (#21496) 2023-07-13 20:29:49 +00:00
Peter Wilson
6af5101bd7 VAULT-17073: file sink node (#21817)
* audit file sink node

* Added options for file sink, updated tests,

* Ported benchmark for file

* tests
2023-07-13 20:04:41 +00:00
akshya96
20675ccef0 Add --rerun-fails flag for release branches (#21721)
* add re-run flag for release branches

* testing

* testing with the test ref

* fix test branch name

* adding packages flag

* fix package names

* joining package names

* fixing EOF error

* fixing packages syntax

* fix syntax

* fixing syntax

* syntax fix

* fix syntax

* moving flag

* test command

* testing success case

* original changes

* Update .github/workflows/test-go.yml

Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com>

* Update .github/workflows/test-go.yml

Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com>

---------

Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com>
2023-07-13 12:49:17 -07:00
malinac02
b543d534a7 UI: Fix styling for username input when editing a user (#21771)
* changed form-field-groups.hbs to show a disabled text book for username when editing a user

* reverted the change in form-field-groups.hbs. Instead changed the CSS for readonly to match the CSS of disabled in inputs.scss

* changed readonly input styling in inputs.scss in accordance with new design for readonly input

* added changelog
2023-07-13 11:28:20 -07:00
Max Bowsher
e47dd9df53 OpenAPI: Separate ListOperation from ReadOperation (#21723)
* OpenAPI: Separate ListOperation from ReadOperation

Historically, since Vault's ReadOperation and ListOperation both map to
the HTTP GET method, their representation in the generated OpenAPI has
been a bit confusing.

This was partially mitigated some time ago, by making the `list` query
parameter express whether it was required or optional - but only in
a way useful to human readers - the human had to know, for example, that
the schema of the response body would change depending on whether `list`
was selected.

Now that there is an effort underway to automatically generate API
clients from the OpenAPI spec, we have a need to fix this more
comprehensively. Fortunately, we do have a means to do so - since Vault
has opinionated treatment of trailing slashes, linked to operations
being list or not, we can use an added trailing slash on the URL path to
separate list operations in the OpenAPI spec.

This PR implements that, and then fixes an operation ID which becomes
duplicated, with this change applied.

See also hashicorp/vault-client-go#174, a bug which will be fixed by
this work.

* Set further DisplayAttrs in auth/github plugin

To mask out more duplicate read/list functionality, now being separately
generated to OpenAPI client libraries as a result of this change.

* Apply requested changes to operation IDs

I'm not totally convinced its worth the extra lines of code, but
equally, I don't have strong feelings about it, so I'll just make the
change.

* Adjust logic to prevent any possibility of generating OpenAPI paths with doubled final slashes

Even in the edge case of improper use of regex patterns and operations.

* changelog

* Fix TestSudoPaths to pass again... which snowballed a bit...

Once I looked hard at it, I found it was missing several sudo paths,
which led to additional bug fixing elsewhere.

I might need to pull some parts of this change out into a separate PR
for ease of review...

* Fix other tests

* More test fixing

* Undo scope creep - back away from fixing sudo paths not shown as such in OpenAPI, at least within this PR

Just add TODO comments for now.
2023-07-13 13:36:52 -04:00
Austin Gebauer
c2cbd5a578 auth/azure: upgrade to v0.15.1 for bug fix (#21800)
* auth/azure: upgrade to v0.15.1 for bug fix

* adds changelog
2023-07-13 10:06:51 -07:00
Rebecca Willett
2a05a48016 Support Enos failure notifications for other workflow triggers (#21768)
Include in the Slack message only the properties that are common to all the applicable workflow triggers.
2023-07-13 14:57:44 +00:00
Max Winslow
03ba365032 fix sys/raft doc headings (#21591)
* fix sys/raft doc headings

* Update website/content/api-docs/system/storage/raftautosnapshots.mdx

Co-authored-by: Mike Palmiotto <mike@p4lm.io>

---------

Co-authored-by: Mike Palmiotto <mike@p4lm.io>
2023-07-13 15:49:10 +01:00
Steven Clark
8d74143872 Add additional debug output to TestCertStorageMetrics (#21793)
- Add a little more debug to try and understand how we could get the
   following error I saw within GHA
```
    path_tidy_test.go:769: Created root and leaf certificate, deleted leaf, but a got a certificate count of 2
```
 - Fix some other issues discovered while running the test through
   stress locally
2023-07-13 09:03:23 -04:00
miagilepner
233bd52051 exclude vault/integ from normal go tests (#21805) 2023-07-13 12:54:55 +00:00
John-Michael Faircloth
c121728a69 plugin automation: use gh cli and add labels (#21657)
* plugin automation: use gh cli and add labels

* remove unneeded fields

* reorder steps

* remove comment

* fix typo

* add some validation
2023-07-12 16:28:56 -04:00
Ryan Cragun
a98c0d9cbe actions: always cache all required Go modules (#21792)
* Make sure that we always download all of the required modules.
* Fix actions/set-up-go path for UI test
* Fix broken go.mod in hcp_link

Signed-off-by: Ryan Cragun <me@ryan.ec>
2023-07-12 20:21:09 +00:00
Kuba Wieczorek
216f497c33 Don't fail tests if GitHub API doesn't return the expected response in CI (#21791) 2023-07-12 19:34:48 +01:00
Ryan Cragun
c43345c452 [QT-589] Use the go module cache between CI and build (#21764)
In order to reliably store Go test times in the Github Actions cache we
need to reduce our cache thrashing by not using more than 10gb over all
of our caches. This change reduces our cache usage significantly by
sharing Go module cache between our Go CI workflows and our build
workflows. We lose our per-builder cache which will result in a bit of
performance hit, but we'll enable better automatic rebalancing of our CI
workflows. Overall we should see a per branch reduction in cache sizes
from ~17gb to ~850mb.

Some preliminary investigation into this new strategy:

Prior build workflow strategy on a cache miss:
  Download modules: ~20s
  Build Vault: ~40s
  Upload cache: ~30s
  Total: ~1m30s

Prior build workflow strategy on a cache hit:
  Download and decompress modules and build cache: ~12s
  Build Vault: ~15s
  Total: ~28s

New build workflow strategy on a cache miss:
  Download modules: ~20
  Build Vault: ~40s
  Upload cache: ~6s
  Total: ~1m6s

New build workflow strategy on a cache hit:
  Download and decompress modules: ~3s
  Build Vault: ~40s
  Total: ~43s

Expected time if we used no Go caching:
  Download modules: ~20
  Build Vault: ~40s
  Total: ~1m

Signed-off-by: Ryan Cragun <me@ryan.ec>
2023-07-12 17:55:16 +00:00
Kuba Wieczorek
5c5c2abc63 VAULT-12958 Add link to logs to the test failure summary in CI (#21736) 2023-07-12 18:29:31 +01:00
miagilepner
bfa93fdeda VAULT-14696: Pin 3rd party actions (#21782)
* use shas instead of versions and fix milestones

* remove trailing space
2023-07-12 17:58:45 +02:00
Mike Palmiotto
702c521489 Auto-balancing test runners (#21745)
Integrate the `test-go` workflow with `gotestsum tool ci-matrix`. The
tool uses the output of `go list ./...` along with timing files emitted
by `gotestsum` to generate a test matrix of 16 runners with evenly
distributed runtimes.

We intentionally ignore binary, docker-based test files for the initial
matrix creation and then inject a 17th runner, dedicated to building
Vault and running the entire binary test suite together. This avoids
duplication of build overhead when binary tests are rebalanced across
multiple runners in the generated matrix.

In order to maintain test results from previous runs, we cache the test
results after every run of `gotestsum`. Each cache entry occupies ~36MB
after compression on enterprise, at the time of this commit.

We'll have to keep an eye on this to make sure timing data is not
evicted from the cache, but in theory it should be toward the top of the
LRU entries.
2023-07-12 11:19:50 -04:00