vaultkit 1.4.0 → 2.0.0

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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +163 -30
  3. data/bin/vkit +8 -0
  4. data/lib/vkit/cli/api/client.rb +15 -3
  5. data/lib/vkit/cli/base_cli.rb +92 -14
  6. data/lib/vkit/cli/commands/agent_tokens_create_command.rb +69 -5
  7. data/lib/vkit/cli/commands/agent_tokens_list_command.rb +2 -0
  8. data/lib/vkit/cli/commands/agent_tokens_revoke_command.rb +2 -0
  9. data/lib/vkit/cli/commands/approval_command.rb +8 -0
  10. data/lib/vkit/cli/commands/approval_watch_command.rb +6 -5
  11. data/lib/vkit/cli/commands/base_command.rb +56 -2
  12. data/lib/vkit/cli/commands/datasource_command.rb +137 -20
  13. data/lib/vkit/cli/commands/doctor_command.rb +69 -0
  14. data/lib/vkit/cli/commands/fetch_command.rb +7 -1
  15. data/lib/vkit/cli/commands/grant_revoke_command.rb +3 -0
  16. data/lib/vkit/cli/commands/init_command.rb +63 -10
  17. data/lib/vkit/cli/commands/login_command.rb +38 -4
  18. data/lib/vkit/cli/commands/logout_command.rb +54 -1
  19. data/lib/vkit/cli/commands/policy_bundle_command.rb +114 -26
  20. data/lib/vkit/cli/commands/policy_deploy_command.rb +113 -7
  21. data/lib/vkit/cli/commands/policy_pack_add_command.rb +16 -1
  22. data/lib/vkit/cli/commands/policy_pack_info_command.rb +10 -2
  23. data/lib/vkit/cli/commands/policy_pack_list_command.rb +4 -0
  24. data/lib/vkit/cli/commands/policy_pack_remove_command.rb +3 -0
  25. data/lib/vkit/cli/commands/policy_pack_upgrade_command.rb +35 -1
  26. data/lib/vkit/cli/commands/policy_revoke_command.rb +4 -0
  27. data/lib/vkit/cli/commands/policy_validate_command.rb +4 -1
  28. data/lib/vkit/cli/commands/registry_diff_command.rb +14 -2
  29. data/lib/vkit/cli/commands/registry_export_command.rb +30 -1
  30. data/lib/vkit/cli/commands/request_command.rb +27 -4
  31. data/lib/vkit/cli/commands/requests_list_command.rb +2 -0
  32. data/lib/vkit/cli/commands/reset_command.rb +12 -7
  33. data/lib/vkit/cli/commands/scan_command.rb +100 -0
  34. data/lib/vkit/cli/commands/setup_login_command.rb +274 -0
  35. data/lib/vkit/cli/commands/whoami_command.rb +16 -2
  36. data/lib/vkit/cli/doctor/mcp_probe.rb +108 -0
  37. data/lib/vkit/cli/doctor.rb +698 -0
  38. data/lib/vkit/cli/error_map.rb +243 -0
  39. data/lib/vkit/cli/errors.rb +32 -0
  40. data/lib/vkit/cli/output.rb +161 -0
  41. data/lib/vkit/cli/policy_bundle_validator.rb +8 -0
  42. data/lib/vkit/cli/secret_input.rb +50 -0
  43. data/lib/vkit/cli.rb +12 -2
  44. data/lib/vkit/core/auth_client.rb +57 -1
  45. data/lib/vkit/core/credential_store.rb +38 -1
  46. data/lib/vkit/core/user_agent.rb +30 -0
  47. data/lib/vkit/policy/approval_groups.rb +47 -0
  48. data/lib/vkit/policy/bundle_compiler.rb +15 -3
  49. data/lib/vkit/policy/git_state.rb +114 -0
  50. data/lib/vkit/policy/match_check.rb +7 -1
  51. data/lib/vkit/policy/packs/ai_safety/metadata.yaml +2 -2
  52. data/lib/vkit/policy/packs/ai_safety/policies/01_require_approval_agents_sensitive_prod.yaml +3 -3
  53. data/lib/vkit/policy/packs/ai_safety/policies/04_require_approval_agents_financial_prod.yaml +23 -0
  54. data/lib/vkit/policy/packs/financial_compliance/metadata.yaml +2 -2
  55. data/lib/vkit/policy/packs/financial_compliance/policies/01_require_approval_financial_prod.yaml +3 -2
  56. data/lib/vkit/policy/policy_validator.rb +74 -1
  57. data/lib/vkit/policy/schema/policy_bundle.schema.json +14 -2
  58. data/lib/vkit/version.rb +1 -1
  59. metadata +41 -2
