Commit Graph
39 Commits
Author SHA1 Message Date
Jim 6a37c93d77 fix: properly handle rows.Err() (#4261)
* fix (auth): properly handle rows.Err()

* fix (auth/ldap): properly handle rows.Err()

* fix (auth/oidc): properly handle rows.Err()

* fix (auth/password): properly handle rows.Err()

* fix (authtoken): properly handle rows.Err()

* fix (credential): properly handle rows.Err()

* fix (credential/static): properly handle rows.Err()

* fix (credential/vault): properly handle rows.Err()

* fix (db): properly handle rows.Err()

* fix (db/schema): properly handle rows.Err()

* fix (db/migrations): properly handle rows.Err()

* fix (host): properly handle rows.Err()

* fix (host/plugin): properly handle rows.Err()

* fix (host/static): properly handle rows.Err()

* fix (iam): properly handle rows.Err()

* fix (kms): properly handle rows.Err()

* fix (oplog): properly handle rows.Err()

* fix (pagination/purge): properly handle rows.Err()

* fix (plugin): properly handle rows.Err()

* fix (job/scheduler): properly handle rows.Err()

* fix (server): properly handle rows.Err()

* fix (session): properly handle rows.Err()

* fix (target): properly handle rows.Err()
2024-01-22 14:03:40 -05:00
Danielle Miu 40477d84c0 add objects to default loopback bucket 2024-01-16 13:53:44 -08:00
dani c43ded06a6 add delete objects command to proto and loopback (#785) 2024-01-16 13:53:38 -08:00
Johan Brandhorst-Satzkorn 16eab12458 internal/plugin: fix typo 2024-01-05 07:43:21 -08:00
Damian Debkowski 12600617ba fix(plugin): remove unit test race condition (#4002) 2023-11-07 09:17:36 -08:00
Jim d5411a26f6 chore: update protobuf dep (#3669) 2023-09-05 13:10:03 -04:00
hashicorp-copywrite[bot]andJohan Brandhorst-Satzkorn 29da0bcb92 [COMPLIANCE] License changes (#3567)
* 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.

* Update copyright file headers to BUS-1.1

* Rerun make gen

This will pick up the last of the license changes

* Revert "Rerun make gen"

This reverts commit dbe0968bffd92745d8663c6940debae098395a6b.

* Remove copywrite from generation script

The current version of copywrite is not sophisticated enough
to only apply the copywrite changes to certain subdirectories,
so to avoid accidentally relicensing our api and sdk modules,
we will stop running the copywrite script until such time
that it can do the right thing.

* License protobuf API as MPL

The protobuf API files are used to generate the SDK,
since we want the SDK to be MPL, the protobuf files
must also be MPL. This extends to all protobuf files
whose sources end up in the SDK directory, including:

- internal/proto/controller/api
- internal/proto/controller/custom_options
- internal/proto/plugin

It also includes the generated service directory in
internal/gen/controller/api/services, since they are
generated from the protobuf sources used for the SDK.

* Change website license file name

This makes the naming scheme consistent with the rest
of the repository.

* Add note on licensing to README

* Set copywrite license to BUSL

* Revert "Add note on licensing to README"

This reverts commit 4d865a91a7a4f11605f0dc4609355d7e3c3cfffe.

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
2023-08-11 10:31:53 -07:00
Damian Debkowski e285a8ef6f refactor: make secrets optional for storage bucket (#3353) 2023-07-19 14:32:33 -07:00
Jeff Mitchell 8322916fb4 Remove all deprecated Err/Wrap/E calls (#3286) 2023-06-14 21:55:24 -04:00
Damian Debkowski e7420eb690 fix(plugin): correct spelling mistake 2023-05-31 12:18:24 +00:00
Damian Debkowski 9aa4d40d95 feat(storage): provide optional chunk size field for GetObject 2023-05-31 12:18:22 +00:00
Damian Debkowski 234c4ade86 refactor(plugin): use flat file system for loopback storage 2023-05-31 12:18:18 +00:00
Damian Debkowski 331254402a feat(loopback): add ability to mock putObject response 2023-05-31 12:18:18 +00:00
Louis Ruch 042c46e00e test(storage): Avoid panic in test when writing to closed channel 2023-05-31 12:18:17 +00:00
Damian Debkowski 95c3b2d56a test(storage): improve loopback mock err & update storage container closed err msg 2023-05-31 12:18:17 +00:00
Danielle Miu bb82fa6507 update storage buckets to use a shared persisted secrets type. add options 2023-05-31 12:18:16 +00:00
Damian Debkowski 39a07252b6 refactor(storage): read from local disk for putObject 2023-05-31 12:18:15 +00:00
Danielle Miu a4a14fc7fc merged commit for plugin rework, storage bucket sql and proto, storage bucket secret rewrapping, storage bucket repository 2023-05-31 12:18:13 +00:00
Louis Ruch 34942e001b feat(loopback): Create directories in object key 2023-05-31 12:18:12 +00:00
Louis Ruch 798a1f952a feat(storage): Add support for storage plugins 2023-05-31 12:18:12 +00:00
Damian Debkowski 9ef94892f4 test(plugin): Support storage service in loopback plugin 2023-05-31 12:18:12 +00:00
Louis Ruch 351444f1bd refact(plugin): Move host loopback plugin into internal/plugin/loopback 2023-05-31 12:18:12 +00:00
Jim 63a2b62b85 chore (deps): update GKW and protobuf; and run "make gen" (#3111) 2023-03-22 14:32:52 -04:00
Johan Brandhorst-Satzkorn 3c29308673 chore: Add license headers to all files 2023-02-03 15:54:27 -08:00
Johan Brandhorst-Satzkorn f57454b6b9 Rewrite interface{} to any (#2535)
* chore: Rewrite interface{} to any

* Add ignore revs
2022-10-25 19:29:38 -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
Johan Brandhorst-Satzkorn f69fbf2255 feat(proto): Format protobuf files with buf (#2033)
Formats all protobuf files with buf format. This ensures
a consistent style across all our protobuf files, similar
to gofumpt.
2022-05-04 11:10:21 -04:00
Johan Brandhorst-Satzkorn 7f9b294a7e refact(all): Use testing.TB for test helpers
Our test helper packages were not possible to use
with benchmarks. This refactor switches to testing.TB
to allow both tests and benchmarks to use the helpers.
2022-04-29 16:33:44 -04:00
Johan Brandhorst-Satzkorn b1d6a1da9a Switch to buf for protobuf generation (#1944)
* Install buf with go install

This reduces the impact of using buf on our dependency
closure, which was significant. It also avoids potential
issues with building buf given our own internal dependency
constraints. This has caused issues (including crashes!)
in the past.

See https://github.com/cockroachdb/cockroach/issues/67216#issuecomment-874176186
for more discussion on using tool dependencies generally, and
https://github.com/bufbuild/buf/issues/52
for an example of where this sort of thing caused an issue for a user.

* Upgrade buf version

We should migrate to v1 sooner rather than later, as it has some
breaking changes from v0.

* Change buf lint/breaking commands

These commands were moved up one level for v1

* Migrate to buf.yaml to v1

* Remove unused imports

These were uncovered by using "buf lint".

* Use buf v1.3.1

* Depend on googleapis and grpc-gateway via BSR

* Switch to buf for proto generation

* Remove third party dependency

* Remove unused tools and scripts

* Move local protos up one level

* Temporarily don't fail on breaking changes

* Generate CI config

* Fix generation of controller.json

* Replace use of deprecated flag

* Remove unused import, regenerate files

* Remove temporary skipping over breaking check
2022-04-04 13:55:42 -04:00
Jim 591ec476e7 refactor: Update internal/db and oplog to use go-dbw package for database operations. (#1785)
* chore: Add new dbw dependency

* refactor: Convert to use dbw.DB

* refactor (db): Change GetTicket(...) signature

* feature (db tests): Added TestDeleteWhere(...)
Adding this allows us to eliminate a leak of the gorm library

* refactor: Add ctx to ScanRows(...) signature
This is required to refactor all the deprecated errors pkg calls.
This refactor required adding a context to quite a few call chains
and in particular the job scheduler bits

* feature (db/tests): Add support for test opt: WithTestLogLevel(...)
This test only option allows callers to specify a log level for the
underlying db package (where supported/applicable) when calling
TestSetup(...)

* refactor (db): Simplify Db type
Only store the underlying *DB and create the *RW on demand when
needed.

* refactor (oplog): Port to using dbw pkg for db operations

* refactor (db): Remove gormDB(...) func

* tests (db): Add unit tests for TestDeleteWhere(...)

* chore: make fmt changes to formatting
2022-01-05 14:38:38 -05:00
Jeff Mitchell 098c3e1f22 Update sdk dep from proper branch and fix building 2021-10-05 21:18:42 -04:00
Jeff MitchellandTodd 7d71618df0 Add more host-catalog and host-set CLI support (#1567)
Add more host-catalog and host-set CLI support

Co-authored-by: Todd <T.Alan.Knight@gmail.com>
2021-09-28 09:40:12 -04:00
Todd a4ea99047f Remove Prefix Id and Plugin Name fields (#1563)
* Remove Prefix Id and Plugin Name fields.  Creating catalogs now require either the plugin id or the name of the plugin resource (but not both).  Host Catalogs and Host Sets API resources now have a read only plugin field populated with plugin info.  Host Catalogs have a plugin id field as a top level field.
2021-09-24 13:16:13 -07:00
ToddandJeff Mitchell bbfef2802f Placeholder Plugin Providers for Repos and added testPlugin struct (#1532)
* Create minimalistic plugin map and test plugin.

* Pass secrets and attributes to the plugin when creating catalogs or sets.  Add tests for CreateSet and CreateCatalog repo methods.

* make fmt and extract out getPrivateCatalog and getCatalog helper methods.

* Exporting TestPluginServer so it can be used in the handlers.

* Keep separate persisted data from host catalogs lookups which facilitate passing it onto the plugins.

* Add TODO to merge get Catalog and get Persisted data.

* Adding tests for unimplemented being returned by the plugin.

* Use GetFields() instead of AsMap() to confirm attributes should be populated. Make clone consistent between catalog and sets.

Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
2021-09-21 09:18:49 -07:00
Todd Knight ce26b0d981 merging type of 2 arguments into a single declaration. 2021-09-08 16:59:54 -07:00
Todd Knight a78f16c969 Adding back accidentally removed tests and removing accidentally re-added proto messages. 2021-09-08 16:58:24 -07:00
Todd Knight 8104ecb3d5 Fix comments describing the requirements of the arguments to CreatePlugin. 2021-09-08 16:47:11 -07:00
Todd Knight 1237d05232 Create a repository to create, lookup, and list host plugins. 2021-09-08 16:41:41 -07:00
Todd KnightandMichael Gaffney db9e1106a9 feat(host): Add host plugin related schemas and tests (#1475)
* feat(host): Add host plugin related schemas and tests

This adds the schema files for host plugins, plugin based catalogs and
plugin based sets.  This also adds the protos and tests which utilize
gorm to ensure the schemas enforce the constraints we expect.

Along with this change was a migration which moved catalog names to the
base type table so we can ensure all catalogs in a single scope,
regardless of subtype, have a unique name.

* Updated plugin schemas to do the following:
- Add plugin_executable table
- plugin table now also has scope_id and name w/ uniqueness constraints
- host_plugin no longer has id_prefix column
- host_plugin separates name and plugin_name
- plugin_version table renamed version to symantic_version column.

* Fix typo in delete_plugin_subtype trigger.  Add update test for host plugins.

* Update id prefixes. Fix public_id typos in protos and plugin_executable name in sql diagrams.

* Created internal/plugin and moved base plugin structs to it and moved host plugin subdirectory to it.

* Created internal/plugin and moved base plugin structs to it and moved host plugin subdirectory to it.

* Add first pass at enums for OS and Arch supported by plugin executables.

* Capitalizing the const enums for OS and Architectures.

* Add comments to sql files.

* Reviewer comments.

Remove unsupported OSes and Archs from SQL and go constants.
Add missing tests.

* Be more permissive in the values the db accepts.

The go logic can restrict which values it will allow getting populated into the db.

* Removing constraints on which values can be placed inside operating_system and architecture columns.

* Updating test helper functions to only create a single catalog or set.

* Move files to new migration version.

* Fixing job/plugin test.

* Update table names, named a number of constraints, remove plugin version and executable tables.

* Add constraints for plugin name and id prefix.

* Rename constraint, remove unhelpful comment block.

* Adding semantic version to plugin_host and set attributes to not null.

* Remove semantic versioning from all locations.

* Remove semantic_version from plugin_host table comment.

* Fix op copy/paste error. Don't use deprecated errors methods. Update constraint names.  Add docs.

* Apply suggestions from code review

Fixing constraint names.

Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>
2021-09-08 10:06:38 -07:00