Commit Graph
49 Commits
Author SHA1 Message Date
shadowdaoandClaude Sonnet 5.5 962d708fdd Rename Go module paths to repo.anhonesthost.net/CyberCoveLLC/threshold
Rename root, api and sdk module paths (imports, go.mod, go_package,
ldflags, build scripts, buf configs) and regenerate protobuf/gateway
code with the project's pinned toolchain. Wire identifiers unchanged.
api gets a local replace for sdk; root/api/sdk require v0.1.0.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 10:33:41 -07:00
shadowdaoandClaude Sonnet 5.5 ab4ed3c9e5 Rebrand user-visible CLI text; add legacy fallbacks for keyring, cache dir and version prefix
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 10:20:06 -07:00
aditya2548 f8363dd06e [COMPLIANCE] Update Copyright & License Headers 2026-04-06 15:48:57 +05:30
429247f407 [COMPLIANCE] Update Copyright Headers (#6282)
* [COMPLIANCE] Update Copyright and License Headers

* chore: make gen to generate files with copyright headers

* chore: update missed copyright headers

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Justin Nguyen <justin.nguyen@hashicorp.com>
2026-01-28 11:05:07 -06:00
Hugo bf9dbd818e chore(cmd): Remove IntVar and move to Int64Var 2024-08-21 13:55:58 +01:00
Todd 78e10864c4 Add alias CLI CRUDL commands (#4353)
* Add alias CLI CRUDL commands
2024-02-29 15:51:24 -08:00
Michael Milton 2e69d59dd2 feat(billing): Add cli subcommand for monthly active user counts 2024-02-23 15:44:10 +00:00
Irena Rindos da30653486 commands: fix plurals (#4369)
* commands: fix plurals
2024-02-07 12:45:28 -05:00
Hugo 08e8d96514 feat(cmd): Policies 2024-01-16 13:53:44 -08:00
Todd 3a7ea64a31 Add skip daemon flag and send recently authed tokens to daemon (#3883)
* Add skip daemon flag and send recently authed tokens to daemon

* Rename flag skip-daemon to skip-cache-daemon

* adding option test

* move common.Options to base.Option

* SocketAddress returns *url.URL, fix search test
2024-01-05 07:43:20 -08:00
b6df5693b5 Add generic read/update/delete commands (#3992)
* Add generic read/update/delete commands

This adds three generic commands that use the resource prefix to
determine the subcommand to run and pass through args over to that
subcommand. Since this occurs very early on and to avoid loading
essentially every internal resource package, I moved subtype definitions
to globals.

This replaces #3967

Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>

* De-duplicate Subtype code (#4031)

Co-authored-by: Timothy Messier <tim.messier@gmail.com>

---------

Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Co-authored-by: Timothy Messier <tim.messier@gmail.com>
2023-11-15 19:55:46 -05:00
Jeff Mitchell a9e372930d Revert 0bf60996c5 (#3990)
Post-merge some issues were discovered with the ways typing is used for
proto reflection. This will be reworked without moving the subtypes
around.
2023-11-02 16:03:47 -04:00
Jeff MitchellandJohan Brandhorst-Satzkorn 0bf60996c5 Add generic read/update/delete commands (#3967)
* Add generic read/update/delete commands

This adds three generic commands that use the resource prefix to
determine the subcommand to run and pass through args over to that
subcommand. Since this occurs very early on and to avoid loading
essentially every internal resource package, I moved subtype definitions
to globals.

* Update main.go

Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>

* Update changelog and remove another deprecated command

---------

Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
2023-11-01 16:24:16 -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
irenarindos 8c96d3ef9b fix(cmd): add session recording resource prefixes 2023-05-31 12:18:24 +00:00
Haotian f88547bbf5 fix(cli): update plural resource mentions in generated help texts (#2918) 2023-02-07 09:28:18 -08:00
Johan Brandhorst-Satzkorn 3c29308673 chore: Add license headers to all files 2023-02-03 15:54:27 -08:00
Timothy Messier 89a55632ba feat(cli): Add vault ssh certificate credential library 2023-02-02 17:43:17 +00:00
Jeff MalnickandJeff Mitchell a3c4cef648 Use primary auth method if no auth method ID is provided (#2725)
* feat: default to using primary auth method with authenticating

* Add ability to specify scope ID flag in authenticate method

---------

Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
2023-01-31 10:07:10 -08:00
Jeff Mitchell b286060ea8 Fix string regression in attribute parsing (#2759)
In #2721, the ability for key-only values was added via using a
wrapperspb.StringValue that could be null. This introduced a bug because
originally the default case for `-attr` was to get the string value but
instead it used the incoming value as-is to allow for nulls; the null
check was moved up later but the original behavior was not restored. As
a result, non-explicitly-quoted strings carried through the
wrapperspb.StringValue, resulting in a map for the value in JSON instead
of a string.

This also fixes the ability to set explicitly quoted strings.
2023-01-05 13:25:59 -05:00
Irena Rindos 078f5e9328 Fix failing attribute flag test (#2755) 2023-01-04 14:32:12 -05:00
Jeff Mitchell 098248be18 Add the ability for CLI map values to contain keys only, which map to JSON nulls (#2721) 2023-01-04 12:44:11 -05:00
Jeff Mitchell 5353725278 Merge duplicated attr/secret/kv flag handling into one function (#2720) 2022-12-15 13:01:57 -05: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
Damian Debkowski 546c5dc5be feat: static json credentials (#2423) 2022-09-16 15:00:04 -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 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
irenarindos 80752e9a24 cli(workers): Add extra help func 2022-06-15 10:18:40 -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
Jim f63ca1313c feature (kms/audit): Add base audit key type (#1651)
* feature (db): Add the ability to enable debug output for a connection

* refactor: Use scope.Global instead of "global"

* feature (db/migrations): Add kms audit keys

Add schema changes to support a new DEK for audit crypto operations.

* feature (kms/audit): Add audit key type

All the bits required to define a new DEK concrete type for
operating on audit entries.

* refactor (db): Remove deprecated migration unit tests.

We added a new audit DEK to kms.CreateKeysTx(...).  Unfortunately,
unit tests like TestMigrations_UserDimension,
Test_PrimaryAuthMethodChanges and TestMigrations_CredentialDimension
have an indirect dependency on a specific historical set of DEKs via
an indirect call kms.CreateKeysTx.  This of course fails because the
new DEK's tables is not a part of pinned migration versions that these
tests depend on.
2021-11-04 09:34:01 -04:00
Oleg Butuzov 5a2fa689a7 refactor: replace (*regexp.Regexp).Match on (*regexp.Regexp).MatchString (#1617)
This PR change one method of regexp.Regexp struct with a similar one,
as result code produce less allocations on heap.
2021-10-21 08:02:15 -04:00
Jeff Mitchell 217adfc4d2 Pull over CombinedSliceFlagValue from WIP plugin-hostcatalogs (#1582)
I've pulled over files as-is for the most part so this also pulls over
some common attribute/secret flags but it's not worth dealing with the
merge later...
2021-10-07 15:30:39 -04:00
df35699c4e Integrate with Vault to retrieve and manage per session credentials (#1308)
* Fix down migrations

* Udpates due to merge

* Sentinel values only have to be greater than 0

* Create credential related sdk structs and methods.

* Post merge interface updating.

* Removing scratch code that was not cleaned up.

* updates

* Convert client certificate and client certificate keys into pem blocks and validate.

* Add newline at end of file.

* Faster check for "s" at the end of a resource name when generating from templates.

* make fmt

* updates

* Add dynamic credentials to a session

* Refactor: move contents of file

* updates

* Updates

* Add InvalidDynamicCredential error

* Assign credentials

* Allow updating client certificates seperate from the client certificate key.

* Replace application purpose string with enum value

* PR feedback / fix go test .

* Delete dead code

* Use common view

* Refactor: extract interface and rename method

* Refactor: move code to eliminate privPurpLibrary

* Add comment to requestMap

* Refactor: do not export methods on an unexported struct

* Update internal/db/schema/migrations/postgres/10/03_vault_credential.up.sql

Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>

* Add comments to credential Purpose constants

* Reorder switch statements to handle errors first

* PR feedback

* update

* fix merge

* Organizing the scheduler code and extract the individual store creation test helper function.

* Run 'make fmt'

* Create certificate when creating store.  Allow vault address to be passed in as option

* Refactor: rename database views and associated structs

This change renames two database views and associated go structs to use
a consistent naming pattern. Views ending in 'private' contain encrypted
credentials needed for connecting to Vault. Views ending in 'public'
mirror the 'private' views but do not include any encrypted values.

This change does not include any changes to functionality or behavior.

* Adding SAD target operations for credential libraries to the SDK.

* Add status field and enumeration table for credential status

* Refactor: rename Status to TokenStatus

* Add status to vault credentials

* Creating the template for the CLI and helper functions.

* Add private database view for vault credentials

* Add scope_id to view and cleanup TODO comment

* Reformat embedded sql queries

* Add vault client helpers

* updates

* white space

* Add LookupLease test

* CLI commands for Store work.  Renamed fields in proto w/ vault prefix.

* Test issue credentials with client TLS

* Add additional checks to vault ping

* Add an error for vault token capabilities and create a VaultToken error kind

* Add support for working with Vault policies

* Use Vault 1.7.2 for testing

* Add testing helper for creating a vault client with a non-root token

* Fix Vault renew lease test

The Vault renew lease endpoint accepts an optional duration parameter
for requesting the number of seconds to extend the lease by. However,
Vault is not required to honor this request.

* Add a var for the required capabilities of a boundary Vault token

* Enhance the test helper for adding a policy to Vault

* Allow the test role in postgresql to revoke credentials

* Remove out of date comments

* Enhance Vault test helpers for the database secrets engine

* Reformat comments

* Add a method for getting the capabilities of the current Vault token

* Add revoke lease to internal Vault client

* Reformat: combine err return line with check for nil line

* Remove redundant checks in test code

Remove checks in test code that are redundant with checks in the test
harness.

* Refactor CreateToken test helper to return the secret and the token

* Fix build failures caused by signature change in vault.CreateToken

* Fix Vault version and Vault API link in comments

* ran `make gen` after merging from mgaffney-vault.

* Remove Vault prefix from attribute fields in API, create a base CLI option for adding field prefixes. format now uses that prefix for error reporting.

* Template now allows attaching attribute field prefixes.

* Credential store uses PrefixAttributeFieldErrorsWithSubactionPrefix.

* Fixing naming of vault flags and helper flags.

* Updating more references to generated api methods.

* Make the capabilities String method more readable

* Add comment outlining PrintApiError usage of Options.

* Refactor test to move declarations closer to first use

* Fix comment

* Implement revoke method on vault repository

* Tests now verify certs, CA, and tokens, addresses can be updated in a store.

* Added test for creating store with pk/cert in same field.

* Allo updating certificates seperate from private key.  Only contact backing vault service when updating token.

* Fixing bad tests and removing unused code.

* Adding tests for various ways of updating tokens.

* Add private credential

* Add token revocation job and cred renewal/revocation job

* Regen after merge.

* Fixing field mask related merge error.

* Create Library CLI. Removes vault prefix from path. Adds a WithoutCleanup testOption for vault.

* Set all credentials to revoked when a token is revoked

* Fixing missed renaming update.

* fix copy/paste error.

* Fixing code generation errors after merge.

* make gen after merge.

* Update internal/cmd/commands/credentialstorescmd/vault_funcs.go

Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>

* Update internal/cmd/commands/credentialstorescmd/vault_funcs.go

Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>

* Update internal/cmd/commands/credentialstorescmd/vault_funcs.go

Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>

* Refactor: move migrations from 10 to 12

* Removing logic from transaction.

* wrapping client errors in the calling op for CredentialStore's client() method.

* Redact token

* redact client key

* updates

* Add trigger to revoke credentials when session is canceled or terminated

* Fixing some help text for some flags.

* Add ability to load values from files (file://) or environment variables (env://).

* Updating comments

* fix bad merge

* feedback

* Adding issued credentials to sessions.

* Error on capabilities

* updates

* Expose NewVaulTestServer

* Add godoc

* Adding generated SessionCredential struct for API.

* Progress on building handler test for Authorize Session.

* feedback

* Update policies

* Add 'revoke' as a status for Vault Tokens

* Add delete_time to vault credential store

* Create dynamic credentials at session creation time.

* Tests pass with credentials attached to AuthorizedSession result.

* Only call issue if there are credentials to issue.

* Fixing output only issues. Adding type to credential library.

* Fix test to clear un/pw generated.  confirm generated un/pw changes from 1 authorize session call to another.

* Update lookupTokenError

* Add delete_time to private credential store

* Refactor: move private store to separate file

* Fixing tests for AuthorizeSession and verifying error cases.

* Only create the credential repo if there are credentials to issue.

* Rename Library field to CredentialLibrary.

* Fixing missing change of Library to CredentialLibrary.

* Removing Default SDK functions for fields which are required and update CLI to match.

* Replace resource specific id variables with "id" and the input parmater for paths to be just a single string and the resource name as it should show up in the path.

* Soft delete vault credential stores

* Prevent new SQL functions from silently overwriting existing functions

* Rename "Hmac" to "HMAC" in the human readable cli response table.

* Fix tests

* Add vault database cleanup jobs

* Add ability to set the token period in the vault test harness

* updates

* Add not_null_columns func test

* remove unused struct

* Up no output timeout

* Validate current vault token on addr update

* Fix client cert change test

* add cert test

* Update revocation job where

* Fix comment

* Use Vault's default port in CLI help strings

* Remove down migrations

* Increase migration file numbers by 1

* Run make migrations

* Move migrations from 12 to 10

* Increase Circle CI timeout for acceptance tests

* Fix spelling mistake in error messages

* ASD cmds for Target and returning credentials to AuthSession request (#1338)

* Add Add/Set/Remove commands for libraries on Targets.  Return credentials on AuthorizeSession request.

Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>

Co-authored-by: Louis Ruch <louisruch@gmail.com>
Co-authored-by: Todd Knight <T.Alan.Knight@gmail.com>
Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
2021-06-22 22:26:26 -04:00
Jeff Mitchell 306d4fb4d3 Add API/CLI for managed groups (#1265) 2021-06-02 14:05:10 -04:00
Michael Gaffney 21033a6174 Refactor: multiple rename to fix the spelling of subtype (#1227)
The definition of 'subtype' is 'a secondary or subordinate type'. The
'T' should not be capitalized (unless it is referring to a type of
submarine, which its not).
2021-05-17 15:36:45 -04:00
Jeff Mitchell 519efa6dd1 Add -filter to CLI listing and website docs (#967)
* Add -filter to CLI listing.

This doesn't include docs/Changelog yet, that will come shortly.

* Add changelog

* Add website docs and fix a curl output bug
2021-03-01 09:23:17 -08:00
Jeff Mitchell 6b58a3317d Add recursive listing to roles (#881)
This also lays the framework for adding recursive listing to the rest of the resources.
2021-01-23 13:39:04 -05:00
Jeff Mitchell 813d21565f Allow authorize-session to be invoked with target name (#737) 2020-10-22 08:40:00 -04:00
Jeff Mitchell 97e8613eb7 Fix hyphenation of resource subcommand output (#689)
* Fix hyphenation of resource subcommand output

Fixes #686
2020-10-15 19:29:33 -04:00
Jeff Mitchell 603b0582d7 Fix CLI help output and make more consistent (#605) 2020-10-09 20:26:48 -04:00
Jeff Mitchell f8a2100603 Add various env vars to CLI (#528)
* Add auth method ID env var

* Add env var for host catalogs
2020-10-02 19:20:30 -04:00
Jeff Mitchell c30fd5620e Add account add/set/remove to CLI (#473) 2020-09-26 13:58:48 -04:00
Jeff Mitchell 35c3f5b717 Use 'at' for auth token prefix (#397) 2020-09-21 16:04:13 -04:00
Jeff Mitchell 3c13e4765d Verbose isn't actually used right now so don't expose it; fix some wording for scope id flag 2020-09-16 08:50:43 -04:00
Todd Knight c3ecea172d Generate new version of SDK resources and Add Tests (#331) 2020-09-08 16:27:51 -04:00
Jeff Mitchell 20aef738c4 Add host-catalogs CLI command. (#312) 2020-08-28 00:17:09 -04:00
Jeff Mitchell adfc5681be Auth methods CLI (#277) 2020-08-18 17:46:34 -04:00
Jeff Mitchell efaf58b568 Add users CLI command and do some cleanup (#269) 2020-08-13 20:59:32 -04:00
Jeff Mitchell b75a6fc5e5 Update scopes CLI command in the model of the roles command (#262)
* Update scopes CLI command in the model of the roles command

* Pull help functions to helper methods
2020-08-13 11:20:22 -04:00