-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: prevent vault commands from stomping on ~/.vault-token (#61)
* fix: prevent vault commands from stomping on ~/.vault-token instead of exec'ing raw vault commands, instead just get the token or login and get the token, but don't overwrite ~/.vault-token * go mod tidy * removed codecov, no longer supported * latest stencil * go mod tidy
- Loading branch information
Showing
6 changed files
with
102 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,8 @@ | |
# syntax, such as anchors, will be fixed automatically. | ||
version: 2.1 | ||
orbs: | ||
shared: getoutreach/shared@dev:2.9.0-rc.4 | ||
shared: getoutreach/shared@dev:2.9.0-rc.12 | ||
queue: eddiewebb/[email protected] | ||
|
||
parameters: | ||
rebuild_cache: | ||
|
@@ -110,6 +111,5 @@ workflows: | |
context: *contexts | ||
filters: | ||
branches: | ||
ignore: /.*/ | ||
tags: | ||
only: /v[0-9]+(\.[0-9]+)*(-.*)*/ | ||
only: | ||
- main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright 2023 Outreach Corporation. All Rights Reserved. | ||
|
||
// Description: test login token parsing | ||
package cli | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"gotest.tools/v3/assert" | ||
) | ||
|
||
func TestVaultLoginTokenJSONPath(t *testing.T) { | ||
expectedTokenID := "s.gNhNGm524pfZDJzIOVk4NGaX" | ||
input := []byte(fmt.Sprintf(`{ | ||
"request_id": "676169b4-d7f9-d94d-ac94-a16891024d73", | ||
"lease_id": "", | ||
"lease_duration": 0, | ||
"renewable": false, | ||
"data": { | ||
"accessor": "X4dXerFDLHFCvfP6nR1Qiz9K", | ||
"creation_time": 1676411158, | ||
"creation_ttl": 43200, | ||
"display_name": "[email protected]", | ||
"entity_id": "697e1d36-03ea-86a3-927d-258b15e30ada", | ||
"expire_time": "2023-02-15T09:45:58.590848523Z", | ||
"explicit_max_ttl": 0, | ||
"external_namespace_policies": {}, | ||
"id": "%s", | ||
"identity_policies": [ | ||
"root-policy" | ||
], | ||
"issue_time": "2023-02-14T21:45:58.59084807Z", | ||
"meta": { | ||
"role": "outreach" | ||
}, | ||
"num_uses": 0, | ||
"orphan": true, | ||
"path": "auth/oidc/oidc/callback", | ||
"policies": [ | ||
"default" | ||
], | ||
"renewable": true, | ||
"ttl": 40988, | ||
"type": "service" | ||
}, | ||
"warnings": null | ||
}`, expectedTokenID)) | ||
actual, err := cmdOutputToToken(input) | ||
assert.NilError(t, err) | ||
assert.Equal(t, expectedTokenID, string(actual)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
name: vault-client | ||
arguments: | ||
coverage: | ||
provider: codecov | ||
circleAPIKey: "" | ||
commands: [] | ||
commitGuard: false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters