vaultkit 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +20 -1
- data/lib/vkit/cli/base_cli.rb +2 -1
- data/lib/vkit/cli/commands/agent_tokens_list_command.rb +2 -11
- data/lib/vkit/cli/commands/approval_watch_command.rb +2 -2
- data/lib/vkit/cli/commands/init_command.rb +2 -2
- data/lib/vkit/cli/commands/policy_pack_upgrade_command.rb +8 -4
- data/lib/vkit/cli/commands/scan_command.rb +1 -1
- data/lib/vkit/cli.rb +1 -1
- data/lib/vkit/core/auth_client.rb +9 -5
- data/lib/vkit/core/credential_store.rb +52 -45
- data/lib/vkit/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 992511b9fff48dc39ffa343776721e9c24077c00cfdbe97b9f98e0f1454f4093
|
|
4
|
+
data.tar.gz: bcc02c8d21f7d0e66d1b30fd16ef2080aedf8271ac7159d775f05bf1e6db15d1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dd8c2496c757661ade482f3ac01bf68ab1d073903db14dec88d9a4d4d40721beb9ea36e8942deb4f9296b3f6e6f49014d1724b8bbfb3d67d351ed886024629bf
|
|
7
|
+
data.tar.gz: 2881996c7f00bb58a92a62d00dea1408ab2ea42c0e0d3acc2fb0f6fc782ac27aa6eac943b458ddcd5dee416debb8714b0f285a7f6954db9d2c9e00290f2206a7
|
data/README.md
CHANGED
|
@@ -200,6 +200,14 @@ Clear stored credentials and end session.
|
|
|
200
200
|
vkit logout
|
|
201
201
|
```
|
|
202
202
|
|
|
203
|
+
### Where the login is saved
|
|
204
|
+
|
|
205
|
+
`vkit login` saves the endpoint and token in the macOS Keychain, or in the Secret
|
|
206
|
+
Service keyring (GNOME Keyring, KWallet) on Linux when `secret-tool` is installed.
|
|
207
|
+
Elsewhere, including Windows, or when saving to the keychain fails (for example, over
|
|
208
|
+
SSH with no unlocked keyring), it saves them to `~/.vkit/credentials.json`, readable
|
|
209
|
+
only by you, and says so. Login tokens expire after an hour.
|
|
210
|
+
|
|
203
211
|
### Credentials from the environment
|
|
204
212
|
|
|
205
213
|
`vkit` normally uses the login saved by `vkit login`, in your OS keychain or
|
|
@@ -232,6 +240,17 @@ VKIT_TOKEN="$APPROVER_TOKEN" vkit approval:approve 42
|
|
|
232
240
|
`vkit login --endpoint` still reads `VKIT_ENDPOINT` as its default endpoint when
|
|
233
241
|
`VKIT_TOKEN` isn't set.
|
|
234
242
|
|
|
243
|
+
### TLS certificates
|
|
244
|
+
|
|
245
|
+
`vkit` checks the control plane's TLS certificate against your system's trusted
|
|
246
|
+
certificates on every HTTPS call, including `vkit login`. If your control plane
|
|
247
|
+
uses a self-signed or private-CA certificate, trust it by pointing
|
|
248
|
+
`SSL_CERT_FILE` at a PEM bundle that includes it:
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
export SSL_CERT_FILE=/path/to/ca-bundle.pem
|
|
252
|
+
```
|
|
253
|
+
|
|
235
254
|
---
|
|
236
255
|
|
|
237
256
|
## 🔄 Core Workflows
|
|
@@ -1174,7 +1193,7 @@ bundle exec rubocop -a
|
|
|
1174
1193
|
|
|
1175
1194
|
## 📚 Additional Resources
|
|
1176
1195
|
|
|
1177
|
-
- **Main Repository**: [github.com/
|
|
1196
|
+
- **Main Repository**: [github.com/vaultkit-inc/vaultkitcli](https://github.com/vaultkit-inc/vaultkitcli)
|
|
1178
1197
|
- **Documentation**: [docs.vaultkit.io](https://docs.vaultkit.io)
|
|
1179
1198
|
- **AQL Specification**: [docs.vaultkit.io/aql](https://docs.vaultkit.io/aql)
|
|
1180
1199
|
- **Policy Reference**: [docs.vaultkit.io/policies](https://docs.vaultkit.io/policies)
|
data/lib/vkit/cli/base_cli.rb
CHANGED
|
@@ -317,7 +317,8 @@ module Vkit
|
|
|
317
317
|
subcommand "tokens", Class.new(Thor) {
|
|
318
318
|
|
|
319
319
|
# agents tokens list
|
|
320
|
-
desc "list", "List tokens
|
|
320
|
+
desc "list", "List agent tokens"
|
|
321
|
+
option :agent, type: :string, desc: "Only show tokens with this agent name"
|
|
321
322
|
option :format, type: :string, default: "table", enum: %w[table json]
|
|
322
323
|
def list
|
|
323
324
|
Commands::AgentTokensListCommand.new.call(
|
|
@@ -14,13 +14,10 @@ module Vkit
|
|
|
14
14
|
user = credential_store.user
|
|
15
15
|
org = user["organization_slug"]
|
|
16
16
|
|
|
17
|
-
response =
|
|
18
|
-
authenticated_client.get(
|
|
19
|
-
"/api/v1/orgs/#{org}/agent_tokens",
|
|
20
|
-
params: build_query(options)
|
|
21
|
-
)
|
|
17
|
+
response = authenticated_client.get("/api/v1/orgs/#{org}/agent_tokens")
|
|
22
18
|
|
|
23
19
|
tokens = response["tokens"] || []
|
|
20
|
+
tokens = tokens.select { |t| t["name"] == options[:agent] } if options[:agent]
|
|
24
21
|
|
|
25
22
|
print_result(tokens, format)
|
|
26
23
|
end
|
|
@@ -28,12 +25,6 @@ module Vkit
|
|
|
28
25
|
|
|
29
26
|
private
|
|
30
27
|
|
|
31
|
-
def build_query(options)
|
|
32
|
-
{}.tap do |q|
|
|
33
|
-
q[:name] = options[:agent] if options[:agent]
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
28
|
def print_result(tokens, format)
|
|
38
29
|
if tokens.empty?
|
|
39
30
|
puts "No tokens found."
|
|
@@ -119,8 +119,8 @@ module Vkit
|
|
|
119
119
|
end
|
|
120
120
|
puts "Created: #{format_time(a["created_at"])}"
|
|
121
121
|
puts
|
|
122
|
-
puts "▶ Approve: vkit approval
|
|
123
|
-
puts "▶ Deny: vkit approval
|
|
122
|
+
puts "▶ Approve: vkit approval:approve #{a["id"]}"
|
|
123
|
+
puts "▶ Deny: vkit approval:deny #{a["id"]} --reason \"…\""
|
|
124
124
|
puts
|
|
125
125
|
end
|
|
126
126
|
|
|
@@ -43,7 +43,7 @@ module Vkit
|
|
|
43
43
|
|
|
44
44
|
puts "\nNext steps:"
|
|
45
45
|
puts " 1. Review policies in config/policies/"
|
|
46
|
-
puts " 2. Run: vkit scan <datasource> --apply"
|
|
46
|
+
puts " 2. Run: vkit scan <datasource> --mode apply"
|
|
47
47
|
puts " 3. Run: vkit policy bundle"
|
|
48
48
|
puts " 4. Run: vkit policy deploy"
|
|
49
49
|
|
|
@@ -71,7 +71,7 @@ module Vkit
|
|
|
71
71
|
# VaultKit Dataset Registry
|
|
72
72
|
#
|
|
73
73
|
# Populate with:
|
|
74
|
-
# vkit scan <datasource> --apply
|
|
74
|
+
# vkit scan <datasource> --mode apply
|
|
75
75
|
# vkit registry export
|
|
76
76
|
#
|
|
77
77
|
YAML
|
|
@@ -17,7 +17,9 @@ module Vkit
|
|
|
17
17
|
if pack_name
|
|
18
18
|
[upgrade_single(manager, pack_name, force)]
|
|
19
19
|
else
|
|
20
|
-
manager.upgrade_all!(force: force)
|
|
20
|
+
manager.upgrade_all!(force: force).map do |name, result|
|
|
21
|
+
summarize(name, result)
|
|
22
|
+
end
|
|
21
23
|
end
|
|
22
24
|
|
|
23
25
|
print_summary(results)
|
|
@@ -31,8 +33,12 @@ module Vkit
|
|
|
31
33
|
private
|
|
32
34
|
|
|
33
35
|
def upgrade_single(manager, pack, force)
|
|
34
|
-
|
|
36
|
+
summarize(pack, manager.upgrade!(pack, force: force))
|
|
37
|
+
rescue => e
|
|
38
|
+
{ name: pack, status: :failed, error: e.message }
|
|
39
|
+
end
|
|
35
40
|
|
|
41
|
+
def summarize(pack, result)
|
|
36
42
|
if result == :up_to_date
|
|
37
43
|
{ name: pack, status: :up_to_date }
|
|
38
44
|
else
|
|
@@ -44,8 +50,6 @@ module Vkit
|
|
|
44
50
|
policies: result[:policies]
|
|
45
51
|
}
|
|
46
52
|
end
|
|
47
|
-
rescue => e
|
|
48
|
-
{ name: pack, status: :failed, error: e.message }
|
|
49
53
|
end
|
|
50
54
|
|
|
51
55
|
def print_summary(results)
|
|
@@ -67,7 +67,7 @@ module Vkit
|
|
|
67
67
|
clean.each { |d| print_clean(d) }
|
|
68
68
|
|
|
69
69
|
puts
|
|
70
|
-
puts " #{changed.size} changed · run with --apply to update baseline"
|
|
70
|
+
puts " #{changed.size} changed · run with --mode apply to update baseline"
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
# Suggestions are reviewed labels the classifier now disagrees with.
|
data/lib/vkit/cli.rb
CHANGED
|
@@ -90,11 +90,7 @@ module Vkit
|
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
def http_request(uri, req, allow_non_200: false)
|
|
93
|
-
|
|
94
|
-
http.use_ssl = uri.scheme == "https"
|
|
95
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
|
96
|
-
|
|
97
|
-
res = http.request(req)
|
|
93
|
+
res = build_http(uri).request(req)
|
|
98
94
|
|
|
99
95
|
return res if allow_non_200
|
|
100
96
|
|
|
@@ -105,6 +101,14 @@ module Vkit
|
|
|
105
101
|
res
|
|
106
102
|
end
|
|
107
103
|
|
|
104
|
+
# Certificates are verified against the system trust store. Point
|
|
105
|
+
# SSL_CERT_FILE at a bundle to trust a self-signed control plane.
|
|
106
|
+
def build_http(uri)
|
|
107
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
108
|
+
http.use_ssl = uri.scheme == "https"
|
|
109
|
+
http
|
|
110
|
+
end
|
|
111
|
+
|
|
108
112
|
def parse_json(res)
|
|
109
113
|
JSON.parse(res.body)
|
|
110
114
|
rescue JSON::ParserError
|
|
@@ -15,6 +15,8 @@ module Vkit
|
|
|
15
15
|
class CredentialStore
|
|
16
16
|
SERVICE = "vkit"
|
|
17
17
|
ACCOUNT = "credentials"
|
|
18
|
+
# security -i reads lines of about 4 KB; a login is well under that.
|
|
19
|
+
MAC_KEYCHAIN_MAX_HEX = 3_900
|
|
18
20
|
|
|
19
21
|
@override_noticed = false
|
|
20
22
|
|
|
@@ -34,15 +36,7 @@ module Vkit
|
|
|
34
36
|
"user" => user
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
when mac?
|
|
39
|
-
mac_keychain_store(payload)
|
|
40
|
-
when linux? && secret_tool_available?
|
|
41
|
-
linux_secret_service_store(payload)
|
|
42
|
-
else
|
|
43
|
-
file_store(payload)
|
|
44
|
-
end
|
|
45
|
-
|
|
39
|
+
store(payload)
|
|
46
40
|
true
|
|
47
41
|
end
|
|
48
42
|
|
|
@@ -56,16 +50,8 @@ module Vkit
|
|
|
56
50
|
return unless payload
|
|
57
51
|
|
|
58
52
|
payload["user"] = user
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
when mac?
|
|
62
|
-
mac_keychain_store(payload)
|
|
63
|
-
when linux? && secret_tool_available?
|
|
64
|
-
linux_secret_service_store(payload)
|
|
65
|
-
else
|
|
66
|
-
file_store(payload)
|
|
67
|
-
end
|
|
68
|
-
end
|
|
53
|
+
store(payload)
|
|
54
|
+
end
|
|
69
55
|
|
|
70
56
|
def endpoint
|
|
71
57
|
load_payload&.dig("endpoint")
|
|
@@ -110,9 +96,8 @@ module Vkit
|
|
|
110
96
|
mac_keychain_delete
|
|
111
97
|
when linux? && secret_tool_available?
|
|
112
98
|
linux_secret_service_delete
|
|
113
|
-
else
|
|
114
|
-
file_delete
|
|
115
99
|
end
|
|
100
|
+
file_delete
|
|
116
101
|
end
|
|
117
102
|
|
|
118
103
|
def clear_token!
|
|
@@ -120,15 +105,7 @@ module Vkit
|
|
|
120
105
|
return unless payload
|
|
121
106
|
|
|
122
107
|
payload.delete("token")
|
|
123
|
-
|
|
124
|
-
case
|
|
125
|
-
when mac?
|
|
126
|
-
mac_keychain_store(payload)
|
|
127
|
-
when linux? && secret_tool_available?
|
|
128
|
-
linux_secret_service_store(payload)
|
|
129
|
-
else
|
|
130
|
-
file_store(payload)
|
|
131
|
-
end
|
|
108
|
+
store(payload)
|
|
132
109
|
end
|
|
133
110
|
|
|
134
111
|
# endpoint and token only; the user is looked up separately (#user),
|
|
@@ -137,15 +114,40 @@ module Vkit
|
|
|
137
114
|
env_override || stored_payload
|
|
138
115
|
end
|
|
139
116
|
|
|
117
|
+
# The keychain first, then the file, which also holds the login when
|
|
118
|
+
# saving to the keychain failed.
|
|
140
119
|
def stored_payload
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
120
|
+
keychain =
|
|
121
|
+
case
|
|
122
|
+
when mac?
|
|
123
|
+
mac_keychain_load
|
|
124
|
+
when linux? && secret_tool_available?
|
|
125
|
+
linux_secret_service_load
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
keychain || file_load
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Saves to the OS keychain when there is one. If that fails (no
|
|
132
|
+
# unlocked keyring over SSH, a locked login keychain), saves to
|
|
133
|
+
# ~/.vkit instead and says so, rather than reporting a login that
|
|
134
|
+
# wasn't kept.
|
|
135
|
+
def store(payload)
|
|
136
|
+
saved =
|
|
137
|
+
case
|
|
138
|
+
when mac?
|
|
139
|
+
mac_keychain_store(payload)
|
|
140
|
+
when linux? && secret_tool_available?
|
|
141
|
+
linux_secret_service_store(payload)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
if saved
|
|
145
|
+
file_delete
|
|
146
|
+
return
|
|
148
147
|
end
|
|
148
|
+
|
|
149
|
+
warn "vkit: couldn't save to the system keychain; saved to #{@fallback_path} instead." unless saved.nil?
|
|
150
|
+
file_store(payload)
|
|
149
151
|
end
|
|
150
152
|
|
|
151
153
|
def override_user(override)
|
|
@@ -171,15 +173,19 @@ module Vkit
|
|
|
171
173
|
system("which secret-tool > /dev/null 2>&1")
|
|
172
174
|
end
|
|
173
175
|
|
|
176
|
+
# `security -i` reads the command from stdin, so the token never
|
|
177
|
+
# appears in the process list, as it would with `-w` on the command
|
|
178
|
+
# line. The data goes in hex (-X) to avoid quoting.
|
|
174
179
|
def mac_keychain_store(payload)
|
|
180
|
+
hex = payload.to_json.unpack1("H*")
|
|
181
|
+
return false if hex.bytesize > MAC_KEYCHAIN_MAX_HEX
|
|
182
|
+
|
|
175
183
|
mac_keychain_delete
|
|
176
|
-
|
|
177
|
-
"security", "
|
|
178
|
-
"-a
|
|
179
|
-
"-s", SERVICE,
|
|
180
|
-
"-w", payload.to_json,
|
|
181
|
-
"-U"
|
|
184
|
+
_stdout, _stderr, status = Open3.capture3(
|
|
185
|
+
"security", "-i",
|
|
186
|
+
stdin_data: "add-generic-password -a #{ACCOUNT} -s #{SERVICE} -U -X #{hex}\n"
|
|
182
187
|
)
|
|
188
|
+
status.success?
|
|
183
189
|
end
|
|
184
190
|
|
|
185
191
|
def mac_keychain_load
|
|
@@ -208,7 +214,7 @@ module Vkit
|
|
|
208
214
|
end
|
|
209
215
|
|
|
210
216
|
def linux_secret_service_store(payload)
|
|
211
|
-
Open3.capture3(
|
|
217
|
+
_stdout, _stderr, status = Open3.capture3(
|
|
212
218
|
"secret-tool",
|
|
213
219
|
"store",
|
|
214
220
|
"--label=VaultKit Credentials",
|
|
@@ -216,6 +222,7 @@ module Vkit
|
|
|
216
222
|
"account", ACCOUNT,
|
|
217
223
|
stdin_data: payload.to_json
|
|
218
224
|
)
|
|
225
|
+
status.success?
|
|
219
226
|
end
|
|
220
227
|
|
|
221
228
|
def linux_secret_service_load
|
|
@@ -234,7 +241,7 @@ module Vkit
|
|
|
234
241
|
end
|
|
235
242
|
|
|
236
243
|
def linux_secret_service_delete
|
|
237
|
-
|
|
244
|
+
system("secret-tool", "clear", "service", SERVICE, "account", ACCOUNT, out: File::NULL, err: File::NULL)
|
|
238
245
|
end
|
|
239
246
|
|
|
240
247
|
def file_store(payload)
|
data/lib/vkit/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vaultkit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nnamdi Ogundu
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: thor
|
|
@@ -124,7 +124,7 @@ licenses:
|
|
|
124
124
|
- Nonstandard
|
|
125
125
|
metadata:
|
|
126
126
|
rubygems_mfa_required: 'true'
|
|
127
|
-
source_code_uri: https://github.com/
|
|
127
|
+
source_code_uri: https://github.com/vaultkit-inc/vaultkitcli
|
|
128
128
|
post_install_message:
|
|
129
129
|
rdoc_options: []
|
|
130
130
|
require_paths:
|