911 Commits

Author SHA1 Message Date
Vault Automation
d8f870d125
Refactor Identity.ActivationFunc to make room for SCIM activation (#10317) (#10349)
Co-authored-by: Bianca <48203644+biazmoreira@users.noreply.github.com>
2025-10-23 15:41:36 +00:00
Vault Automation
0c6c13dd38
license: update headers to IBM Corp. (#10229) (#10233)
* license: update headers to IBM Corp.
* `make proto`
* update offset because source file changed

Signed-off-by: Ryan Cragun <me@ryan.ec>
Co-authored-by: Ryan Cragun <me@ryan.ec>
2025-10-21 15:20:20 -06:00
Vault Automation
7efe8aa99b
Fix seal rewrap running unnecessarily (#9466) (#9895)
Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>
2025-10-07 07:24:17 -04:00
Vault Automation
3594d6d6b1
[VAULT-38605] Add self-enrollment option to the TOTP Login MFA method (#8711) (#8731)
Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2025-08-20 20:18:54 +01:00
Ryan Cragun
4c3a440e1f
testhelpers(ldap): always time out if we can't start the container in 1 minute (#31509)
Signed-off-by: Ryan Cragun <me@ryan.ec>
2025-08-15 17:35:06 -06:00
Steven Clark
bce06a8772
Add updates to various CE files to support the new ENT SPIFFE auth plugin (#31434) 2025-08-06 12:48:15 -04:00
Victor Rodriguez
32e3ecbf83
Add hooks for enterprise token auth metadata feature. (#31391) 2025-08-05 12:32:48 -04:00
Bruno Oliveira de Souza
194241e1d1
VAULT-35838: advance deprecation of duplicate HCL attributes to pending removal stage (#31215)
* HCL dup attr deprecation: pending removal

* correct docs

* add changelog

* better error message for possible common errors

* Update website/content/partials/deprecation/duplicate-hcl-attributes.mdx

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

* Update website/content/partials/deprecation/duplicate-hcl-attributes.mdx

Co-authored-by: Luis (LT) Carbonell <lt.carbonell@hashicorp.com>

---------

Co-authored-by: Yoko Hyakuna <yoko@hashicorp.com>
Co-authored-by: Luis (LT) Carbonell <lt.carbonell@hashicorp.com>
2025-07-24 15:17:51 -03:00
akshya96
1fb006633b
Update clientcountutil to accommodate entity record usage time changes CE changes (#31301)
* moving clientcountutil changes from ent

* adding random usage time for repeated clients

* replace math.rand with crypto.rand
2025-07-22 17:20:10 +00:00
Ellie
1e7f22aeec
Add DB type consts (#31295)
* add necessary consts

* add other db plugins

* correct ES

* Fix consts in test
2025-07-17 12:08:27 -05:00
Ellie
23e04c2409
Add MetricsReporter interface so that databaseBackend's can share their connection counts with CensusManager (#31269)
* add interface and impl

* add tests

* fix comments

* Update builtin/logical/database/backend.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-14 14:52:55 -05:00
Steven Clark
d9aa82470e
Add digest OID to PKCS7/SCEP digest failure logs (#31232)
* Add digest OID to PKCS7/SCEP digest failure logs

 - To help debugging in the future without requiring a full packet capture
   lets add the digest oid that we used to select the hashing algorithm that
   led to the digmest mismatch

* Add cl

* Fix type in CL header
2025-07-09 10:54:12 -04:00
Bruno Oliveira de Souza
0b9157156f
VAULT-32657 deprecate duplicate attributes in HCL configs and policies (#30386)
* upgrade hcl dependency on api pkg

This upgrades the hcl dependency for the API pkg,
and adapts its usage so users of our API pkg are
not affected. There's no good way of communicating
a warning via a library call so we don't.

The tokenHelper which is used by all Vault CLI
commands in order to create the Vault client, as
well as directly used by the login and server
commands, is implemented on the api pkg, so this
upgrade also affects all of those commands. Seems
like this was only moved to the api pkg because
the Terraform provider uses it, and I thought
creating a full copy of all those files back under
command would be too much spaghetti.

Also leaving some TODOs to make next deprecation
steps easier.

* upgrade hcl dependency in vault and sdk pkgs

* upgrade hcl dependency in vault and sdk pkgs

* add CLI warnings to commands that take a config

- vault agent (unit test on CMD warning)
- vault proxy (unit test on CMD warning)
- vault server (no test for the warning)
- vault operator diagnose (no tests at all, uses the
same function as vault server

* ignore duplicates on ParseKMSes function

* Extend policy parsing functions and warn on policy store

* Add warning on policy fmt with duplicate attributes

* Add warnings when creating/updating policy with duplicate HCL attrs

* Add log warning when switchedGetPolicy finds duplicate attrs

Following operations can trigger this warning when they run into a policy
with duplicate attributes:
* replication filtered path namespaces invalidation
* policy read API
* building an ACL (for many different purposes like most authZ operations)
* looking up DR token policies
* creating a token with named policies
* when caching the policies for all namespaces during unseal

* Print log warnings when token inline policy has duplicate attrs

No unit tests on these as new test infra would have to be built on all.
Operations affected, which will now print a log warning when the retrieved
token has an inline policy with duplicate attributes:
* capabilities endpoints in sys mount
* handing events under a subscription with a token with duplicate
attrs in inline policies
* token used to create another token has duplicate attrs in inline
policies (sudo check)
* all uses of fetchACLTokenEntryAndEntity when the request uses a
token with inline policies with duplicate attrs. Almost all reqs
are subject to this
* when tokens are created with inline policies (unclear exactly how that
can happen)

* add changelog and deprecation notice

* add missing copywrite notice

* fix copy-paste mistake

good thing it was covered by unit tests

* Fix manual parsing of telemetry field in SharedConfig

This commit in the hcl library was not in the
v1.0.1-vault-5 version we're using but is
included in v1.0.1-vault-7:
e80118accb

This thing of reusing when parsing means that
our approach of manually re-parsing fields
on top of fields that have already been parsed
by the hcl annotation causes strings (maybe
more?) to concatenate.

Fix that by removing annotation. There's
actually more occurrences of this thing of
automatically parsing something that is also
manually parsing. In some places we could
just remove the boilerplate manual parsing, in
others we better remove the auto parsing, but
I don't wanna pull at that thread right now. I
just checked that all places at least fully
overwrite the automatically parsed field
instead of reusing it as the target of the
decode call. The only exception is the AOP
field on ent but that doesn't have maps or
slices, so I think it's fine.

An alternative approach would be to ensure
that the auto-parsed value is discarded,
like the current parseCache function does

note how it's template not templates

* Fix linter complaints

* Update command/base_predict.go

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

* address review

* remove copywrite headers

* re-add copywrite headers

* make fmt

* Update website/content/partials/deprecation/duplicate-hcl-attributes.mdx

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

* Update website/content/partials/deprecation/duplicate-hcl-attributes.mdx

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

* Update website/content/partials/deprecation/duplicate-hcl-attributes.mdx

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

* undo changes to deprecation.mdx

* remove deprecation doc

* fix conflict with changes from main

---------

Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com>
Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>
2025-05-23 16:02:07 -03:00
miagilepner
bea32a14ab
VAULT-35369: Loaded snapshots CE (#30529)
* full load

* snapshot manager tested

* integration test

* more tetsts

* remove obselete test

* fix failing test

* move tesdata to ent folder

* add test for RaftDataDirPath

* fix race condition, don't create new barrier instance

* check for nil result

* remove encryption from the barrier storage wrapper

* Update physical/raft/fsm.go

Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>

* fmt

---------

Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2025-05-16 14:27:04 +02:00
John-Michael Faircloth
86651479c8
test: fix CompilePlugin test helper (#30644)
This PR fixes CompilePlugin which would fail when run locally in certain
situations based on relative directory paths. This change makes
CompilePlugin perform os.Stat on the full path to the plugin's main.go
file to ensure the test changes to the appropriate directory for
building the plugin.
2025-05-15 20:42:44 +00:00
Steven Clark
1551d6943e
Add fixes for processing InTune SCEP messages within our PKCS7 library (#30595) 2025-05-14 08:25:15 -04:00
Steven Clark
dc8da38cb7
Add tweaks to tests for the new enterprise SCEP test (#30495) 2025-05-02 11:28:16 -04:00
Steven Clark
426088ddfb
Fix race within pkcs7.asn1Structured.EncodeTo (#30162)
- The function was incrementing and decrementing a global variable
   but was never used so remove it completely and all the commented
   out code that references the encodeIndent global.
2025-04-02 17:05:02 -04:00
Ryan Cragun
95b2d86870
ldap: pin test container to latest working version (#30148)
The test container that we use for many LDAP tests recently merged a
breaking change: https://github.com/rroemhild/docker-test-openldap/issues/62

Add support for using containers via references with digests and pin to the latest
version that worked. We can unpin later if so desired.

Signed-off-by: Ryan Cragun <me@ryan.ec>
2025-04-01 22:24:15 +00:00
Bianca
6eeb228889
Persist automatic entity merges (#29568)
* Persist automatic entity merges

* Local aliases write in test

* Add identity entity merge unit property test

* N entities merge

* Persist alias duplication fix

---------

Co-authored-by: Paul Banks <pbanks@hashicorp.com>
Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com>
2025-03-06 17:06:20 -05:00
Steven Clark
ce8094fb6c
Add underlining support for the PKI Enterprise SCEP work (#29604) 2025-02-13 15:54:18 +00:00
davidadeleon
6741773b0f
update vault auth submodules to api/v1.16.0 (#29548)
* update vault auth submodules to api/v1.16.0

* update go.mod

* make proto

---------

Co-authored-by: davidadeleon <ddeleon@hashicorp.com>
2025-02-11 07:28:45 -08:00
Mike Palmiotto
6d5759ecb3
identity: Introduce ActivationFunc for managing feature state (#29467)
* identity: Ensure state is changed on activation

This PR introduces some changes to the way activation flags are
processed in Vault.

Rather than reaching into subsystems and modifying
state from the activationflags package, each plugin can now register its
own ActivationFunc. Updates to activation flags now trigger the the
feature's ActivationFunc, which can encapsulate the associated
subsystem state.

We include a few bugfixes and minor cosmetic changes, like updates to
log lines and godocs.

* Check for nil system backend

* Move deduplication activation to common file

* Add identity dedup activation log lines

* Make interface methods clearer

* Clean up some comments

* More cleanups

* fixup! More cleanups

* fixup! More cleanups
2025-01-31 12:25:07 -03:00
Steven Clark
9456671f04
Prepare code base for Go 1.24 update. (#29412)
* Fix "t.Fatal from a non-test goroutine" errors in cache_test.go

 - t.Fatal(f) should not be called within a Go routine based on it's documentation and only from the main test's thread.
 - In 1.24 this seems to cause build failures

* Address all "non-constant format string errors" from go vet

 - Within 1.24 these now cause test builds to fail

…" from go vet
2025-01-27 14:34:07 -05:00
Mike Palmiotto
9d80c4548f
proto: bump protoc-gen-go to 1.36.3 (#29359) 2025-01-22 13:58:43 -05:00
Mike Palmiotto
f503f739de
identity: Resolve conflicts with rename (#29356)
This PR introduces a new type of conflict resolution for duplicate
Entities and Groups. Renaming provides a way of preventing Vault from
entering case-sensitive mode, which is the current behavior for any kind
of duplicate.

Renames append the conflicting identity artifact's UUID to its name and
updates a metadata field to indicate the pre-existing artifact's UUID.

The feature is gated by the force-identity-deduplication activation flag.

In order to maintain consistent behavior between the reporting resolver
and the rename operation, we need to adjust the behavior of generated
reports. Previously, they intentionally preserved existing Group merge
determinism, wherein the last MemDB update would win and all others
would be renamed. This approach is more complicated for the rename
resolver, since we would need to update any duplicated entity in the
cache while inserting the new duplicate (resulting in two MemDB
operations). Though we can ensure atomic updates of the two identity
artifacts with transactions (which we could get for groups with a minor
adjustment, and we will get along with batching of Entity upserts on 
load), it's far simpler to just rename all but the first insert as proposed
in the current PR.

Since the feature is gated by an activation flag with appropriate 
warnings of potential changes via the reporting resolver, we opt
for simplicity over maintaining pre-existing behavior. We can revisit
this assumption later if we think alignment with existing behavior
outweighs any potential complexity in the rename operation.

Entity alias resolution is left alone as a destructive merge operation
to prevent a potentially high-impact change in existing behavior.
2025-01-15 14:24:49 -05:00
Bianca
896532ef89
Add state change logic to reload from storage -- activation flags (#29341) 2025-01-10 11:56:40 +00:00
Bianca
ab4e8da697
Port activation flags with dynamic registration (#29237) 2025-01-09 10:27:58 -03:00
Ryan Cragun
357b2949e3
protobuf: rebuild protos with protobuf 1.36.2 (#29318)
* protobuf: rebuild protos with protobuf 1.36.2
* format: please buf formatter

Signed-off-by: Ryan Cragun <me@ryan.ec>
2025-01-08 21:35:04 +00:00
miagilepner
4f32443722
fixes for flakes in raft removed tests (#29270)
* fixes for flakes in raft removed tests

* one more fix
2025-01-07 13:56:07 +01:00
Ryan Cragun
f730d31bc6
protobuf: rebuild protos with protobuf 1.36 (#29229)
Signed-off-by: Ryan Cragun <me@ryan.ec>
2025-01-03 14:19:00 -07:00
Steven Clark
7d26c54350
Do not use static certificates for diagnose tests (#29122)
* Do not use static certificates for diagnose tests

* Fix operator command tests, move PKI CA creation code into testhelper lib

* Fix compilation error from refactoring
2024-12-09 14:03:16 +01:00
Scott Miller
86ba0dbdeb
Use go-secure-stdlib's RSA key generator backed by a DRBG (#29020)
* Use DRBG based RSA key generation everywhere

* switch to the conditional generator

* Use DRBG based RSA key generation everywhere

* switch to the conditional generator

* Add an ENV var to disable the DRBG in a pinch

* update go.mod

* Use DRBG based RSA key generation everywhere

* switch to the conditional generator

* Add an ENV var to disable the DRBG in a pinch

* Use DRBG based RSA key generation everywhere

* update go.mod

* fix import

* Remove rsa2 alias, remove test code

* move cryptoutil/rsa.go to sdk

* move imports too

* remove makefile change

* rsa2->rsa

* more rsa2->rsa, remove test code

* fix some overzelous search/replace

* Update to a real tag

* changelog

* copyright

* work around copyright check

* work around copyright check pt2

* bunch of dupe imports

* missing import

* wrong license

* fix go.mod conflict

* missed a spot

* dupe import
2024-12-05 15:39:16 -06:00
Bruno Oliveira de Souza
a2c467cc22
VAULT-31409: trace postUnseal function (#28895)
* initial implementation of unseal trace

* close file if we fail to start the trace

didn't bother to check the error from traceFile.Close()

* use reloadable config instead of env var

* license

* remove leftover

* allow setting custom dir and remove new package

* bring back StartDebugTrace

after talking to Kuba it sounds like it's a good idea to try to move stuff out of core, so even if there's no immediate need for a generic debug trace function it's still fair to add it

* track postUnseal instead of unsealInternal

also some usability improvements from manual testing

* address PR comments

* address security review

there were concerns about using the /tmp directory because of permissions, or having a default dir at all, so now it's required to set a dir in order to generate the traces.

* add unit tests to StartDebugTrace

* move back to default dir

* document new parameters

* add tiny integration test

* avoid column in trace filename

sounds like it might be forbidden in Windows and possibly cause problems in some MacOS applications.

* address PR feedback

* add go doc to test

CI was complaining about missing comments on the new test function. It feels a bit silly to require this of tests but whatever XD

* fix tests
2024-11-26 15:04:34 -03:00
Violet Hynes
b20beaec66
VAULT-32507: CE Changes (#29004) 2024-11-25 14:08:15 -05:00
Violet Hynes
1196624670
CE Changes for Auth Method Usage Metrics (#28931)
* CE Changes for Auth Method Usage Metrics

* Import cycle weirdness

* Cleanup
2024-11-19 09:39:46 -05:00
divyaac
52ba156d47
Fix protoc issue (#28928) 2024-11-15 19:33:48 +00:00
Steven Clark
c3d5c1b3ec
Update to Go 1.23.3 (#28920)
* Update to Go 1.23.3

 - Update to latest major version of Go 1.23.3 from 1.22.8.
 - Update github.com/sasha-s/go-deadlock to address deadlock timer
   issue we were seeing.
 - Fix one of our tests to only reset the member variable we change
   instead of the entire Opts parameter to avoid a data race during
   testing.

* Add workaround for MSSQL TLS certificate container issue
2024-11-15 13:32:09 -05:00
miagilepner
10bd15f956
VAULT-30877: Repopulate AWS static creds queue in initialize (#28775)
* populate rotation queue in initialize

* docs, changelog

* add t.Helper()
2024-11-04 09:32:14 -06:00
miagilepner
4439ee8798
Fix Windows chown error (#28748)
* noop for windows chown

* changelog
2024-10-22 14:57:26 +02:00
Ryan Cragun
b6145bc3bb
protobuf: rebuild protos with protobuf 1.35.1 (main) (#28617)
* protobuf: rebuild protos with protobuf 1.35.1
* protobuf: unpin protoc-gen-go-grpc on main

Signed-off-by: Ryan Cragun <me@ryan.ec>
2024-10-07 14:54:51 -06:00
Scott Miller
6ad78c4102
Remove one more use of ScalarMult from CE (#28585)
* Remove one more use of ScalarMult from CE

* get param order right
2024-10-03 15:59:42 -05:00
Steven Clark
6acfc8e212
Add a core test logger to help capture the MSSQL container output (#28472)
* Add a core test logger to help capture the MSSQL container output

 - I believe the if t.Failed prevents the logging of the container
   logging as when executed the test isn't considered failed yet.
 - Use a test core logger so that we can capture the container output
   all the time and get it from the captured log files when the test
   fails

* bump image tag to 2022-latest

---------

Co-authored-by: JM Faircloth <jmfaircloth@hashicorp.com>
2024-09-23 13:57:21 -04:00
Steven Clark
13de053935
Do not shadown err within MSSQL test container intialization (#28468)
- Get better test failure error messages by not shadowing the errors
   when we are attempting to start the MSSQL docker container, so
   we can fail the tests with the proper error message that is occuring
   instead of mssqlhelper.go:60: Could not start docker MSSQL: %!s(<nil>)
2024-09-23 12:22:11 -04:00
crystalstall
8dee06f977
chore: fix some function names (#28251)
Signed-off-by: crystalstall <crystalruby@qq.com>
2024-09-04 09:38:52 -04:00
vinay-gopalan
ec9b675f70
Add OSS stub functions for Self-Managed Static Roles (#28199) 2024-08-29 10:01:01 -07:00
John-Michael Faircloth
3fcb1a67c5
database/postgres: add inline certificate authentication fields (#28024)
* add inline cert auth to postres db plugin

* handle both sslinline and new TLS plugin fields

* refactor PrepareTestContainerWithSSL

* add tests for postgres inline TLS fields

* changelog

* revert back to errwrap since the middleware sanitizing depends on it

* enable only setting sslrootcert
2024-08-09 14:20:19 -05:00
John-Michael Faircloth
899ebd4aff
db/postgres: add feature flag protected sslinline configuration (#27871)
* adds sslinline option to postgres conn string
* for database secrets type postgres, inspects the connection string for sslinline and generates a tlsconfig from the connection string.

* support fallback hosts

* remove broken multihost test

* bootstrap container with cert material

* overwrite pg config and set key file perms

* add feature flag check

* add tests

* add license and comments

* test all ssl modes

* add test cases for dsn (key/value) connection strings

* add fallback test cases

* fix error formatting

* add test for multi-host when using pgx native conn url parsing

---------

Co-authored-by: Branden Horiuchi <Branden.Horiuchi@blackline.com>
2024-08-01 11:43:54 -05:00
idnandre
e26c246cbb
chore: fix deprecated ioutil readall (#27823)
Signed-off-by: idnandre <andre@idntimes.com>
2024-07-30 09:18:24 -04:00
Violet Hynes
dbecbcec18
VAULT-27384 Fix faulty assignments and unchecked errors (#27810)
* VAULT-27384 Fix faulty assignments and unchecked errors

* Another missed error

* Small refactor
2024-07-22 16:53:02 -04:00