@@ -29,17 +29,52 @@ module Vkit
29
29
  @fallback_path = File.join(Dir.home, ".vkit", "credentials.json")
30
30
  end
31
31
 
32
- def save(endpoint:, token:, user:)
32
+ # setup: for a setup session's token (`vkit login --setup`), what
33
+ # marks it as one: { "expires_at", "organization" }. A normal login
34
+ # saves none, which also drops a setup session's.
35
+ def save(endpoint:, token:, user:, setup: nil)
33
36
  payload = {
34
37
  "endpoint" => endpoint,
35
38
  "token" => token,
36
39
  "user" => user
37
40
  }
41
+ payload["setup"] = setup if setup
38
42
 
39
43
  store(payload)
40
44
  true
41
45
  end
42
46
 
47
+ # The saved login's setup session ({ "expires_at", "organization" }),
48
+ # or nil for a normal login. Credentials from the environment have
49
+ # none: the control plane says when a setup token there expires.
50
+ def setup_session
51
+ return nil if env_override
52
+
53
+ stored_payload&.dig("setup")
54
+ end
55
+
56
+ # A setup session that was requested but not yet approved, kept so
57
+ # `vkit login --setup --wait` can pick it up in a later command:
58
+ # { "endpoint", "device_code", "user_code", "verification_url",
59
+ # "verification_url_complete", "interval", "expires_at" }.
60
+ def pending_setup
61
+ stored_payload&.dig("pending_setup")
62
+ end
63
+
64
+ def save_pending_setup(pending)
65
+ payload = stored_payload || {}
66
+ payload["pending_setup"] = pending
67
+ store(payload)
68
+ end
69
+
70
+ def clear_pending_setup!
71
+ payload = stored_payload
72
+ return unless payload&.key?("pending_setup")
73
+
74
+ payload.delete("pending_setup")
75
+ store(payload)
76
+ end
77
+
43
78
  def save_user(user)
44
79
  if env_override
45
80
  @override_user = user
@@ -105,6 +140,8 @@ module Vkit
105
140
  return unless payload
106
141
 
107
142
  payload.delete("token")
143
+ payload.delete("setup")
144
+ payload.delete("pending_setup")
108
145
  store(payload)
109
146
  end
110
147
 
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rbconfig"
4
+ require_relative "../version"
5
+
6
+ module Vkit
7
+ module Core
8
+ # The User-Agent on every request vkit makes, e.g.
9
+ # "vkit/1.5.0 (macOS arm64; ruby 3.3.6)", so the console's setup-session
10
+ # approval page (and the control plane's logs) show what asked, rather
11
+ # than Net::HTTP's bare "Ruby".
12
+ module UserAgent
13
+ module_function
14
+
15
+ def to_s
16
+ @to_s ||= "vkit/#{Vkit::VERSION} (#{os_name} #{RbConfig::CONFIG['host_cpu']}; ruby #{RUBY_VERSION})"
17
+ end
18
+
19
+ def os_name(host_os = RbConfig::CONFIG["host_os"])
20
+ case host_os
21
+ when /darwin/ then "macOS"
22
+ when /linux/ then "Linux"
23
+ when /mswin|mingw|cygwin/ then "Windows"
24
+ when /freebsd/ then "FreeBSD"
25
+ else host_os
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Vkit
4
+ module Policy
5
+ # Approval group rules shared with the control plane
6
+ # (User::RESERVED_GROUPS and PolicyApprovals::Staffing there):
7
+ #
8
+ # - Built-in role names can't be approval groups. Admins can already
9
+ # approve any request, and a group named admin would let its members
10
+ # approve as admins.
11
+ # - A group nobody active is in doesn't stop a deploy, but warns: org
12
+ # admins approve its requests until someone is added.
13
+ module ApprovalGroups
14
+ RESERVED = %w[admin member approver agent].freeze
15
+ WARNING_CODE = "approval_group_has_no_members"
16
+ WARNING = "%<group>s has no members, so org admins will approve its requests until someone is added."
17
+
18
+ module_function
19
+
20
+ # Every group a compiled bundle's require_approval policies name, as
21
+ # approver_role or in approver_roles, sorted.
22
+ def named(bundle)
23
+ Array(bundle["policies"]).flat_map do |policy|
24
+ next [] unless policy["action"].to_s == "require_approval"
25
+
26
+ approval = policy["approval"] || {}
27
+ ([approval["approver_role"]] + Array(approval["approver_roles"])).map { |r| r.to_s.strip }
28
+ end.reject(&:empty?).uniq.sort
29
+ end
30
+
31
+ # One warning per named group with no active members, given the
32
+ # groups GET /approval_groups returns. Control planes from before
33
+ # active_member_count send member_count, which counts active members.
34
+ def warnings(bundle, groups)
35
+ members = Array(groups).to_h do |g|
36
+ [g["name"].to_s, (g.key?("active_member_count") ? g["active_member_count"] : g["member_count"]).to_i]
37
+ end
38
+
39
+ named(bundle).filter_map do |group|
40
+ next if members.fetch(group, 0).positive?
41
+
42
+ { "code" => WARNING_CODE, "group" => group, "message" => format(WARNING, group: group) }
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -15,7 +15,13 @@ module Vkit
15
15
 
16
16
  # Raises if a policy can never match (see MatchCheck), or if an
17
17
  # installed pack is missing policies (see PackIntegrity).
18
- def self.compile!(org_slug:, bundle_version:, policies_dir:, registry_dir:, source: {}, project_root: Dir.pwd)
18
+ #
19
+ # The checksum covers created_at (the control plane checks the whole
20
+ # bundle), so a rebuild only gets the same checksum, and a redeploy is
21
+ # a no-op, when created_at comes from the inputs rather than the clock.
22
+ # `vkit policy bundle` passes the commit's time; see its created_at.
23
+ def self.compile!(org_slug:, bundle_version:, policies_dir:, registry_dir:, source: {}, project_root: Dir.pwd,
24
+ created_at: Time.now)
19
25
  policies = load_policies(policies_dir)
20
26
  installed_packs = PackIntegrity.check!(project_root: project_root, policies_dir: policies_dir, policies: policies)
21
27
  raw_registry = load_raw_registry(registry_dir)
@@ -27,7 +33,7 @@ module Vkit
27
33
  "format_version" => FORMAT_VERSION,
28
34
  "org_slug" => org_slug,
29
35
  "bundle_version" => bundle_version,
30
- "created_at" => Time.now.utc.iso8601,
36
+ "created_at" => created_at.utc.iso8601,
31
37
  "source" => normalize_source(source),
32
38
  "checksum" => "" # filled below
33
39
  },
@@ -121,9 +127,15 @@ module Vkit
121
127
  "allow"
122
128
  end
123
129
 
130
+ # One group stays approver_role, as older control planes read it;
131
+ # several become approver_roles with their approval_mode.
124
132
  def self.extract_approval(p)
125
133
  return unless p.dig("action", "require_approval")
126
- { "approver_role" => p.dig("action", "approver_role") }
134
+
135
+ roles = p.dig("action", "approver_roles")
136
+ return { "approver_role" => p.dig("action", "approver_role") } unless roles
137
+
138
+ { "approver_roles" => roles, "approval_mode" => p.dig("action", "approval_mode") || "all" }
127
139
  end
128
140
 
129
141
  def self.extract_masking(p)
