command_tower 0.24.0 → 0.25.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 (150) hide show
  1. checksums.yaml +4 -4
  2. data/app/auth/command_tower/auth/auth_context.rb +17 -4
  3. data/app/controllers/command_tower/admin/users/impersonation_sessions_controller.rb +2 -1
  4. data/app/controllers/command_tower/application_controller.rb +18 -1
  5. data/app/controllers/command_tower/auth/email/availability_controller.rb +1 -0
  6. data/app/controllers/command_tower/auth/impersonation_session_controller.rb +2 -1
  7. data/app/controllers/command_tower/auth/password_check_controller.rb +31 -0
  8. data/app/controllers/command_tower/auth/password_recovery_session/create_controller.rb +3 -0
  9. data/app/controllers/command_tower/auth/password_reset/reset_controller.rb +4 -1
  10. data/app/controllers/command_tower/auth/password_reset/send_controller.rb +6 -2
  11. data/app/controllers/command_tower/auth/password_reset/validate_controller.rb +4 -1
  12. data/app/controllers/command_tower/auth/plain_text/login_controller.rb +2 -1
  13. data/app/controllers/command_tower/auth/register_controller.rb +9 -0
  14. data/app/controllers/command_tower/auth/signup_session/create_controller.rb +3 -0
  15. data/app/controllers/command_tower/auth/username/availability_controller.rb +1 -0
  16. data/app/controllers/command_tower/me/username_availability_controller.rb +37 -0
  17. data/app/controllers/command_tower/me/username_controller.rb +38 -0
  18. data/app/controllers/concerns/command_tower/api/application_response_renderer.rb +30 -6
  19. data/app/controllers/concerns/command_tower/auth/legacy_contract_boundary.rb +24 -0
  20. data/app/controllers/concerns/command_tower/auth/password_recovery_session_boundary.rb +2 -0
  21. data/app/controllers/concerns/command_tower/auth/signup_session_boundary.rb +2 -0
  22. data/app/controllers/concerns/command_tower/execution/http_boundary.rb +22 -1
  23. data/app/deserializers/command_tower/deserializers/auth/password_check_deserializer.rb +21 -0
  24. data/app/deserializers/command_tower/deserializers/auth/password_reset/reset_deserializer.rb +3 -2
  25. data/app/deserializers/command_tower/deserializers/auth/register_deserializer.rb +10 -12
  26. data/app/deserializers/command_tower/deserializers/me/change_password_deserializer.rb +6 -4
  27. data/app/deserializers/command_tower/deserializers/me/update_username_deserializer.rb +21 -0
  28. data/app/errors/command_tower/errors/account/username_change_not_allowed_error.rb +17 -0
  29. data/app/errors/command_tower/errors/account/username_taken_error.rb +21 -0
  30. data/app/errors/command_tower/errors/auth/auth_rate_limited_error.rb +25 -0
  31. data/app/errors/command_tower/errors/auth/session_expired_error.rb +18 -0
  32. data/app/errors/command_tower/errors/auth/session_revoked_error.rb +18 -0
  33. data/app/errors/command_tower/errors/insecure_jwt_secret_error.rb +22 -0
  34. data/app/jobs/command_tower/auth/device_sessions/purge_ended_job.rb +16 -0
  35. data/app/jobs/command_tower/auth/email_verification/issue_job.rb +23 -0
  36. data/app/jobs/command_tower/auth/password_reset/issue_job.rb +23 -0
  37. data/app/models/command_tower/auth/device_session.rb +32 -0
  38. data/app/models/user.rb +10 -1
  39. data/app/models/user_secret.rb +17 -4
  40. data/app/serializers/command_tower/serializers/auth/email_verification/message_response_serializer.rb +5 -2
  41. data/app/serializers/command_tower/serializers/auth/identity_policy_serializer.rb +16 -3
  42. data/app/serializers/command_tower/serializers/auth/login_response_serializer.rb +6 -6
  43. data/app/serializers/command_tower/serializers/auth/password_check_serializer.rb +17 -0
  44. data/app/serializers/command_tower/serializers/auth/register_response_serializer.rb +11 -2
  45. data/app/services/command_tower/jwt/authenticate_user.rb +140 -19
  46. data/app/services/command_tower/jwt/authentication_outcome.rb +30 -6
  47. data/app/services/command_tower/jwt/login_create.rb +4 -3
  48. data/app/services/command_tower/secrets/generate.rb +8 -5
  49. data/app/services/command_tower/secrets/verify.rb +6 -5
  50. data/app/services/command_tower/services/account/phone_verification/verify.rb +1 -1
  51. data/app/services/command_tower/services/auth/authenticate_session.rb +15 -1
  52. data/app/services/command_tower/services/auth/device_sessions/revoke_all.rb +27 -0
  53. data/app/services/command_tower/services/auth/device_sessions/start.rb +52 -0
  54. data/app/services/command_tower/services/auth/device_sessions/upgrade_legacy.rb +44 -0
  55. data/app/services/command_tower/services/auth/email_verification/send.rb +23 -29
  56. data/app/services/command_tower/services/auth/email_verification/verify.rb +6 -0
  57. data/app/services/command_tower/services/auth/identity_policy.rb +63 -17
  58. data/app/services/command_tower/services/auth/identity_rate_limits/check_reset_attempt.rb +40 -0
  59. data/app/services/command_tower/services/auth/identity_rate_limits/check_verification_send.rb +61 -0
  60. data/app/services/command_tower/services/auth/identity_rate_limits/check_verify_attempt.rb +39 -0
  61. data/app/services/command_tower/services/auth/issue_session.rb +62 -0
  62. data/app/services/command_tower/services/auth/login_rate_limits/check_ip.rb +38 -0
  63. data/app/services/command_tower/services/auth/login_rate_limits/enforcement.rb +33 -0
  64. data/app/services/command_tower/services/auth/login_rate_limits/fail_open.rb +50 -0
  65. data/app/services/command_tower/services/auth/login_rate_limits/lockout.rb +131 -0
  66. data/app/services/command_tower/services/auth/omit_body_token.rb +30 -0
  67. data/app/services/command_tower/services/auth/password_policy/check.rb +45 -0
  68. data/app/services/command_tower/services/auth/password_policy/check_rate_limit.rb +38 -0
  69. data/app/services/command_tower/services/auth/password_recovery/rate_limits/check_send.rb +16 -13
  70. data/app/services/command_tower/services/auth/password_reset/reset.rb +21 -14
  71. data/app/services/command_tower/services/auth/password_reset/send.rb +9 -42
  72. data/app/services/command_tower/services/auth/password_reset/token_verification.rb +9 -1
  73. data/app/services/command_tower/services/auth/password_reset/validate.rb +3 -0
  74. data/app/services/command_tower/services/auth/plain_text/login.rb +68 -11
  75. data/app/services/command_tower/services/auth/record_legacy_contract_use.rb +28 -0
  76. data/app/services/command_tower/services/auth/register.rb +19 -13
  77. data/app/services/command_tower/services/auth/signup_rate_limits/check_register_email.rb +39 -0
  78. data/app/services/command_tower/services/auth/tombstone_user.rb +1 -0
  79. data/app/services/command_tower/services/me/capabilities.rb +1 -1
  80. data/app/services/command_tower/services/me/change_password.rb +10 -8
  81. data/app/services/command_tower/services/me/set_username.rb +100 -0
  82. data/app/services/command_tower/services/me/username_change_eligibility.rb +34 -0
  83. data/app/services/command_tower/services/rate_limits/check.rb +1 -1
  84. data/app/services/command_tower/services/rate_limits/clear.rb +18 -0
  85. data/app/services/command_tower/services/rate_limits/peek.rb +23 -0
  86. data/app/services/command_tower/user_attributes/mutate.rb +1 -0
  87. data/app/services/command_tower/username/available.rb +1 -1
  88. data/app/workflows/command_tower/workflows/auth/authentication_response_effects.rb +11 -0
  89. data/app/workflows/command_tower/workflows/auth/device_sessions/purge_ended_workflow.rb +44 -0
  90. data/app/workflows/command_tower/workflows/auth/email_verification/issue_workflow.rb +64 -0
  91. data/app/workflows/command_tower/workflows/auth/email_verification/send_workflow.rb +4 -2
  92. data/app/workflows/command_tower/workflows/auth/identity_error_status.rb +2 -1
  93. data/app/workflows/command_tower/workflows/auth/logout_workflow.rb +12 -0
  94. data/app/workflows/command_tower/workflows/auth/password_check_workflow.rb +34 -0
  95. data/app/workflows/command_tower/workflows/auth/password_reset/issue_workflow.rb +62 -0
  96. data/app/workflows/command_tower/workflows/auth/password_reset/reset_workflow.rb +3 -2
  97. data/app/workflows/command_tower/workflows/auth/password_reset/send_workflow.rb +3 -2
  98. data/app/workflows/command_tower/workflows/auth/password_reset/validate_workflow.rb +3 -2
  99. data/app/workflows/command_tower/workflows/auth/plain_text/login_workflow.rb +27 -8
  100. data/app/workflows/command_tower/workflows/auth/register_session_response.rb +54 -0
  101. data/app/workflows/command_tower/workflows/auth/register_workflow.rb +64 -56
  102. data/app/workflows/command_tower/workflows/auth/session/show_workflow.rb +54 -5
  103. data/app/workflows/command_tower/workflows/auth/session_error_status.rb +4 -0
  104. data/app/workflows/command_tower/workflows/auth/signup_error_status.rb +2 -1
  105. data/app/workflows/command_tower/workflows/impersonation/start_workflow.rb +5 -2
  106. data/app/workflows/command_tower/workflows/impersonation/stop_workflow.rb +4 -2
  107. data/app/workflows/command_tower/workflows/me/error_status.rb +2 -0
  108. data/app/workflows/command_tower/workflows/me/username_availability_workflow.rb +77 -0
  109. data/app/workflows/command_tower/workflows/me/username_workflow.rb +47 -0
  110. data/config/routes.rb +3 -0
  111. data/db/migrate/20261124000002_add_secret_digest_to_user_secrets.rb +8 -0
  112. data/db/migrate/20261124000003_create_command_tower_device_sessions.rb +43 -0
  113. data/docs/api_reference.md +74 -15
  114. data/docs/audit.md +1 -0
  115. data/docs/authentication.md +103 -0
  116. data/docs/bootstrap/08-initializer.md +12 -0
  117. data/docs/bootstrap/09-rbac.md +2 -0
  118. data/docs/bootstrap/11-auth-client-path.md +3 -1
  119. data/docs/change_password_workflow.md +6 -4
  120. data/docs/cookie_authentication_guide.md +17 -1
  121. data/docs/email_verification_workflow.md +6 -0
  122. data/docs/password_reset_workflow.md +10 -2
  123. data/docs/upgrades/0.25.0.md +50 -0
  124. data/docs/upgrades/README.md +2 -0
  125. data/lib/command_tower/authorization/default.yml +6 -0
  126. data/lib/command_tower/configuration/config.rb +6 -0
  127. data/lib/command_tower/configuration/jwt/config.rb +23 -1
  128. data/lib/command_tower/configuration/login/config.rb +14 -0
  129. data/lib/command_tower/configuration/login/rate_limits.rb +125 -0
  130. data/lib/command_tower/configuration/login/strategy/plain_text/config.rb +12 -6
  131. data/lib/command_tower/configuration/login/strategy/plain_text/lockable.rb +14 -2
  132. data/lib/command_tower/configuration/registry/audit/config.rb +14 -0
  133. data/lib/command_tower/configuration/registry/client_compatibility/config.rb +5 -3
  134. data/lib/command_tower/configuration/session/config.rb +61 -0
  135. data/lib/command_tower/configuration/username/config.rb +17 -0
  136. data/lib/command_tower/current.rb +4 -0
  137. data/lib/command_tower/data/NOTICE +8 -0
  138. data/lib/command_tower/data/password-blocklist-100k.txt.gz +0 -0
  139. data/lib/command_tower/engine.rb +1 -0
  140. data/lib/command_tower/execution.rb +5 -1
  141. data/lib/command_tower/install/baseline.rb +2 -0
  142. data/lib/command_tower/jwt/authorization_helper.rb +14 -6
  143. data/lib/command_tower/password_policy/blocklist.rb +53 -0
  144. data/lib/command_tower/version.rb +1 -1
  145. data/lib/command_tower.rb +1 -0
  146. data/lib/tasks/user_secrets.rake +21 -0
  147. data/lib/tasks/users.rake +71 -0
  148. data/spec/factories/device_session.rb +14 -0
  149. data/spec/factories/user_secret.rb +5 -1
  150. metadata +55 -1
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "zlib"
4
+
5
+ module CommandTower
6
+ module PasswordPolicy
7
+ # Common-password blocklist. Loaded once per configured path list into a frozen Set and
8
+ # reused; entries are compared case-insensitively. Files ending in `.gz` are gunzipped,
9
+ # anything else is read as plain text (one password per line).
10
+ module Blocklist
11
+ DEFAULT_PATH = File.expand_path("../data/password-blocklist-100k.txt.gz", __dir__).freeze
12
+
13
+ MUTEX = Mutex.new
14
+ private_constant :MUTEX
15
+
16
+ class << self
17
+ def include?(password)
18
+ entries.include?(normalize(password))
19
+ end
20
+
21
+ # Drops the memoized set so the next lookup reloads from the configured paths.
22
+ def reset!
23
+ MUTEX.synchronize { @entries = nil }
24
+ end
25
+
26
+ private
27
+
28
+ def entries
29
+ current = @entries
30
+ return current if current
31
+
32
+ MUTEX.synchronize { @entries ||= load_entries(CommandTower.config.login.plain_text.password_blocklist_paths) }
33
+ end
34
+
35
+ def load_entries(paths)
36
+ set = Set.new
37
+ Array(paths).each { |path| read_lines(path).each { |line| set << normalize(line) } }
38
+ set.delete("")
39
+ set.freeze
40
+ end
41
+
42
+ def read_lines(path)
43
+ reader = path.to_s.end_with?(".gz") ? Zlib::GzipReader : File
44
+ reader.open(path, &:readlines)
45
+ end
46
+
47
+ def normalize(value)
48
+ value.to_s.strip.downcase
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CommandTower
4
- VERSION = "0.24.0"
4
+ VERSION = "0.25.0"
5
5
  end
