Commit Graph
1447 Commits
Author SHA1 Message Date
Johan Brandhorst-Satzkorn d709b97e18 fix(schema): Panic with error rather than function (#2391) 2022-08-24 20:42:21 -04:00
Johan Brandhorst-Satzkorn ac591d8283 fix(managed_groups): Fix validation function panic (#2390)
The logic would panic if no attributes were specified. Ensure
that attributes are non-nil before checking any sub fields.
2022-08-24 18:01:54 -04:00
Renato Costa ec3d2ef360 Fix incorrect use of loop variable in parallel tests (#2389)
This fixes occurences of a loop variable being captured in parallel
tests. With the previous code, only the last test case is actually
exercised. To work around this problem, we create a local copy of the
range variable before the parallel test, as suggested in the
documentation for the `testing` package:

https://pkg.go.dev/testing#hdr-Subtests_and_Sub_benchmarks

Issues were found automatically using the `loopvarcapture` linter.
2022-08-24 16:46:29 -04:00
Irena Rindos b43e61c8c7 bug(workers): Create worker-led panics on invalid token (#2388)
* Check for error before returning result
2022-08-24 14:43:15 -04:00
Jim b0bc6bd632 refactor: eliminate gorm references in favor of go-dbw (#2386) 2022-08-24 14:11:49 -04:00
Louis Ruch 929a385fdb fix: move 'drop target_all_subtypes' after whx views 2022-08-24 09:33:37 -07:00
Irena Rindos dde0c35f23 Update request data in session manager (#2369)
* bug(session): Update request data in session manager
2022-08-24 09:03:29 -04:00
Damian Debkowski 27e9f775be feat: add initial migration hook 2022-08-22 12:15:20 -07:00
Timothy Messier 79866a287f feat(schema): Add support for migration hooks
This adds the ability to define hooks that will run prior to a schema
migration. The hooks should only be used when a migration would fail due
to data being in an invalid state, likely due to a bug in the previous
schema definition. For example if a column was missing a constraint, and
a new migration is attempting to add the constraint, there might already
be values that violate the new constraint. In such cases, we would want
the user to make a decision to address the data, and need to provide
them with details about what data is problematic in case they want to
manually address the problem. To help the user, if there is a sane way
to address the data, we should provide an option to automatically
"repair" the data, allowing the migration to continue. However, this
still should be an explicit opt-in from the user, and we need to clearly
describe what the repair option would do to the user so they understand
the consequences of opting in.

To accomplish this each migration can be provided a hook that contains a
CheckFunc, RepairFunc, and RepairDescription. These functions must
operate at the point-in-time of the migration immediately preceding the
current migration, as as such they should not use and domain packages or
repositories, instead they should use direct sql with the sql library.
The description is used to explain what the RepairFunc will do.

Hooks should be defined in `internal/db/schema/migrations/oss/oss.go`
and registered with the schema edition.

See the example in `internal/db/schema/manager_example_test.go` for more
details.
2022-08-22 12:15:20 -07:00
Michael Gaffney 1fa79e9aa1 test(db): Add tests for inserts into target_host_set 2022-08-22 12:15:20 -07:00
Michael Gaffney 0512ddb060 test(db): Add tests for inserts into target_credential_library 2022-08-22 12:15:20 -07:00
Damian Debkowski c4aa9a0358 test(sql) add tests to validate project scope for target_static_credential 2022-08-22 12:15:20 -07:00
Jeff Mitchell a56d7aa4d0 Ensure that "null" can only be specified in "set-" commands (#2363)
This allows a check function to be set to determine whether it is
allowed to be set. This also ensures that if null is allowed it is
either the only value or not set.
2022-08-22 14:53:49 -04:00
Jeff Mitchell 7364d84835 Add mechanism for plugin to normalize attributes (#2376)
* Add mechanism for plugin to normalize attributes

This introduces a new normalization call to the plugin RPC service. If
implemented, the plugin will be given the attributes prior to saving
them in a create/update call, and can perform any normalization needed,
e.g. ensuring that a parameter passed in is represented in a canonical
way. As an example, the CLI allows a user of the AWS plugin to pass in a
string, but canonically it is a string slice, and should be returned
that way as well. Not by chance, this is the exact behavior of the
testing implementation of this function.

This does not update any individual plugin, but rather sets the
controller-side logic up for plugins to support this functionality.
2022-08-18 15:39:30 -04:00
Jim 2818bb65cd feature (downstreams): Add hooks for optional downstream workers/router (#2359)
This includes the required interfaces, factories, error codes, etc
2022-08-12 11:08:25 -04:00
Johan Brandhorst-Satzkorn 222a935223 Update grpc-gateway dependency (#2311)
* chore(deps): Update grpc-gateway dependency

This fixes an issue which would allow an attacker to trigger a
(recovered) panic in the gateway handler.

* fix(server): Use cmp.Diff instead of assert.Equal

Testify is not great at handling protobuf types, and
was for some reason returning a diff here when in
reality there is none. Switch to go-cmp for the
comparison to remove the error.
2022-08-11 20:24:14 -04:00
Zhihe Li 4e9f4ff0cc chore: Bump UI commitsh and update changelog (#2356) 2022-08-11 16:33:42 -04:00
Jeff Mitchell f1b737c62e Fix error validation code in attr parsing (#2353)
For a flag type used for attributes/secrets, values have always been
able to be used with env:// or file:// format, but the error check to
see whether the value was successfully parsed was doing a simple string
equality rather than `errors.Is`. As a result a value containing a colon
would trip up this check and cause an error, rather than allowing it to
be used as a bare value.
2022-08-11 14:39:32 -04:00
Louis Ruch d01f374490 bug(db): Fix credential purpose migration (#2351)
* bug(db): Fix credential purpose migration
2022-08-11 10:41:48 -07:00
Randall Morey adf63c8a5f chore: bump ui commitish to latest (#2350)
* chore: bump ui commitish to latest

* chore: add changelog entry
2022-08-11 09:17:28 -07:00
Michael Gaffney a6d9c228aa Merge branch 'mgaffney-greppable-sql' 2022-08-10 18:25:31 -04:00
Jim 7aa7deafa3 chore: update go-dbw dependencies (#2298)
* chore: update go-dbw dependencies

This update included an update of the upstream gorm dependency.

In the latest update, gorm appears to have become more sensitive when
a slice is passed into operations.  The ptr to slice must now
be a ptr to slice of ptrs.  This change required an update to how
boundary handles slices of PrincipalRole, which now must return a ptr
to PrincipalRole.   There were also some tests that needed to be
updated because of this change.

* fixup! chore: update go-dbw dependencies
2022-08-10 17:20:06 -04:00
Jeff Mitchell 7df1331e93 Update configutil/pluginutil deps (#2346)
Fixes #2343
2022-08-10 16:32:02 -04:00
Louis Ruch 7fafadd70b db: Add credential_sha256 to session_credentials (#2339)
* db: Add credential_sha256 to session_credentials
2022-08-08 18:54:42 -07:00
Michael Gaffney ac6f14a37f style(sql): make migrations more greppable 2022-08-08 18:17:57 -04:00
02dd28f587 Add support for SSH private key passphrases (#2331)
This adds support for encrypted SSH keys via passphrase.

Co-authored-by: Louis Ruch <louisruch@gmail.com>
Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>
2022-08-08 15:15:03 -04:00
Jeff Mitchell 07bca9dd66 Ensure initial upstreams is empty before hcpb worker listing (#2334)
The intention of the code was to have one-hop-away workers list KMS
workers to get initial upstreams, and have other workers continue using
what was in their config file. However, nothing stops people from having
initial_upstreams but _also_ adding a cluster ID in their config file,
in which case we'd always run this check and replace the config-set
initial upstreams. So, ensure the config-set initial upstreams is also
len zero.
2022-08-08 12:39:34 -04:00
Louis Ruch dcccaf1bcf bug(cmd): Ensure RunShutdownFuncs is called when an early error occurs (#2333)
* bug(cmd): Ensure RunShutdownFuncs is called when an early error occurs
2022-08-08 09:13:47 -07:00
Jeff Mitchell 3f5d265cfd Update bats tests with new password paradigm 2022-08-05 19:52:04 -04:00
Jeff Mitchell fa17fdf9d7 Update wording and fix a missing prompt (#2329) 2022-08-05 19:27:14 -04:00
Jeff Mitchell d92cbac37d Update enos/bats with changes 2022-08-05 18:17:07 -04:00
Jeff Mitchell fe2ee7ef4a Change behavior of -token and -password to support env/file only (#2327)
* Revert "Remove `-token` flag (#2303)"

This reverts commit 65cff995d7.

* Change behavior of -token

* Add use of MustParsePath

* Update changelog

* Use errors.Is
2022-08-05 16:08:48 -04:00
Louis Ruch 53dbd51f14 Only consume ssh brokered credentials if the target is tcp (#2323) 2022-08-05 10:22:07 -07:00
Jeff Mitchell 26ffa705e5 Add parsepath logic to password in various places (#2325)
* Add parsepath logic to password in various places:

* Account password create/set/change
* Authenticate

Also fixes a bug where confirmation on a change-password call would run
for the current password instead of the new one.
2022-08-05 13:21:46 -04:00
Jeff Mitchell 090b2b28f8 Clean up some dev config kms code (#2321)
* Clean up some dev config kms code

Although it didn't matter in the combined state, the KMS for auth
storage was not actually being set properly if only a worker was being
instantiated.
2022-08-05 12:12:07 -04:00
Michael Gaffney 661d6a551e test(tcp): only host sets from the same project can be added to a target 2022-08-04 12:01:01 -04:00
Jeff Mitchell 8800ec9c94 Reorganize logic to allow a poison pill (#2317) 2022-08-03 19:29:17 -04:00
Louis Ruch fc25178827 bug(server): Start ops listener even if controller is nil (#2314) 2022-08-02 17:18:09 -07:00
Randall Morey 0a865e0b89 chore: bump ui version (#2310) 2022-07-29 17:40:29 -07:00
Randall Morey bf9ecc879f chore: bump UI version to latest (#2307) 2022-07-29 12:13:13 -07:00
Michele Degges 047b9bea05 Merging ENT updates back into OSS (#2309) 2022-07-29 11:51:26 -07:00
Jeff Mitchell 65cff995d7 Remove -token flag (#2303)
Token values can be shown in output of `ps` and so, and we support env
vars and keyrings, so remove it.
2022-07-29 12:08:43 -04:00
Jeff Mitchell 4bd249d347 Fix some missing net.JoinHostPort calls (#2305) 2022-07-29 12:08:37 -04:00
Jeff Mitchell a67085f663 Add methods to get attributes more easily in Go API (#2299)
* Add methods to get attributes more easily in Go API

* Add type check
2022-07-28 18:17:30 -04:00
9169c6bacb [QTI-220] Add infrastructure integration testing (#2282)
* [QTI-275] Add infrastructure integration testing

On pull requests that originate from branches of the `hashicorp/boundary`
repo, we now conditionally dispatch infrastructure integration tests using
the Enos framework. The `integration` Enos scenario includes two `builder`
variants which allow developers or CI to deploy a Boundary cluster in AWS
using either a local `boundary` install bundle or that which is produced
in the `build` workflow for CRT. The `test` variants determine which type
of infrastructure integration test to run. At present those options are
`cli_ui` (Bats CLI tests) or `smoke` (creates target instances and a
target host catalog and verifies that `boundary` works).

In addition to the new workflow and quality scenarios, we simplified the
some `build` workflow steps and added Go module caching to speed up the
build pipeline.

See the [enos/README.md](https://github.com/hashicorp/boundary/blob/main/enos/README.md)
for a detailed explanation on how to configure and execute Enos scenarios
from your machine.

Signed-off-by: Ryan Cragun <me@ryan.ec>
Co-authored-by: Rebecca Willett <rwillett@hashicorp.com>
Co-authored-by: Josh Branch <jbrand@hashicorp.com>
2022-07-28 14:48:51 -06:00
Damian Debkowski c25b9285c0 fix(test) uncomment ro tests for cred update (#2301) 2022-07-28 11:58:45 -07:00
Damian Debkowski 2cbe65597b fix(creds) fix unit test for ssh private key creds (#2297) 2022-07-27 16:31:10 -07:00
Damian Debkowski 2db5840790 fix(cli) check error value in executeExtraActionsImpl funcs (#2293) 2022-07-27 10:00:00 -07:00
Todd 1aad2627c8 OSS side of second downstream connections (see enterprise PR 69) (#2292) 2022-07-25 12:52:21 -07:00
Louis Ruch 47739566bc bug(vault): Fix token len check (#2291) 2022-07-25 11:08:06 -07:00