Commit Graph

768 Commits

Author SHA1 Message Date
Scott Miller
415d260995
Support trimming trailing slashes via a mount tuneable to support CMPv2 (#28752)
* Support trimming trailing slashes via a mount tuneable to support CMPv2

* changelog/

* Perform trimming in handleLoginRequest too

* Eagerly fetch the mount entry so we only test this once

* Add a mount match function that gets path and entry

* Update vault/request_handling.go

Co-authored-by: Steven Clark <steven.clark@hashicorp.com>

* more docs

* Some patches (from ENT) didnt apply

* patch fail

* Update vault/router.go

Co-authored-by: Steven Clark <steven.clark@hashicorp.com>

* PR feedback

* dupe

* another dupe

* Add support for enabling trim_request_trailing_slashes on mount creation

* Fix read mount api returning configuration for trim_request_trailing_slashes

* Fix test assertion

* Switch enable and tune arguments to BoolPtrVal to allow end-users to specify false flag

* Add trim-request-trailing-slashes to the auth enable API and CLI

---------

Co-authored-by: Steven Clark <steven.clark@hashicorp.com>
2024-10-24 10:47:17 -05:00
Josh Black
d1355cb98f
explain how -output-curl-string works in comments to avoid confusion (#28576) 2024-10-04 11:14:21 -07:00
Tero Saarni
6f13aec0d3
core/api: Add missing LICENSE files to sub-modules (#27920)
Go module tooling mandates that each sub-module contains its own LICENSE file.
If absent, it defaults to the LICENSE file in the root of the git repository.
This resulted in the api/auth/* modules erroneously inheriting the BUSL
license instead of the correct MPL license, as indicated by the SPDX info in
the actual API code.

This update ensures that module documentation is displayed correctly on
pkg.go.dev and resolves issues with various tools showing incorrect license
information for the sub-modules.

Signed-off-by: Tero Saarni <tero.saarni@est.tech>
2024-09-23 13:06:35 -04:00
Victor Rodriguez
ab8bc34c53
update vault auth submodules to api/v1.15.0 (#28338) 2024-09-10 18:03:47 +00:00
idnandre
e26c246cbb
chore: fix deprecated ioutil readall (#27823)
Signed-off-by: idnandre <andre@idntimes.com>
2024-07-30 09:18:24 -04:00
Chris Capurso
a28464b860
Add non-root access with filtering support to activity export API (#27846)
* VAULT-28577: change CSV MIME type to text/csv

* VAULT-28578: require sudo for export API

* add validation and associated error handling

* change export API default to 204 if no data returned

* VAULT-28579: allow export API in non-root namespace, add filtering support

* update test fixtures to reflect filtering changes

* TestActivityLog_Export moved to ENT-only test

* add test to verify sudo access

* add changelog entry
2024-07-24 09:21:52 -04:00
idnandre
b833d4714d
chore: fix deprecated ioutil nopcloser (#27650)
Signed-off-by: idnandre <andre@idntimes.com>
2024-07-03 13:38:34 -04:00
Violet Hynes
037d82130c
VAULT-28422 Upgrade go-retryablehttp for CE (#27602) 2024-06-26 09:05:02 -04:00
Jacob Henner
46a41a549b
Specify headers by environment variable (#21993)
* Specify headers by environment var

* Add changelog entry

* Add tests, docs

* Formatting

---------

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
2024-06-19 16:51:24 -04:00
Peter Wilson
26eae55a7d
updated dependencies for auth/gcp (#27415) 2024-06-10 16:08:15 +00:00
Violet Hynes
b41dcee3fa
VAULT-24050 Fix erroneous warning showing when -address is provided (#27265)
* VAULT-24050 Fix erroneous warning showing when -address is provided

* VAULT-24050 changelog
2024-05-30 09:48:06 -04:00
Antonio
fab2899508
Bump backoff/v3 to backoff/v4 (#26868)
This makes it so projects that are already using backoff don't need to
pull up an old version of it just because of vault/api. This major
version change is compatible with existing usage in code.

Refs #24707.

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
2024-05-29 12:04:46 -04:00
Tianhao Guo
2a1775f45f
fix an edge case bug that "identity_policies" is nil (#17007)
* check if "identity_policies" is nil to fix cli vault login error

* add changelog

* skip add identity_policies to resp when there's no identity_policies associated in token's namespace

This is an edge case, when an entity has identity_policies associated in other namespaces but no identity_policies in this token's namespace, `identityPolicies[out.NamespaceID]` is nil, client side doesn't handle nil which raises error.

* update changelog

---------

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
2024-05-28 15:34:59 -04:00
Peter Wilson
545064cb6d
update vault auth submodules to api/v1.14.0 (#27190)
* update vault auth submodules to api/v1.14.0

* go mod tidy in repo root
2024-05-23 11:00:55 -04:00
hc-github-team-secure-vault-core
c4eb7f74e7
Update vault-plugin-database-elasticsearch to v0.15.0 (#27136)
* Update vault-plugin-database-elasticsearch to v0.15.0

* Add changelog

* fix failing tests + update dep in api dir

---------

Co-authored-by: hc-github-team-secure-vault-ecosystem <hc-github-team-secure-vault-ecosystem@users.noreply.github.com>
Co-authored-by: Milena Zlaticanin <60530402+Zlaticanin@users.noreply.github.com>
Co-authored-by: Zlaticanin <zlaticaninmilena@gmail.com>
2024-05-22 10:47:08 -07:00
Peter Wilson
af71350e55
updated golang.org/x/net dependency for api + go mod tidy (#27031) 2024-05-15 14:52:26 +01:00
Violet Hynes
b16b94a72a
VAULT-25341 Address issue where having no permissions to renew caused auto-auth to attempt to renew with no backoff (#26844)
* VAULT-25341 Address issue where having no permissions to renew caused Agent and Proxy auth to attempt to renew with no backoff

* Fiddle with go.mod changes that shouldn't have happened

* VAULT-25341 small cleanup and extra test

* VAULT-25341 backoff only in error case

* VAULT-25341 godocs

* VAULT-25342 changelog

* Update command/agent_test.go

Co-authored-by: divyaac <divya.chandrasekaran@hashicorp.com>

* VAULT-25341 rename file audit

---------

Co-authored-by: divyaac <divya.chandrasekaran@hashicorp.com>
2024-05-09 11:12:42 -04:00
Tom Proctor
86d529e115
Upgrade api package go-jose to v4 (#26527)
* Upgrade api package go-jose to v4
* go-jose/v4 requires go 1.21
2024-04-19 12:17:41 +01:00
Christopher Swenson
961bf20bdb
Use enumer to generate String() methods for most enums (#25705)
We have many hand-written String() methods (and similar) for enums.
These require more maintenance and are more error-prone than using
automatically generated methods. In addition, the auto-generated
versions can be more efficient.

Here, we switch to using https://github.com/loggerhead/enumer, itself
a fork of https://github.com/diegostamigni/enumer, no longer maintained,
and a fork of the mostly standard tool
https://pkg.go.dev/golang.org/x/tools/cmd/stringer.
We use this fork of enumer for Go 1.20+ compatibility and because
we require the `-transform` flag to be able to generate
constants that match our current code base.

Some enums were not targeted for this change:
2024-04-17 11:14:14 -07:00
Josh Black
a8a621f539
CE changes for https://github.com/hashicorp/vault-enterprise/pull/5695 (#26449) 2024-04-16 18:26:26 +00:00
Nick Cabatoff
2560beea8e
CE part of https://github.com/hashicorp/vault-enterprise/pull/4269 (#26406) 2024-04-15 20:08:57 +00:00
Andrew Stucki
57cb563be5
Fix exponential backoff for api.LifetimeWatcher (#26383)
* Fix exponential backoff for api.LifetimeWatcher

* Add changelog entry
2024-04-12 12:59:58 -04:00
John-Michael Faircloth
594d304f25
api: do not require sudo for GetAuth wrapper (#25968)
* api: do not require sudo for GetAuth wrapper

* changelog
2024-03-15 14:40:22 -07:00
dependabot[bot]
031e56d3a4
Bump github.com/go-jose/go-jose/v3 from 3.0.1 to 3.0.3 in /api (#25841)
Bumps [github.com/go-jose/go-jose/v3](https://github.com/go-jose/go-jose) from 3.0.1 to 3.0.3.
- [Release notes](https://github.com/go-jose/go-jose/releases)
- [Changelog](https://github.com/go-jose/go-jose/blob/v3.0.3/CHANGELOG.md)
- [Commits](https://github.com/go-jose/go-jose/compare/v3.0.1...v3.0.3)

---
updated-dependencies:
- dependency-name: github.com/go-jose/go-jose/v3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Peter Wilson <peter.wilson@hashicorp.com>
2024-03-15 17:52:57 +00:00
Tom Proctor
9ed00822ea
Move CLI token helper to api module (#25744)
* Move command/config + command/token to api/cliconfig + api/tokenhelper
* Remove unused functions and unused import
* Simplify and inline function copied from SDK
* Delete unused duplicated/forwarding config implementation from command package
* Delete unused code, unexport API surface that's only used internally to the package
* Fix up license headers
* Add changelog
* Tweak .gitignore to track hcl files in testdata/ folders
2024-03-04 18:29:20 +00:00
John-Michael Faircloth
54c28fdf4b
api: add wrapper functions for GET auth and mount (#25499)
* api: add GET for auth and mount

* add changelog

* add unit test

* add auth unit test

* add external api tests

* add godoc to tests
2024-02-20 10:31:08 -06:00
Josh Black
fa13dbd381
add gosimport to make fmt and run it (#25383)
* add gosimport to make fmt and run it

* move installation to tools.sh

* correct weird spacing issue

* Update Makefile

Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>

* fix a weird issue

---------

Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>
2024-02-13 14:07:02 -08:00
Violet Hynes
1529422559
Update Vault auth submodule API versions for 1.16 (#25290) 2024-02-08 10:46:33 -05:00
Violet Hynes
3ba802d8dc
Move wg.Add outside of goroutine (#25104)
* Move wg.Add outside of goroutine

* Fix other test
2024-01-26 19:01:54 +00:00
miagilepner
49a59bda5e
Fix api/ and sdk/ package tests (#25067)
* fix

* left in incorrectly

* don't print generate commands

* handle line breaks

* remove -e
2024-01-25 14:45:44 +01:00
Marc Boudreau
24e5c2c2f3
VAULT-22504: Support Custom Messages in api Package (#24959)
* add methods in Sys struct to manipulate UI Custom Messages

* adding go-docs

* extracting recurring URL path into a constant

* using same stretchr/testify version as the main go.mod
2024-01-23 13:20:58 -05:00
Austin Gebauer
a93ee17946
cli: adds plugin identity token to enable and tune commands for secret engines and auth methods (#24980)
* adds plugin identity token to secrets CLI for enable and tune

* adds plugin identity token to auth CLI for enable and tune

* adds field to mount config input and output

* adds changelog

* fix tests

* fix another test
2024-01-22 16:00:03 -08:00
Austin Gebauer
76a62d5997
sys: adds identity_token_key to mounts/auth for enable/tune (#24962)
* sys: adds identity_token_key to mounts/auth for enable/tune

* adds changelog

* adds godoc on new tests

* adds function for identityStoreKeyExists

* use read lock, remove helper func

* tune test in logical_system_test, remove router access method

* fix key existence check in namespaces
2024-01-22 15:28:11 -08:00
Violet Hynes
074a35eac6
Update aws-sdk-go to latest (#24916) 2024-01-17 15:17:00 -05:00
Tom Proctor
80f85a05f6
New root namespace plugin reload API sys/plugins/reload/:type/:name (#24878) 2024-01-17 15:46:27 +00:00
Steven Clark
6f5a7a9e8c
Add WriteRaw to client api and new PKI test helper (#24818)
- This is to support the EST test cases within Vault Enterprise
2024-01-11 13:51:42 -05:00
Stephen Wodecki
d3c790a495
ParseAddress test fix (#17382)
* check prefix of previous address

* add tests for dial context switching

---------

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
2024-01-10 15:35:23 +00:00
Bianca Moreira
e0216cab5b
Add HCP subcommand -- integrate with HCP library (#23897)
* Add HCP engine token logic

* Update documentation

* Fix content check

* Add changelog entry

* Update changelog/23897.txt

Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>

* Update api/client.go

Co-authored-by: Chris Capurso <1036769+ccapurso@users.noreply.github.com>

* Add error when HCP commands failed to be initialize

* Add tests for initHCPcommand function

* Update lib dependency

* Update website/content/docs/commands/hcp.mdx

Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>

* Update website/content/docs/commands/hcp.mdx

Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>

* Update website/content/docs/commands/hcp.mdx

Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>

* Update website/content/docs/commands/hcp.mdx

Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>

* Update website/content/docs/commands/hcp.mdx

Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>

* Update website/content/docs/commands/hcp.mdx

Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>

* Update website/content/docs/commands/hcp.mdx

Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>

* Fix docs nav data

* Improve docs sections

* Update hcp lib dependency

* Fix content formatting

* Update lib dependency

* Fix HCPtokenhelper problem

* Fix HCPtokenhelper problem

* Remove HCP env variables

* Remove hcp helper token

* Add error treatment for no valid credential source

* Update website/content/docs/commands/hcp/index.mdx

Co-authored-by: Yoko Hyakuna <yoko@hashicorp.com>

* Update website/content/docs/commands/hcp/disconnect.mdx

Co-authored-by: Yoko Hyakuna <yoko@hashicorp.com>

* Update website/content/docs/commands/hcp/connect.mdx

Co-authored-by: Yoko Hyakuna <yoko@hashicorp.com>

* Update website/content/docs/commands/hcp/disconnect.mdx

Co-authored-by: Yoko Hyakuna <yoko@hashicorp.com>

* Update website/content/docs/commands/hcp/index.mdx

Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>

* Update website/content/docs/commands/hcp/connect.mdx

Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>

* Modify hcp tests

---------

Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>
Co-authored-by: Chris Capurso <1036769+ccapurso@users.noreply.github.com>
Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>
Co-authored-by: Yoko Hyakuna <yoko@hashicorp.com>
2024-01-09 15:29:30 +01:00
dependabot[bot]
0c12eedd19
Bump golang.org/x/crypto from 0.6.0 to 0.17.0 in /api (#24579)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.6.0 to 0.17.0.
- [Commits](https://github.com/golang/crypto/compare/v0.6.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
2024-01-04 13:19:40 -05:00
dependabot[bot]
bb82e0bdb7
Bump google.golang.org/grpc from 1.41.0 to 1.56.3 in /api/auth/gcp (#23970)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.41.0 to 1.56.3.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.41.0...v1.56.3)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
2024-01-04 12:34:00 -05:00
dependabot[bot]
90ab8fab46
Bump golang.org/x/net from 0.7.0 to 0.17.0 in /api (#24043)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.7.0 to 0.17.0.
- [Commits](https://github.com/golang/net/compare/v0.7.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
2024-01-04 11:38:10 -05:00
hc-github-team-es-release-engineering
366db10cf2
[DO NOT MERGE UNTIL EOY] update year in LICENSE and copywrite files (#24368) 2024-01-02 13:22:15 -08:00
Mattias Fjellström
e4ffe8979c
Command: token capabilities using accessor (#24479)
* Command: token capabilities using accessor

* release note

* Apply suggestions from code review

Co-authored-by: Marc Boudreau <marc.boudreau@hashicorp.com>

---------

Co-authored-by: Marc Boudreau <marc.boudreau@hashicorp.com>
2023-12-13 11:15:21 -05:00
Nick Cabatoff
b8f531142b
Use our heartbeat echo RPCs to estimate clock skew, expose it in status APIs (#24343) 2023-12-04 12:04:38 -05:00
Nick Cabatoff
85b3dba310
Rework sys/health tests to use structs and cmp (#24324) 2023-12-04 08:34:25 -05:00
Tom Proctor
030bba4e68
Support rootless plugin containers (#24236)
* Pulls in github.com/go-secure-stdlib/plugincontainer@v0.3.0 which exposes a new `Config.Rootless` option to opt in to extra container configuration options that allow establishing communication with a non-root plugin within a rootless container runtime.
* Adds a new "rootless" option for plugin runtimes, so Vault needs to be explicitly told whether the container runtime on the machine is rootless or not. It defaults to false as rootless installs are not the default.
* Updates `run_config.go` to use the new option when the plugin runtime is rootless.
* Adds new `-rootless` flag to `vault plugin runtime register`, and `rootless` API option to the register API.
* Adds rootless Docker installation to CI to support tests for the new functionality.
* Minor test refactor to minimise the number of test Vault cores that need to be made for the external plugin container tests.
* Documentation for the new rootless configuration and the new (reduced) set of restrictions for plugin containers.
* As well as adding rootless support, we've decided to drop explicit support for podman for now, but there's no barrier other than support burden to adding it back again in future so it will depend on demand.
2023-11-28 14:07:07 +00:00
Marccio Silva
8e8bc82a5a
Update go-jose dependency to 3.0.1 (#24226) 2023-11-21 13:36:58 -08:00
Steven Clark
b7dff9777d
Allow backends to extract credentials from payloads and trigger an authentication workflow (#23924)
* wip

* Work on the tuneable allowance and some bugs

* Call handleCancellableRequest instead, which gets the audit order more correct and includes the preauth response

* Get rid of no longer needed operation

* Phew, this wasn't necessary

* Add auth error handling by the backend, and fix a bug with handleInvalidCredentials

* Cleanup req/resp naming

* Use the new form, and data

* Discovered that tokens werent really being checked because isLoginRequest returns true for the re-request into the backend, when it shouldnt

* Add a few more checks in the delegated request handler for bad inputs

 - Protect the delegated handler from bad inputs from the backend such
   as an empty accessor, a path that isn't registered as a login request
 - Add similar protections for bad auth results as we do in the normal
   login request paths. Technically not 100% needed but if somehow the
   handleCancelableRequest doesn't use the handleLoginRequest code path
   we could get into trouble in the future
 - Add delegated-auth-accessors flag to the secrets tune command and
   api-docs

* Unit tests and some small fixes

* Remove transit preauth test, rely on unit tests

* Cleanup and add a little more commentary in tests

* Fix typos, add another failure use-case which we reference a disabled auth mount

* PR Feedback

 - Use router to lookup mount instead of defining a new lookup method
 - Enforce auth table types and namespace when mount is found
 - Define a type alias for the handleInvalidCreds
 - Fix typos/grammar
 - Clean up globals in test

* Additional PR feedback

 - Add test for delegated auth handler
 - Force batch token usage
 - Add a test to validate failures if a non-batch token is used
 - Check for Data member being nil in test cases

* Update failure error message around requiring batch tokens

* Trap MFA requests

* Reword some error messages

* Add test and fixes for delegated response wrapping

* Move MFA test to dedicated mount

 - If the delegated auth tests were running in parallel, the MFA test
   case might influence the other tests, so move the MFA to a dedicated
   mount

* PR feedback: use textproto.CanonicalMIMEHeaderKey

 - Change the X-Vault-Wrap-Ttl constant to X-Vault-Wrap-TTL
   and use textproto.CanonicalMIMEHeaderKey to format it
   within the delete call.
 - This protects the code around changes of the constant typing

* PR feedback

 - Append Error to RequestDelegatedAuth
 - Force error interface impl through explicit nil var assignment on
   RequestDelegatedAuthError
 - Clean up test factory and leverage NewTestSoloCluster
 - Leverage newer maps.Clone as this is 1.16 only

---------

Co-authored-by: Scott G. Miller <smiller@hashicorp.com>
2023-11-21 14:36:49 -05:00
modrake
eca4b4d801
Relplat 897 copywrite fixes for mutliple licenses (#23722) 2023-10-20 08:40:43 -07:00
Jason O'Donnell
28e3b78e8e
api/plugins: add tls-server-name arg for plugin registration (#23549)
* api/plugins: add tls-server-name arg for plugin registration

* changelog
2023-10-20 10:05:21 -04:00