data/lib/command_tower.rb CHANGED
@@ -25,6 +25,7 @@ require "command_tower/credential_resolution"
25
25
  require "command_tower/intervention/severity"
26
26
  require "command_tower/jwt/authorization_helper"
27
27
  require "command_tower/jwt/csrf_helper"
28
+ require "command_tower/password_policy/blocklist"
28
29
  require "command_tower/password_recovery/authorization_helper"
29
30
  require "command_tower/redis_connection"
30
31
  require "command_tower/signup/authorization_helper"
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :command_tower do
4
+ namespace :user_secrets do
5
+ desc "Digest and blank legacy plaintext user_secrets.secret values (idempotent, batched)"
6
+ task clear_plaintext: :environment do
7
+ cleared = 0
8
+
9
+ UserSecret.where.not(secret: nil).find_each(batch_size: 1_000) do |record|
10
+ attributes = { secret: nil }
11
+ attributes[:secret_digest] = UserSecret.digest_for(record.secret) if record.secret_digest.blank?
12
+
13
+ # update_columns skips callbacks and timestamps; rows keep their issue time.
14
+ record.update_columns(attributes) # rubocop:disable Rails/SkipsModelValidations
15
+ cleared += 1
16
+ end
17
+
18
+ puts "Cleared plaintext from #{cleared} user secret(s)."
19
+ end
20
+ end
21
+ end
data/lib/tasks/users.rake CHANGED
@@ -115,5 +115,76 @@ namespace :command_tower do
115
115
  raise "User creation failed"