@@ -0,0 +1,114 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "open3"
4
+ require "pathname"
5
+ require "time"
6
+
7
+ module Vkit
8
+ module Policy
9
+ # The git state of a policy project, for a bundle's version and source.
10
+ # A bundle's version is the commit its policies were committed in, so it
11
+ # can be traced back to them; that only holds when nothing the bundle
12
+ # reads has changed since that commit.
13
+ class GitState
14
+ attr_reader :root
15
+
16
+ def initialize(root)
17
+ @root = root
18
+ end
19
+
20
+ def repo?
21
+ git("rev-parse", "--is-inside-work-tree").first == "true"
22
+ end
23
+
24
+ # nil in a repo with no commits yet.
25
+ def head
26
+ out, ok = git("rev-parse", "--verify", "--quiet", "HEAD")
27
+ ok && !out.empty? ? out : nil
28
+ end
29
+
30
+ # When rev was committed (its committer date), or nil.
31
+ def commit_time(rev)
32
+ out, ok = git("show", "-s", "--format=%cI", rev, "--")
33
+ ok && !out.empty? ? Time.iso8601(out) : nil
34
+ rescue ArgumentError
35
+ nil
36
+ end
37
+
38
+ def branch
39
+ out, ok = git("rev-parse", "--abbrev-ref", "HEAD")
40
+ ok && !out.empty? && out != "HEAD" ? out : nil
41
+ end
42
+
43
+ def remote_url
44
+ out, ok = git("config", "--get", "remote.origin.url")
45
+ ok && !out.empty? ? out : nil
46
+ end
47
+
48
+ # Whether rev names a commit in this repository (a bundle version
49
+ # that's a commit SHA, rather than a --version label).
50
+ def commit?(rev)
51
+ return false if rev.to_s.strip.empty? || rev.to_s.start_with?("-")
52
+
53
+ git("cat-file", "-e", "#{rev}^{commit}").last
54
+ end
55
+
56
+ # Whether anything under `paths` differs between two commits. Paths
57
+ # are relative to `root`; ones that exist in neither are ignored.
58
+ def changed_between?(from, to, paths)
59
+ out, ok = git("diff", "--name-only", from, to, "--", *paths)
60
+ raise "git diff failed in #{root}" unless ok
61
+
62
+ !out.empty?
63
+ end
64
+
65
+ # How many commits `to` has that `from` doesn't (nil when unknown).
66
+ def commits_between(from, to)
67
+ out, ok = git("rev-list", "--count", "#{from}..#{to}")
68
+ ok ? out.to_i : nil
69
+ end
70
+
71
+ # Files under `paths` that differ from HEAD: modified, staged, new,
72
+ # deleted, or ignored by .gitignore (they'd be bundled but never
73
+ # committed). [{ path:, ignored: }], with paths relative to `root`.
74
+ def uncommitted(paths)
75
+ existing = paths.select { |p| File.exist?(File.join(root, p)) }
76
+ return [] if existing.empty?
77
+
78
+ out, ok = git_raw("status", "--porcelain=v1", "--untracked-files=all", "--ignored=traditional", "--", *existing)
79
+ raise "git status failed in #{root}" unless ok
80
+
81
+ out.lines.map(&:chomp).reject(&:empty?).map do |line|
82
+ path = line[3..].sub(/\A"(.*)"\z/, '\1').split(" -> ").last.chomp("/")
83
+ { path: from_root(path), ignored: line.start_with?("!!") }
84
+ end
85
+ end
86
+
87
+ private
88
+
89
+ # git status prints paths relative to the repository's top level, which
90
+ # isn't `root` when the policy project is a subfolder of a bigger repo.
91
+ def from_root(path)
92
+ top, = git("rev-parse", "--show-toplevel")
93
+ Pathname.new(File.join(File.realpath(top), path))
94
+ .relative_path_from(Pathname.new(File.realpath(root))).to_s
95
+ end
96
+
97
+ # [stripped stdout, success?], for commands that print one value.
98
+ def git(*args)
99
+ out, ok = git_raw(*args)
100
+ [out.strip, ok]
101
+ end
102
+
103
+ # [stdout, success?] as printed: `git status --porcelain` lines start
104
+ # with a status column that may be a space. Never raises when git is
105
+ # missing.
106
+ def git_raw(*args)
107
+ out, _err, status = Open3.capture3("git", *args, chdir: root)
108
+ [out, status.success?]
109
+ rescue SystemCallError
110
+ ["", false]
111
+ end
112
+ end
113
+ end
114
+ end
@@ -19,7 +19,10 @@ module Vkit
19
19
  SENSITIVITIES = %w[high medium low unknown].freeze
20
20
 
21
21
  MATCH_KEYS = %w[dataset fields context].freeze
