Commit Graph

34 Commits

Author SHA1 Message Date
John-Michael Faircloth
04e75372fb
database/mssql: set default root rotation stmt for contained db (#29399)
* database/mssql: set default root rotation stmt for contained db

* changelog

* add rotate root test

* fix test

* update passwords to make mssql happy

* create admin user

* update contained user create query

* remove test
2025-01-24 15:42:27 -05:00
John-Michael Faircloth
fc19a9ce9c
db/mssql: increase context timeout in test (#27663)
* db/mssql: increase context timeout in test

* fix test build
2024-07-02 15:56:47 -05:00
Nick Cabatoff
8c4f3f1c71
Share the same mssql container across all four subtests. (#22293) 2023-08-11 12:59:00 +00:00
hashicorp-copywrite[bot]
0b12cdcfd1
[COMPLIANCE] License changes (#22290)
* Adding explicit MPL license for sub-package.

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Adding explicit MPL license for sub-package.

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Updating the license from MPL to Business Source License.

Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at https://hashi.co/bsl-blog, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl.

* add missing license headers

* Update copyright file headers to BUS-1.1

* Fix test that expected exact offset on hcl file

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Sarah Thompson <sthompson@hashicorp.com>
Co-authored-by: Brian Kassouf <bkassouf@hashicorp.com>
2023-08-10 18:14:03 -07:00
Hamid Ghaf
e55c18ed12
adding copyright header (#19555)
* adding copyright header

* fix fmt and a test
2023-03-15 09:00:52 -07:00
Christopher Swenson
f8e907e0de
VAULT-5827 Don't prepare SQL queries before executing them (#15166)
VAULT-5827 Don't prepare SQL queries before executing them

We don't support proper prepared statements, i.e., preparing once and
executing many times since we do our own templating. So preparing our
queries does not really accomplish anything, and can have severe
performance impacts (see
https://github.com/hashicorp/vault-plugin-database-snowflake/issues/13
for example).

This behavior seems to have been copy-pasted for many years but not for
any particular reason that we have been able to find. First use was in
https://github.com/hashicorp/vault/pull/15

So here we switch to new methods suffixed with `Direct` to indicate
that they don't `Prepare` before running `Exec`, and switch everything
here to use those. We maintain the older methods with the existing
behavior (with `Prepare`) for backwards compatibility.
2022-04-26 12:47:06 -07:00
Gary Frederick
be1f48c69b
contained_db DeleteUser unit test (#13895)
* added TestDeleteUserContainedDB | testContainedDBCredsExist helper function

* unit test contained db sanitization

Co-authored-by: Gary Frederick <imtahghost@protonmail.com>
2022-02-09 15:23:13 -08:00
Gary Frederick
0bed9ec3b0
Remove fmt strings and replace with inline queries (#13799)
* removed fmt strings and replaced with inline SQL | added unit tests

* changelog++
2022-01-27 15:20:13 -08:00
Ben Ash
312fcd944a
Update mssql's contained_db field to accept a boolean (#13469)
Previously the `contained_db` parameter would only accept a string value
despite the fact that field type is documented as a boolean.
2021-12-20 10:04:43 -05:00
Steven Clark
c749b1ddbe
Add extra debugging to help identify failures within mssql test (#13142)
* Add extra debugging to help identify failures within mssql test
* Switch up the AssertInitialized method for mssql tests by marking the test as failed instead of
   immediately failing, this will also allow us to see what happens even if this assertion fails to the rest
   of the test.
2021-11-15 12:51:16 -05:00
vinay-gopalan
81fb7750b0
[VAULT-3379] Add support for contained DBs in MSSQL root rotation and lease revocation (#12839) 2021-10-19 14:11:47 -07:00
Michael Golowka
5436e75b54
MSSQL - Add username customization (#10767) 2021-02-05 11:14:24 -07:00
Michael Golowka
a69ee0f65a
DBPW - Copy newdbplugin package to dbplugin/v5 (#10151)
This is part 1 of 4 for renaming the `newdbplugin` package. This copies the existing package to the new location but keeps the current one in place so we can migrate the existing references over more easily.
2020-10-15 13:20:12 -06:00
Michael Golowka
21d13e4671
DBPW - Update MSSQL to adhere to v5 Database interface (#10128) 2020-10-13 11:11:00 -06:00
Johnathan Schmidt
054eec2671
Add the static-roles feature for MSSQL (#9062) 2020-06-19 23:01:06 -07:00
Lauren Voswinkel
1a322e2026
Use parameters when executing prepared statements rather than fmt.Sprintf (#9013)
* Don't use string formatting to prepare queries.

We should, when possible, use the built-in params and ? format when
preparing and executing a query. This is done to prevent SQL Injection
attacks.

* Revert some changes due to failing tests, update mssql go driver

* Add docker container startup for some MSSQL tests

* Remove acceptance test flagging, add more SQL injection protection

* Refactor MSSQL prepareTestContainer to a test helper

Also, remove all ? references and convert them to @p*
2020-05-21 16:07:18 -07:00
Jeff Mitchell
8054cc660f Update to api 1.0.1 and sdk 0.1.8 2019-04-15 14:10:07 -04:00
T.K
4bcf0ec963 changed misspelled english words (#6432) 2019-03-19 09:32:45 -04:00
Becca Petrin
b62e307876 add readme on mssql testing (#6199) 2019-02-13 09:28:28 -05:00
Becca Petrin
06864a5c06 dont automatically accept mssql eula (#6169) 2019-02-05 14:11:06 -08:00
Becca Petrin
4537210236 Convert MSSQL tests to Docker (#6095)
* create working mssql docker container

* update tests
2019-01-24 07:24:31 -05:00
Chris Hoffman
2d132a1add
Fix MSSQL Root Rotation Statement (#4748)
* fixing default rotate statement for MSSQL

* only run with ACC
2018-06-12 12:11:48 -04:00
Chris Hoffman
44aa151b78
Database Root Credential Rotation (#3976)
* redoing connection handling

* a little more cleanup

* empty implementation of rotation

* updating rotate signature

* signature update

* updating interfaces again :(

* changing back to interface

* adding templated url support and rotation for postgres

* adding correct username

* return updates

* updating statements to be a list

* adding error sanitizing middleware

* fixing log sanitizier

* adding postgres rotate test

* removing conf from rotate

* adding rotate command

* adding mysql rotate

* finishing up the endpoint in the db backend for rotate

* no more structs, just store raw config

* fixing tests

* adding db instance lock

* adding support for statement list in cassandra

* wip redoing interface to support BC

* adding falllback for Initialize implementation

* adding backwards compat for statements

* fix tests

* fix more tests

* fixing up tests, switching to new fields in statements

* fixing more tests

* adding mssql and mysql

* wrapping all the things in middleware, implementing templating for mongodb

* wrapping all db servers with error santizer

* fixing test

* store the name with the db instance

* adding rotate to cassandra

* adding compatibility translation to both server and plugin

* reordering a few things

* store the name with the db instance

* reordering

* adding a few more tests

* switch secret values from slice to map

* addressing some feedback

* reinstate execute plugin after resetting connection

* set database connection to closed

* switching secret values func to map[string]interface for potential future uses

* addressing feedback
2018-03-21 15:05:56 -04:00
Josh Soref
e43b76ef97 Spelling (#4119) 2018-03-20 14:54:10 -04:00
Brian Kassouf
a401cc7cb5
Database gRPC plugins (#3666)
* Start work on context aware backends

* Start work on moving the database plugins to gRPC in order to pass context

* Add context to builtin database plugins

* use byte slice instead of string

* Context all the things

* Move proto messages to the dbplugin package

* Add a grpc mechanism for running backend plugins

* Serve the GRPC plugin

* Add backwards compatibility to the database plugins

* Remove backend plugin changes

* Remove backend plugin changes

* Cleanup the transport implementations

* If grpc connection is in an unexpected state restart the plugin

* Fix tests

* Fix tests

* Remove context from the request object, replace it with context.TODO

* Add a test to verify netRPC plugins still work

* Remove unused mapstructure call

* Code review fixes

* Code review fixes

* Code review fixes
2017-12-14 14:03:11 -08:00
Brian Kassouf
9dcea09951 Move database drivers from test files into the plugin files (#2986) 2017-07-07 10:38:12 -07:00
Graham Davison
322abf26f9 Moved drivers from plugins/helper/database/connutil/sql.go to driver test files (#2980) 2017-07-07 09:09:48 -04:00
Brian Kassouf
b9871fc9ad Use WeakDecode to decode the initialize values (#2871) 2017-06-14 18:59:27 -07:00
Brian Kassouf
abc900157b Use the role name in the db username (#2812) 2017-06-06 09:49:49 -04:00
Brian Kassouf
66630f642d Add test for custiom mssql revoke statement 2017-05-01 15:43:21 -07:00
Brian Kassouf
cb13786f0a Fix MSSQL test 2017-04-26 10:52:10 -07:00
Brian Kassouf
1f6bf2900a Only run mssql acceptance test when running as VAULT_ACC=1 2017-04-13 14:40:59 -07:00
Brian Kassouf
ea4173406e Move mssql to be an acceptance test 2017-04-13 14:30:15 -07:00
Brian Kassouf
be50cbae91 Move plugins into main vault repo 2017-04-13 13:48:32 -07:00