116
116
  end
117
117
  end
118
+
119
+ # Groups by the normalized form so the result does not depend on the column collation.
120
+ # Blank emails (default "") count as one group like any other value. Read-only; prints ids, not addresses.
121
+ email_duplicate_groups = lambda do
122
+ normalized = "LOWER(TRIM(email))"
123
+ ::User.group(Arel.sql(normalized)).having("COUNT(*) > 1").pluck(Arel.sql(normalized)).index_with do |key|
124
+ ::User.where("#{normalized} = ?", key).order(:id).pluck(:id)
125
+ end
126
+ end
127
+
128
+ desc "Report users sharing an email (collation-aware, includes blank emails). Read-only."
129
+ task email_duplicates: :environment do
130
+ groups = email_duplicate_groups.call
131
+ if groups.empty?
132
+ puts "No duplicate emails found."
133
+ else
134
+ groups.each do |email, ids|
135
+ label = email.empty? ? "(blank)" : "email##{ids.first}"
136
+ puts "#{label}: #{ids.size} users, ids=#{ids.join(',')}"
137
+ end
138
+ puts "#{groups.size} duplicate email group(s) found."
139
+ end
140
+ end
141
+
142
+ desc "Add a unique index on users.email; skips with a warning and a metric event when duplicates exist"
143
+ task add_email_unique_index: :environment do
144
+ connection = ::ActiveRecord::Base.connection
145
+ if connection.index_exists?(:users, :email, unique: true)
146
+ puts "Unique index on users.email already exists."
147
+ else
148
+ groups = email_duplicate_groups.call
149
+ if groups.empty?
150
+ connection.add_index(:users, :email, unique: true)
151
+ puts "Added unique index on users.email."
152
+ else
153
+ warn "WARNING: skipped unique index on users.email; #{groups.size} duplicate email group(s) exist. " \
154
+ "Run command_tower:users:email_duplicates and resolve them first."
155
+ CommandTower::Events.publish(
156
+ category: :auth,
157
+ name: "email_unique_index_skipped",
158
+ payload: { duplicate_groups: groups.size }
159
+ )
160
+ end
161
+ end
162
+ end
163
+
164
+ desc "Normalize stored emails (strip + downcase); skips and reports collisions. DRY_RUN=1 to only report."
165
+ task normalize_emails: :environment do
166
+ dry_run = ENV["DRY_RUN"].present?
167
+ taken = ::User.pluck(:id, :email).each_with_object(Hash.new { |h, k| h[k] = [] }) do |(id, email), memo|
168
+ memo[email.to_s.strip.downcase] << id
169
+ end
170
+ changed = 0
171
+ skipped = 0
172
+
173
+ ::User.find_each(batch_size: 1_000) do |user|
174
+ normalized = user.email.to_s.strip.downcase
175
+ next if normalized == user.email
176
+
177
+ if taken[normalized] != [user.id]
178
+ puts "Skipped user #{user.id}: normalized email collides with another user."
179
+ skipped += 1
180
+ next
181
+ end
182
+
183
+ user.update_columns(email: normalized) unless dry_run # rubocop:disable Rails/SkipsModelValidations
184
+ changed += 1
185
+ end
186
+
187
+ puts "#{dry_run ? 'Would normalize' : 'Normalized'} #{changed} email(s); skipped #{skipped} collision(s)."
188
+ end
118
189
  end