22
- FIELD_KEYS = %w[any all contains sensitivity].freeze
22
+ FIELD_KEYS = %w[any all contains sensitivity usage].freeze
23
+ # row: the query reads the field value by value (or MIN/MAX of it);
24
+ # aggregate: it only counts, sums, averages or groups by it.
25
+ USAGES = %w[row aggregate].freeze
23
26
  CONTEXT_KEYS = %w[environment dataset_region requester_role requester_region requester_clearance time].freeze
24
27
  ENVIRONMENTS = %w[production staging development sandbox].freeze
25
28
  REGIONS = %w[EU US CA APAC].freeze
@@ -86,6 +89,9 @@ module Vkit
86
89
  if fields.key?("sensitivity") && !@sensitivities.include?(fields["sensitivity"].to_s)
87
90
  problems << "sensitivity #{fields['sensitivity']} never occurs. Use one of: #{@sensitivities.to_a.join(', ')}"
88
91
  end
92
+ if fields.key?("usage") && !USAGES.include?(fields["usage"].to_s)
93
+ problems << "match.fields.usage #{fields['usage']} isn't one of: #{USAGES.join(', ')}"
94
+ end
89
95
  problems
90
96
  end
91
97
 
@@ -1,8 +1,8 @@
1
1
  __pack_meta:
2
2
  name: ai_safety
3
- version: "2.0.0"
3
+ version: "2.1.0"
4
4
  layer: 30
5
- description: "Agents need approval for personal, financial and unreviewed data in production, and for high-sensitivity data anywhere."
5
+ description: "Agents need approval for personal and unreviewed data in production, for financial data read row by row in production, and for high-sensitivity data anywhere."
6
6
  dependencies:
7
7
  - starter
8
8
  priority_band:
@@ -1,10 +1,10 @@
1
1
  id: ai_require_approval_agents_sensitive_prod
2
- description: Agents need security approval for personal or financial data in production.
2
+ description: Agents need security approval for personal data in production. Financial data is 04_require_approval_agents_financial_prod.
3
3
  priority: 1200
4
4
 
5
5
  match:
6
6
  fields:
7
- contains: [pii, financial]
7
+ contains: [pii]
8
8
 
9
9
  context:
10
10
  environment: production
@@ -13,5 +13,5 @@ context:
13
13
  action:
14
14
  require_approval: true
15
15
  approver_role: security
16
- reason: Agents reading personal or financial data in production need security review.
16
+ reason: Agents reading personal data in production need security review.
17
17
  ttl: 1h
@@ -0,0 +1,23 @@
1
+ id: ai_require_approval_agents_financial_prod
2
+ description: >-
3
+ Agents need a person's review to read financial data row by row in production,
4
+ from security or a finance manager. With financial_compliance installed, the
5
+ finance manager it already asks for meets this too, so one sign-off covers both.
6
+ Counts, sums, averages and grouping need no approval.
7
+ priority: 1250
8
+
9
+ match:
10
+ fields:
11
+ contains: [financial]
12
+ usage: row
13
+
14
+ context:
15
+ environment: production
16
+ requester_role: agent
17
+
18
+ action:
19
+ require_approval: true
20
+ approver_roles: [security, finance_manager]
21
+ approval_mode: any
22
+ reason: Agents reading financial data row by row in production need review by security or a finance manager.
23
+ ttl: 1h
@@ -1,8 +1,8 @@
1
1
  __pack_meta:
2
2
  name: financial_compliance
3
- version: "2.0.0"
3
+ version: "2.1.0"
4
4
  layer: 40
5
- description: "Finance approval for financial data in production, and short-lived grants for financial fields."
5
+ description: "Finance approval for reading financial data row by row in production (totals and averages need none), and short-lived grants for financial fields."
6
6
  dependencies:
7
7
  - starter
8
8
  priority_band:
@@ -1,10 +1,11 @@
1
1
  id: fin_require_approval_financial_prod
2
- description: A finance manager approves requests for financial data in production.
2
+ description: A finance manager approves reading financial data row by row in production. Counts, sums, averages and grouping need no approval; MIN and MAX return a single value, so they do.
3
3
  priority: 2100
4
4
 
5
5
  match:
6
6
  fields:
7
7
  contains: [financial]
8
+ usage: row
8
9
 
9
10
  context:
10
11
  environment: production
@@ -12,5 +13,5 @@ context:
12
13
  action:
13
14
  require_approval: true
14
15
  approver_role: finance_manager