119
190
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ FactoryBot.define do
4
+ factory :device_session, class: "CommandTower::Auth::DeviceSession" do
5
+ association :user
6
+ last_seen_at { Time.current }
7
+ absolute_expires_at { 30.days.from_now }
8
+
9
+ trait :revoked do
10
+ revoked_at { Time.current }
11
+ revoked_reason { "logout" }
12
+ end
13
+ end
14
+ end
@@ -4,7 +4,11 @@ FactoryBot.define do
4
4
  factory :user_secret, class: "UserSecret" do
5
5
  user
6
6
  reason { CommandTower::Secrets::EMAIL_VERIFICIATION.to_s }
7
- sequence(:secret) { |n| "secret-#{n}-#{SecureRandom.hex(8)}" }
7
+ # Plaintext is transient; only its digest is persisted.
8
+ transient do
9
+ sequence(:secret) { |n| "secret-#{n}-#{SecureRandom.hex(8)}" }
10
+ end
11
+ secret_digest { UserSecret.digest_for(secret) }
8
12
  death_time { 1.hour.from_now }
9
13
  use_count { 0 }
10
14
  use_count_max { 5 }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: command_tower
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.0
4
+ version: 0.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - matt-taylor
@@ -230,6 +230,7 @@ files:
230
230
  - app/controllers/command_tower/auth/identity_policy_controller.rb
231
231
  - app/controllers/command_tower/auth/impersonation_session_controller.rb
232
232
  - app/controllers/command_tower/auth/logout_controller.rb
233
+ - app/controllers/command_tower/auth/password_check_controller.rb
233
234
  - app/controllers/command_tower/auth/password_recovery_session/create_controller.rb
234
235
  - app/controllers/command_tower/auth/password_reset/reset_controller.rb
235
236
  - app/controllers/command_tower/auth/password_reset/send_controller.rb
@@ -254,6 +255,8 @@ files:
254
255
  - app/controllers/command_tower/me/push_controller.rb
255
256
  - app/controllers/command_tower/me/pushover/verifications_controller.rb
256
257
  - app/controllers/command_tower/me/pushover_controller.rb
258
+ - app/controllers/command_tower/me/username_availability_controller.rb
259
+ - app/controllers/command_tower/me/username_controller.rb
257
260
  - app/controllers/command_tower/me_controller.rb
258
261
  - app/controllers/command_tower/messaging/unsubscribe_controller.rb
259
262
  - app/controllers/command_tower/profile_controller.rb
@@ -262,6 +265,7 @@ files:
262
265
  - app/controllers/concerns/command_tower/auth/authentication_boundary.rb
263
266
  - app/controllers/concerns/command_tower/auth/authorization_boundary.rb
264
267
  - app/controllers/concerns/command_tower/auth/invalid_credentials_deserializer_renderer.rb
268
+ - app/controllers/concerns/command_tower/auth/legacy_contract_boundary.rb
265
269
  - app/controllers/concerns/command_tower/auth/password_recovery_session_boundary.rb
266
270
  - app/controllers/concerns/command_tower/auth/signup_session_boundary.rb
267
271
  - app/controllers/concerns/command_tower/execution/client_compatibility_boundary.rb
@@ -274,6 +278,7 @@ files:
274
278
  - app/deserializers/command_tower/deserializers/audit/events.rb
275
279
  - app/deserializers/command_tower/deserializers/auth/email_availability_deserializer.rb
276
280
  - app/deserializers/command_tower/deserializers/auth/email_verification/verify_deserializer.rb
281
+ - app/deserializers/command_tower/deserializers/auth/password_check_deserializer.rb
277
282
  - app/deserializers/command_tower/deserializers/auth/password_reset/reset_deserializer.rb
278
283
  - app/deserializers/command_tower/deserializers/auth/password_reset/send_deserializer.rb
279
284
  - app/deserializers/command_tower/deserializers/auth/password_reset/validate_deserializer.rb
@@ -297,6 +302,7 @@ files:
297
302
  - app/deserializers/command_tower/deserializers/me/pushover/credentials_deserializer.rb
298
303
  - app/deserializers/command_tower/deserializers/me/update_name_deserializer.rb
299
304
  - app/deserializers/command_tower/deserializers/me/update_phone_deserializer.rb
305
+ - app/deserializers/command_tower/deserializers/me/update_username_deserializer.rb
300
306
  - app/deserializers/command_tower/deserializers/messaging/inbox.rb
301
307
  - app/deserializers/command_tower/deserializers/messaging/preferences/show_deserializer.rb
302
308
  - app/deserializers/command_tower/deserializers/messaging/preferences/update_deserializer.rb
@@ -319,9 +325,12 @@ files:
319
325
  - app/errors/command_tower/errors/account/pushover_provider_unavailable_error.rb
320
326
  - app/errors/command_tower/errors/account/pushover_verification_failed_error.rb
321
327
  - app/errors/command_tower/errors/account/sms_capability_unavailable_error.rb
328
+ - app/errors/command_tower/errors/account/username_change_not_allowed_error.rb
329
+ - app/errors/command_tower/errors/account/username_taken_error.rb
322
330
  - app/errors/command_tower/errors/application_error.rb
323
331
  - app/errors/command_tower/errors/auth/account_deleted_error.rb
324
332
  - app/errors/command_tower/errors/auth/admin_unavailable_during_impersonation_error.rb
333
+ - app/errors/command_tower/errors/auth/auth_rate_limited_error.rb
325
334
  - app/errors/command_tower/errors/auth/csrf_mismatch_error.rb
326
335
  - app/errors/command_tower/errors/auth/csrf_missing_error.rb
327
336
  - app/errors/command_tower/errors/auth/default_membership_assignment_error.rb