15
- reason: Financial data in production needs finance approval.
16
+ reason: Reading financial data row by row in production needs finance approval.
16
17
  ttl: 30m
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "approval_groups"
4
+
3
5
  module Vkit
4
6
  module Policy
5
7
  class PolicyValidator
@@ -80,7 +82,7 @@ module Vkit
80
82
 
81
83
  when "require_approval"
82
84
  require_reason!(action, prefix)
83
- require_string!(action, "approver_role", prefix)
85
+ validate_approvers!(action, prefix)
84
86
 
85
87
  when "mask"
86
88
  # masking is optional, but if present must be valid
@@ -93,6 +95,77 @@ module Vkit
93
95
  validate_ttl!(action["ttl"], prefix) if action.key?("ttl")
94
96
  end
95
97
 
98
+ APPROVAL_MODES = %w[all any].freeze
99
+
100
+ # admin, member, approver and agent are built-in roles, not approval
101
+ # groups (the control plane refuses them too).
102
+ def self.validate_not_reserved!(names, prefix)
103
+ reserved = names.map { |n| n.to_s.strip } & ApprovalGroups::RESERVED
104
+ return if reserved.empty?
105
+
106
+ raise ValidationError, <<~MSG
107
+ #{prefix}#{reserved.join(', ')} #{reserved.size == 1 ? 'is a built-in role' : 'are built-in roles'}, not an approval group.
108
+
109
+ Name an approval group instead (admins can already approve any request), for example:
110
+
111
+ action:
112
+ require_approval: true
113
+ approver_role: data_owner
114
+ MSG
115
+ end
116
+
117
+ # One group (approver_role), or several (approver_roles) with
118
+ # approval_mode: all (the default, every group signs off) or any (one
119
+ # of them does).
120
+ def self.validate_approvers!(action, prefix)
121
+ single = action["approver_role"]
122
+ several = action["approver_roles"]
123
+ validate_not_reserved!([single, *Array(several)], prefix)
124
+
125
+ if single && several
126
+ raise ValidationError, <<~MSG
127
+ #{prefix}Set approver_role or approver_roles, not both.
128
+ MSG
129
+ end
130
+
131
+ if several.nil?
132
+ require_string!(action, "approver_role", prefix)
133
+ if action.key?("approval_mode")
134
+ raise ValidationError, <<~MSG
135
+ #{prefix}approval_mode only applies to approver_roles (several groups).
136
+ MSG
137
+ end
138
+ return
139
+ end
140
+
141
+ unless several.is_a?(Array) && several.any? && several.all? { |r| r.is_a?(String) && !r.strip.empty? }
142
+ raise ValidationError, <<~MSG
143
+ #{prefix}approver_roles must be a list of approver group names.
144
+
145
+ Example:
146
+
147
+ action:
148
+ require_approval: true
149
+ approver_roles: [security, data_owner]
150
+ approval_mode: any
151
+ MSG
152
+ end
153
+
154
+ if several.uniq.size != several.size
155
+ raise ValidationError, "#{prefix}approver_roles lists a group more than once.\n"
156
+ end
157
+
158
+ mode = action.fetch("approval_mode", "all")
159
+ return if APPROVAL_MODES.include?(mode.to_s)
160
+
161
+ raise ValidationError, <<~MSG
162
+ #{prefix}approval_mode must be all (every group signs off) or any (one of them does).
163
+
164
+ Got:
165
+ approval_mode: #{mode.inspect}
166
+ MSG
167
+ end
168
+
96
169
  def self.require_reason!(action, prefix)
97
170
  reason = action["reason"]
98
171
  return if reason.is_a?(String) && !reason.strip.empty?
@@ -57,6 +57,10 @@
57
57
  "commit_sha": {
58
58
  "type": "string",
59
59
  "pattern": "^[a-f0-9]{7,40}$"
60
+ },
61
+ "dirty": {
62
+ "type": "boolean",
63
+ "description": "True when the bundle was built from uncommitted changes (vkit policy bundle --allow-dirty), so commit_sha doesn't contain all of it."
60
64
  }
61
65
  }
62
66
  },
@@ -214,7 +218,8 @@
214
218
  "contains": {
215
219
  "type": "array",
216
220
  "items": { "type": "string" }
217
- }
221
+ },
222
+ "usage": { "type": "string", "enum": ["row", "aggregate"] }
218
223
  }