@@ -339,6 +348,8 @@ files:
339
348
  - app/errors/command_tower/errors/auth/password_reset_invalid_token_error.rb
340
349
  - app/errors/command_tower/errors/auth/password_reset_unavailable_error.rb
341
350
  - app/errors/command_tower/errors/auth/self_impersonation_error.rb
351
+ - app/errors/command_tower/errors/auth/session_expired_error.rb
352
+ - app/errors/command_tower/errors/auth/session_revoked_error.rb
342
353
  - app/errors/command_tower/errors/auth/signup_ip_rate_limit_error.rb
343
354
  - app/errors/command_tower/errors/auth/signup_session_expired_error.rb
344
355
  - app/errors/command_tower/errors/auth/signup_session_invalid_error.rb
@@ -352,6 +363,7 @@ files:
352
363
  - app/errors/command_tower/errors/home_notices/linked_message_unavailable_error.rb
353
364
  - app/errors/command_tower/errors/home_notices/rate_limit_error.rb
354
365
  - app/errors/command_tower/errors/home_notices/unavailable_error.rb
366
+ - app/errors/command_tower/errors/insecure_jwt_secret_error.rb
355
367
  - app/errors/command_tower/errors/internal_error.rb
356
368
  - app/errors/command_tower/errors/messaging/accept_rejected_error.rb
357
369
  - app/errors/command_tower/errors/messaging/announcement_type_not_supported_error.rb
@@ -366,6 +378,9 @@ files:
366
378
  - app/errors/command_tower/errors/validation_error.rb
367
379
  - app/helpers/command_tower/application_helper.rb
368
380
  - app/jobs/command_tower/application_job.rb
381
+ - app/jobs/command_tower/auth/device_sessions/purge_ended_job.rb
382
+ - app/jobs/command_tower/auth/email_verification/issue_job.rb
383
+ - app/jobs/command_tower/auth/password_reset/issue_job.rb
369
384
  - app/jobs/command_tower/execution/job_boundary.rb
370
385
  - app/jobs/command_tower/home_notices/prune_ended_job.rb
371
386
  - app/jobs/command_tower/messaging/channel_delivery_execution_job.rb
@@ -379,6 +394,7 @@ files:
379
394
  - app/mailers/command_tower/password_reset_mailer.rb
380
395
  - app/models/command_tower/application_record.rb
381
396
  - app/models/command_tower/audit/event.rb
397
+ - app/models/command_tower/auth/device_session.rb
382
398
  - app/models/command_tower/home_notice.rb
383
399
  - app/models/command_tower/home_notice_control.rb
384
400
  - app/models/command_tower/impersonation/session.rb
@@ -407,6 +423,7 @@ files:
407
423
  - app/serializers/command_tower/serializers/auth/identity_policy_serializer.rb
408
424
  - app/serializers/command_tower/serializers/auth/login_response_serializer.rb
409
425
  - app/serializers/command_tower/serializers/auth/logout_response_serializer.rb
426
+ - app/serializers/command_tower/serializers/auth/password_check_serializer.rb
410
427
  - app/serializers/command_tower/serializers/auth/password_recovery_session_response_serializer.rb
411
428
  - app/serializers/command_tower/serializers/auth/password_reset/message_response_serializer.rb
412
429
  - app/serializers/command_tower/serializers/auth/password_reset/validate_response_serializer.rb
@@ -733,10 +750,24 @@ files:
733
750
  - app/services/command_tower/services/auth/authenticate_session.rb
734
751
  - app/services/command_tower/services/auth/authorize_request.rb
735
752
  - app/services/command_tower/services/auth/client_ip_resolver.rb
753
+ - app/services/command_tower/services/auth/device_sessions/revoke_all.rb
754
+ - app/services/command_tower/services/auth/device_sessions/start.rb
755
+ - app/services/command_tower/services/auth/device_sessions/upgrade_legacy.rb
736
756
  - app/services/command_tower/services/auth/email_availability.rb
737
757
  - app/services/command_tower/services/auth/email_verification/send.rb
738
758
  - app/services/command_tower/services/auth/email_verification/verify.rb
739
759
  - app/services/command_tower/services/auth/identity_policy.rb
760
+ - app/services/command_tower/services/auth/identity_rate_limits/check_reset_attempt.rb
761
+ - app/services/command_tower/services/auth/identity_rate_limits/check_verification_send.rb
762
+ - app/services/command_tower/services/auth/identity_rate_limits/check_verify_attempt.rb
763
+ - app/services/command_tower/services/auth/issue_session.rb
764
+ - app/services/command_tower/services/auth/login_rate_limits/check_ip.rb
765
+ - app/services/command_tower/services/auth/login_rate_limits/enforcement.rb
766
+ - app/services/command_tower/services/auth/login_rate_limits/fail_open.rb
767
+ - app/services/command_tower/services/auth/login_rate_limits/lockout.rb
768
+ - app/services/command_tower/services/auth/omit_body_token.rb
769
+ - app/services/command_tower/services/auth/password_policy/check.rb
770
+ - app/services/command_tower/services/auth/password_policy/check_rate_limit.rb
740
771
  - app/services/command_tower/services/auth/password_recovery/rate_limits/check_send.rb
741
772
  - app/services/command_tower/services/auth/password_recovery/rate_limits/check_token_issue.rb
742
773
  - app/services/command_tower/services/auth/password_recovery/rate_limits/enforcement.rb
@@ -751,9 +782,11 @@ files:
751
782
  - app/services/command_tower/services/auth/plain_text/login.rb
752
783
  - app/services/command_tower/services/auth/principal_capabilities/project.rb
753
784
  - app/services/command_tower/services/auth/purge_user_associated_data.rb
785
+ - app/services/command_tower/services/auth/record_legacy_contract_use.rb
754
786
  - app/services/command_tower/services/auth/register.rb
755
787
  - app/services/command_tower/services/auth/signup_rate_limits/check_availability.rb
756
788
  - app/services/command_tower/services/auth/signup_rate_limits/check_register.rb
789
+ - app/services/command_tower/services/auth/signup_rate_limits/check_register_email.rb
757
790
  - app/services/command_tower/services/auth/signup_rate_limits/check_token_issue.rb
758
791
  - app/services/command_tower/services/auth/signup_rate_limits/enforcement.rb
759
792
  - app/services/command_tower/services/auth/signup_session/create.rb
@@ -786,8 +819,10 @@ files:
786
819
  - app/services/command_tower/services/me/delete_account.rb
787
820
  - app/services/command_tower/services/me/push_product_gate.rb
788
821
  - app/services/command_tower/services/me/pushover_product_gate.rb
822
+ - app/services/command_tower/services/me/set_username.rb
789
823
  - app/services/command_tower/services/me/sms_product_gate.rb
790
824
  - app/services/command_tower/services/me/update_name.rb
825
+ - app/services/command_tower/services/me/username_change_eligibility.rb
791
826
  - app/services/command_tower/services/messaging/announcements/resolve_produce_arguments.rb
792
827
  - app/services/command_tower/services/messaging/communications/explicit_copy_rule.rb
793
828
  - app/services/command_tower/services/messaging/communications/produce.rb
@@ -811,6 +846,8 @@ files:
811
846
  - app/services/command_tower/services/messaging/unsubscribe/opt_out_of_email.rb
812
847
  - app/services/command_tower/services/messaging/unsubscribe/verify_token.rb
813
848
  - app/services/command_tower/services/rate_limits/check.rb
849
+ - app/services/command_tower/services/rate_limits/clear.rb
850
+ - app/services/command_tower/services/rate_limits/peek.rb
814
851
  - app/services/command_tower/services/service_result.rb
815
852
  - app/services/command_tower/services/users/record_last_known_time_zone.rb
816
853
  - app/services/command_tower/user_attributes/mutate.rb
@@ -854,19 +891,24 @@ files:
854
891
  - app/workflows/command_tower/workflows/auth/authenticate_request_workflow.rb
855
892
  - app/workflows/command_tower/workflows/auth/authentication_response_effects.rb
856
893
  - app/workflows/command_tower/workflows/auth/authorize_request_workflow.rb
894
+ - app/workflows/command_tower/workflows/auth/device_sessions/purge_ended_workflow.rb
857
895
  - app/workflows/command_tower/workflows/auth/email_availability_workflow.rb
896
+ - app/workflows/command_tower/workflows/auth/email_verification/issue_workflow.rb
858
897
  - app/workflows/command_tower/workflows/auth/email_verification/send_workflow.rb
859
898
  - app/workflows/command_tower/workflows/auth/email_verification/verify_workflow.rb
860
899
  - app/workflows/command_tower/workflows/auth/identity_error_status.rb
861
900
  - app/workflows/command_tower/workflows/auth/identity_policy_workflow.rb
862
901
  - app/workflows/command_tower/workflows/auth/logout_workflow.rb
902
+ - app/workflows/command_tower/workflows/auth/password_check_workflow.rb
863
903
  - app/workflows/command_tower/workflows/auth/password_recovery_session/authenticate_workflow.rb
864
904
  - app/workflows/command_tower/workflows/auth/password_recovery_session/create_workflow.rb
905
+ - app/workflows/command_tower/workflows/auth/password_reset/issue_workflow.rb
865
906
  - app/workflows/command_tower/workflows/auth/password_reset/reset_workflow.rb
866
907
  - app/workflows/command_tower/workflows/auth/password_reset/send_workflow.rb
867
908
  - app/workflows/command_tower/workflows/auth/password_reset/validate_workflow.rb
868
909
  - app/workflows/command_tower/workflows/auth/plain_text/login_workflow.rb
869
910
  - app/workflows/command_tower/workflows/auth/principal_capabilities/show_workflow.rb
911
+ - app/workflows/command_tower/workflows/auth/register_session_response.rb
870
912
  - app/workflows/command_tower/workflows/auth/register_workflow.rb
871
913
  - app/workflows/command_tower/workflows/auth/session/show_workflow.rb