219
224
  },
220
225
  "context": {
@@ -293,7 +298,14 @@
293
298
  "type": "object",
294
299
  "additionalProperties": false,
295
300
  "properties": {
296
- "approver_role": { "type": "string" }
301
+ "approver_role": { "type": "string" },
302
+ "approver_roles": {
303
+ "type": "array",
304
+ "minItems": 1,
305
+ "uniqueItems": true,
306
+ "items": { "type": "string", "minLength": 1 }
307
+ },
308
+ "approval_mode": { "type": "string", "enum": ["all", "any"] }
297
309
  }
298
310
  },
299
311
 
data/lib/vkit/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Vkit
4
- VERSION = "1.4.0"
4
+ VERSION = "2.0.0"
5
5
  end
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.4.0
4
+ version: 2.0.0
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-11-07 00:00:00.000000000 Z
11
+ date: 2026-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '13.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '13.0'
41
69
  description: Command-line interface for interacting with the VaultKit control plane
42
70
  email:
43
71
  - founders@vaultkit.io
@@ -62,6 +90,7 @@ files:
62
90
  - lib/vkit/cli/commands/approval_watch_command.rb
63
91
  - lib/vkit/cli/commands/base_command.rb
64
92
  - lib/vkit/cli/commands/datasource_command.rb
93
+ - lib/vkit/cli/commands/doctor_command.rb
65
94
  - lib/vkit/cli/commands/fetch_command.rb
66
95
  - lib/vkit/cli/commands/grant_revoke_command.rb
67
96
  - lib/vkit/cli/commands/init_command.rb
@@ -82,11 +111,17 @@ files:
82
111
  - lib/vkit/cli/commands/requests_list_command.rb
83
112
  - lib/vkit/cli/commands/reset_command.rb
84
113
  - lib/vkit/cli/commands/scan_command.rb
114
+ - lib/vkit/cli/commands/setup_login_command.rb
85
115
  - lib/vkit/cli/commands/whoami_command.rb
116
+ - lib/vkit/cli/doctor.rb
117
+ - lib/vkit/cli/doctor/mcp_probe.rb
118
+ - lib/vkit/cli/error_map.rb
86
119
  - lib/vkit/cli/errors.rb
120
+ - lib/vkit/cli/output.rb
87
121
  - lib/vkit/cli/policy_bundle_validator.rb
88
122
  - lib/vkit/cli/policy_pack/manager.rb
89
123
  - lib/vkit/cli/requests_cli.rb
124
+ - lib/vkit/cli/secret_input.rb
90
125
  - lib/vkit/core/ansi.rb
91
126
  - lib/vkit/core/auth_client.rb
92
127
  - lib/vkit/core/credential_resolver.rb
@@ -94,13 +129,17 @@ files:
94
129
  - lib/vkit/core/registry_diff.rb
95
130
  - lib/vkit/core/registry_diff_printer.rb
96
131
  - lib/vkit/core/table_formatter.rb
132
+ - lib/vkit/core/user_agent.rb
133
+ - lib/vkit/policy/approval_groups.rb
97
134
  - lib/vkit/policy/bundle_compiler.rb
135
+ - lib/vkit/policy/git_state.rb
98
136
  - lib/vkit/policy/match_check.rb
99
137
  - lib/vkit/policy/pack_integrity.rb
100
138
  - lib/vkit/policy/packs/ai_safety/metadata.yaml
101
139
  - lib/vkit/policy/packs/ai_safety/policies/01_require_approval_agents_sensitive_prod.yaml
102
140
  - lib/vkit/policy/packs/ai_safety/policies/02_require_approval_agents_high_sensitivity.yaml
103
141
  - lib/vkit/policy/packs/ai_safety/policies/03_require_approval_agents_unknown_prod.yaml
142
+ - lib/vkit/policy/packs/ai_safety/policies/04_require_approval_agents_financial_prod.yaml
104
143
  - lib/vkit/policy/packs/financial_compliance/metadata.yaml
105
144
  - lib/vkit/policy/packs/financial_compliance/policies/01_require_approval_financial_prod.yaml
106
145
  - lib/vkit/policy/packs/financial_compliance/policies/02_short_ttl_for_financial_grants.yaml