872
914
  - app/workflows/command_tower/workflows/auth/session_error_status.rb
@@ -909,6 +951,8 @@ files:
909
951
  - app/workflows/command_tower/workflows/me/show_workflow.rb
910
952
  - app/workflows/command_tower/workflows/me/update_name_workflow.rb
911
953
  - app/workflows/command_tower/workflows/me/update_phone_workflow.rb
954
+ - app/workflows/command_tower/workflows/me/username_availability_workflow.rb
955
+ - app/workflows/command_tower/workflows/me/username_workflow.rb
912
956
  - app/workflows/command_tower/workflows/messaging/communications/produce_recipient_workflow.rb
913
957
  - app/workflows/command_tower/workflows/messaging/error_mapping.rb
914
958
  - app/workflows/command_tower/workflows/messaging/execution/deliver_workflow.rb
@@ -936,6 +980,8 @@ files:
936
980
  - db/migrate/20261012000001_add_provider_metadata_to_messaging_delivery_attempts.rb
937
981
  - db/migrate/20261012000002_add_finished_at_index_to_messaging_delivery_attempts.rb
938
982
  - db/migrate/20261124000001_add_message_definition_columns_to_messaging_communications.rb
983
+ - db/migrate/20261124000002_add_secret_digest_to_user_secrets.rb
984
+ - db/migrate/20261124000003_create_command_tower_device_sessions.rb
939
985
  - db/migrate/20261124200001_create_command_tower_home_notices.rb
940
986
  - db/migrate/20261124200002_create_command_tower_home_notice_controls.rb
941
987
  - docs/admin_workspace.md
@@ -995,6 +1041,7 @@ files:
995
1041
  - docs/upgrades/0.22.0.md
996
1042
  - docs/upgrades/0.23.0.md
997
1043
  - docs/upgrades/0.24.0.md
1044
+ - docs/upgrades/0.25.0.md
998
1045
  - docs/upgrades/README.md
999
1046
  - lib/command_tower.rb
1000
1047
  - lib/command_tower/admin_scope.rb
@@ -1040,6 +1087,7 @@ files:
1040
1087
  - lib/command_tower/configuration/jwt/cookie/config.rb
1041
1088
  - lib/command_tower/configuration/jwt/cookie/csrf/config.rb
1042
1089
  - lib/command_tower/configuration/login/config.rb
1090
+ - lib/command_tower/configuration/login/rate_limits.rb
1043
1091
  - lib/command_tower/configuration/login/strategy/plain_text/config.rb
1044
1092
  - lib/command_tower/configuration/login/strategy/plain_text/email_verify.rb
1045
1093
  - lib/command_tower/configuration/login/strategy/plain_text/lockable.rb
@@ -1068,6 +1116,7 @@ files:
1068
1116
  - lib/command_tower/configuration/registry/inbox_presentations/presentation_definition.rb
1069
1117
  - lib/command_tower/configuration/registry/principal_capabilities/capability_definition.rb
1070
1118
  - lib/command_tower/configuration/registry/principal_capabilities/config.rb
1119
+ - lib/command_tower/configuration/session/config.rb
1071
1120
  - lib/command_tower/configuration/signup_session/config.rb
1072
1121
  - lib/command_tower/configuration/signup_session/email_availability.rb
1073
1122
  - lib/command_tower/configuration/signup_session/rate_limits.rb
@@ -1081,6 +1130,8 @@ files:
1081
1130
  - lib/command_tower/credential_resolution/smtp_credentials.rb
1082
1131
  - lib/command_tower/credential_resolution/twilio_credentials.rb
1083
1132
  - lib/command_tower/current.rb
1133
+ - lib/command_tower/data/NOTICE
1134
+ - lib/command_tower/data/password-blocklist-100k.txt.gz
1084
1135
  - lib/command_tower/email_theme/default_ui_tokens.json
1085
1136
  - lib/command_tower/email_theme/palette.rb
1086
1137
  - lib/command_tower/email_theme/token_file.rb
@@ -1101,6 +1152,7 @@ files:
1101
1152
  - lib/command_tower/logging/lifecycle_declaration.rb
1102
1153
  - lib/command_tower/logging/projection.rb
1103
1154
  - lib/command_tower/logging/subscriber.rb
1155
+ - lib/command_tower/password_policy/blocklist.rb
1104
1156
  - lib/command_tower/password_recovery/authorization_helper.rb
1105
1157
  - lib/command_tower/principal_capabilities.rb
1106
1158
  - lib/command_tower/redis_connection.rb
@@ -1179,7 +1231,9 @@ files:
1179
1231
  - lib/tasks/home_notices.rake
1180
1232
  - lib/tasks/install.rake
1181
1233
  - lib/tasks/ui.rake
1234
+ - lib/tasks/user_secrets.rake
1182
1235
  - lib/tasks/users.rake
1236
+ - spec/factories/device_session.rb
1183
1237
  - spec/factories/entity.rb
1184
1238
  - spec/factories/impersonation_session.rb
1185
1239
  - spec/factories/messaging.rb