basecradle 0.17.0 → 0.17.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0191ce23126da34557525a03c8c07cc0c6b0f680ac5e51c3c1b8e39a1e7ea069'
4
- data.tar.gz: d89747904daec8ecf15747eb5d97a957c14db3e5bbb459fd39b3d2868555a9a4
3
+ metadata.gz: 9f95fcda9f2157a91e2278019f201e714dc57a048f1f7e0b819bc2b39e968dfe
4
+ data.tar.gz: a98cad0a7c156461386a585a794051ea6a4c26efd1f315779d46c85b5119049b
5
5
  SHA512:
6
- metadata.gz: 2aab1b473c918bdb9a0be59cb806733d336a90d6a9ade234d036abf251c70d5604a1834117ad7b8cfb643ec4a892acd97983e6760c39b7ff50ec2e5804c35a50
7
- data.tar.gz: 21925cd267079f8fcc1812c29ca0e083b6b828ce895d47e307b9f9ebdda69fb9ce3171263caa5cb6822c6a990f56bc054a3c51836435ce93d8715ce0d966c50e
6
+ metadata.gz: bf93d1e87f3931c3924b5446d090d38307b1d54cfaaa4edb0365b96cc8b7af4111c908638e707c44f1bbed7499055de064324168141339428f895a89def52728
7
+ data.tar.gz: df8cda75e927c9caa6d67066ec5ff4dcdb216981908f649fd8cdc8682006c1f7056c48d6e309a517b8aaf46c1540794f3d686da811ea958cb024e6e9550aadea
data/CHANGELOG.md CHANGED
@@ -9,6 +9,60 @@ section**. The newest heading is always the version `lib/basecradle/version.rb`
9
9
  a release writes its entry and its version in the same PR — and `test/changelog_test.rb`
10
10
  fails CI if the two ever disagree.
11
11
 
12
+ ## [0.17.2] - 2026-11-26
13
+
14
+ A patch release that corrects what the SDK says about two platform changes of 2026-11-25
15
+ ([#332](https://github.com/basecradle/basecradle-ruby/issues/332)). No code path changes:
16
+ no verb is added or removed, and no signature changes.
17
+
18
+ ### Fixed
19
+
20
+ - **A password change signs out every other session, and the SDK now says so.** Since
21
+ 2026-11-25 a successful `bc.change_password` destroys every other session of the
22
+ account, browser sessions and API tokens alike, and each raises
23
+ `BaseCradle::AuthenticationError` (`401`) from then on. The token that made the call
24
+ keeps working, so the calling client goes on as before; a change that fails signs
25
+ nothing out. The README and `Client#change_password` said the opposite, as security
26
+ advice: that a password change is not a sign-out and every session stays valid. If you
27
+ run several clients on one account, mint each a new token after the change. If the
28
+ token you suspect is the one you called with, revoke it too (`bc.sign_out`, or
29
+ `bc.sessions.revoke_all`).
30
+ - **An endpoint's `verifier` has four schemes, not two.** Besides `hmac_sha256_hex` and
31
+ `github`, the platform now verifies `shared_secret_header`, for a sender that cannot
32
+ sign and sends the secret itself in the header `signature_header` names, and `slack`,
33
+ for a Slack app's Events API, whose `url_verification` handshake the endpoint answers
34
+ itself without creating an event. `configure_verification` already passed the verifier
35
+ through as a string, so both work with this SDK as it is; only the docs listed two.
36
+ The README, `WebhookVerification` and `configure_verification` now list all four, and
37
+ say what `signature_header` means under each: the signature's header under
38
+ `hmac_sha256_hex`, the secret's under `shared_secret_header`, ignored by `github` and
39
+ `slack`. It is required in the same call that moves an endpoint to
40
+ `shared_secret_header`, or from it back to `hmac_sha256_hex`; a call that passes only
41
+ `verifier:` there raises `BaseCradle::ValidationError`.
42
+
43
+ ## [0.17.1] - 2026-11-21
44
+
45
+ A patch release that corrects what the SDK says about the user directory
46
+ ([#324](https://github.com/basecradle/basecradle-ruby/issues/324)). No code path changes:
47
+ no verb is added or removed, and no signature changes.
48
+
49
+ ### Fixed
50
+
51
+ - **The user directory reads A to Z by handle, and the SDK now says so.** 0.17.0 said
52
+ `bc.users` arrives newest first. That order was a short-lived regression in the API,
53
+ fixed on 2026-11-21: the directory is ordered by handle again, and a user created today
54
+ takes its place by name, not the top. It still pages to its end as you iterate, and
55
+ `bc.users.total_count` still counts it. You do not need `bc.users.sort_by(&:handle)`,
56
+ the workaround 0.17.0 suggested. The README, `UsersResource` and the pagination notes
57
+ say so, with what does not carry over from time-ordered lists: there is no high-water
58
+ mark to checkpoint against, and a user an admin renames while you iterate can be missed
59
+ or met twice.
60
+ - **A cursor is not always a record uuid.** In the directory it is a handle, and the SDK
61
+ passes it back exactly as received, never checking its shape (a test pages the
62
+ directory with a handle cursor). `InvalidCursorError` (`invalid_cursor`) is documented
63
+ as the API now defines it: a cursor no list could have returned, which is a malformed
64
+ uuid, or in the directory, something that is not a plain string.
65
+
12
66
  ## [0.17.0] - 2026-11-21
13
67
 
14
68
  A minor release that tracks two API changes of 2026-11-21: every list now reports its
@@ -34,6 +88,8 @@ if you relied on it.
34
88
  first (the most recently created user leads) instead of by handle. Iterating it still
35
89
  yields every user you can see; only the order is different. If you relied on
36
90
  alphabetical order, sort it yourself: `bc.users.sort_by(&:handle)`.
91
+ *Corrected in 0.17.1: the newest-first order was a regression in the API, since fixed.
92
+ The directory reads A to Z by handle.*
37
93
 
38
94
  ## [0.16.0] - 2026-11-20
39
95
 
@@ -92,6 +148,9 @@ you upgrade your own Ruby, to 3.3.14, 3.4.13 or 4.0.10.
92
148
  an error message.
93
149
  - **`signature_header:`** names the header the signature is read from, for
94
150
  `hmac_sha256_hex` only. A `github` endpoint always reads `X-Hub-Signature-256`.
151
+ *Corrected in 0.17.2: since 2026-11-25 the platform has four schemes, adding
152
+ `shared_secret_header` and `slack`, and `signature_header:` also names the header a
153
+ `shared_secret_header` endpoint reads the secret from.*
95
154
  - **`clear_verification`** sends `clear_credential: true`, which removes the secret and
96
155
  turns verification off.
97
156
  - Both update the endpoint in place and return it, like `rotate`, so the new state
@@ -822,6 +881,8 @@ enrichments come with them — but three things that worked on a `Hash` no longe
822
881
  and it is never auto-retried, being an unkeyed write. The spec drift-guard is what
823
882
  turned it up: core #585 moved the endpoint to `204`, bringing it into the generated
824
883
  OpenAPI spec for the first time.
884
+ *Corrected in 0.17.2: since 2026-11-25 a password change signs out every other
885
+ session of the account. The token that made the call keeps working.*
825
886
 
826
887
  ### Removed
827
888
 
@@ -1016,6 +1077,8 @@ the Python SDK's behavior in idiomatic Ruby. Zero runtime dependencies.
1016
1077
  - **Quality bars** — a README-as-tested-doc harness (every example runs against a mocked
1017
1078
  API) and a spec drift-guard (CI fails if the live API grows beyond the SDK).
1018
1079
 
1080
+ [0.17.2]: https://github.com/basecradle/basecradle-ruby/releases/tag/v0.17.2
1081
+ [0.17.1]: https://github.com/basecradle/basecradle-ruby/releases/tag/v0.17.1
1019
1082
  [0.17.0]: https://github.com/basecradle/basecradle-ruby/releases/tag/v0.17.0
1020
1083
  [0.16.0]: https://github.com/basecradle/basecradle-ruby/releases/tag/v0.16.0
1021
1084
  [0.15.0]: https://github.com/basecradle/basecradle-ruby/releases/tag/v0.15.0
data/README.md CHANGED
@@ -203,6 +203,10 @@ endpoint.rotate # leaked URL? new ingest_url, old one dies, uuid unchanged
203
203
  # Require signed deliveries. Here: a GitHub webhook, whose Secret at GitHub is this value
204
204
  endpoint.configure_verification(verifier: "github", credential: "kT9vQ2mXw7RbLp4ZsYc81NdHaUeJ3gFo")
205
205
  puts endpoint.content.verification.signature_header # X-Hub-Signature-256
206
+ # Or a sender that cannot sign, sending `X-Webhook-Secret: <the secret>`. The header is
207
+ # required in the same call that chooses this scheme
208
+ endpoint.configure_verification(verifier: "shared_secret_header", signature_header: "X-Webhook-Secret",
209
+ credential: "kT9vQ2mXw7RbLp4ZsYc81NdHaUeJ3gFo")
206
210
  endpoint.clear_verification # remove the secret: unsigned deliveries are accepted again
207
211
 
208
212
  # Read what came in — across all timelines, or narrowed
@@ -222,17 +226,31 @@ and the SDK invents none. `BaseCradle.uuid_of(endpoint)` reads it too, and is wh
222
226
  **Signature verification is configured with two verbs.**
223
227
  `endpoint.configure_verification(verifier:, credential:, signature_header:)` sends only
224
228
  the keywords you pass, so anything left out stays as it is; passing none raises
225
- `ArgumentError` before any request. `verifier:` is the scheme — `"hmac_sha256_hex"` (the
226
- default; any sender you control) or `"github"` (GitHub's own `X-Hub-Signature-256`, so a
227
- GitHub webhook can point straight at the `ingest_url`) — and is passed through as given,
228
- so a scheme the platform adds later needs no SDK release; one it does not know raises
229
- `BaseCradle::ValidationError`. `credential:` is the signing secret, and setting it turns
230
- verification on; a blank one is no change at all (the API's rule): the current secret
229
+ `ArgumentError` before any request. `verifier:` is the scheme, one of four today:
230
+
231
+ | `verifier:` | For | The header it reads |
232
+ |---|---|---|
233
+ | `"hmac_sha256_hex"` (the default) | any sender you control | `X-Signature`, or the `signature_header:` you set; carries the HMAC-SHA256 hex digest of the body |
234
+ | `"github"` | a GitHub webhook, pointed straight at the `ingest_url` | `X-Hub-Signature-256`, fixed |
235
+ | `"shared_secret_header"` | a sender that cannot sign | the `signature_header:` you set; carries the secret itself |
236
+ | `"slack"` | a Slack app's Events API | `X-Slack-Signature`, fixed; the endpoint answers Slack's `url_verification` handshake itself, and the handshake creates no event |
237
+
238
+ The verifier is passed through as given, so a scheme the platform adds later needs no SDK
239
+ release; one it does not know raises `BaseCradle::ValidationError`. Use a signing scheme
240
+ whenever the sender can sign: `shared_secret_header` proves only that the sender holds the
241
+ secret, not that the body arrived unaltered. `credential:` is the signing secret (under
242
+ `shared_secret_header`, the header's exact value, compared as sent, so include any prefix
243
+ such as `Bearer `), and setting it turns verification on; a blank one is no change at all (the API's rule): the current secret
231
244
  stays, and `verification.enabled` cannot tell you a rotation was skipped, so make sure a
232
245
  secret read from the environment is not empty before passing it. It is **write-only**: the
233
246
  API never returns it, and the SDK keeps no copy and never puts it in an `inspect` or an
234
- error message. `signature_header:` names the header an `hmac_sha256_hex` endpoint reads the
235
- signature from. `endpoint.clear_verification` removes the secret and turns verification
247
+ error message. `signature_header:` names the header that is read: the signature's under
248
+ `hmac_sha256_hex`, the secret's under `shared_secret_header`; a `github` or `slack`
249
+ endpoint ignores it. **Pass it in the same call that moves an endpoint to
250
+ `shared_secret_header`, or from it back to `hmac_sha256_hex`** — a header named for one
251
+ scheme is never carried over to the other, so a call that passes only `verifier:` raises
252
+ `BaseCradle::ValidationError`. A move from `shared_secret_header` to `github` or `slack`
253
+ that names no header resets it to `X-Signature`. `endpoint.clear_verification` removes the secret and turns verification
236
254
  off. Both return the endpoint, updated in place; read the result at
237
255
  `endpoint.content.verification`. How senders sign is in the API docs:
238
256
  [Verifying Inbound Deliveries](https://basecradle.com/docs/api#verifying-inbound-deliveries-optional).
@@ -350,7 +368,7 @@ bc.change_password(current_password: "correct-horse-battery-staple",
350
368
  # => nil (204 No Content)
351
369
  ```
352
370
 
353
- A password change is **not** a sign-out: every session stays valid, this client's token included. Revoke separately if a credential is suspect. A wrong current password raises `BaseCradle::CurrentPasswordIncorrectError`, a mismatched confirmation raises `BaseCradle::PasswordConfirmationMismatchError`, and a new password that fails the platform's rules (10+ characters, mixed case, a number or symbol) raises `BaseCradle::ValidationError` carrying the model's `errors`. The first two are **subclasses** of the third, so rescue them before `ValidationError` — rescuing only `ValidationError` catches all three, and the first two carry no `errors`.
371
+ **A password change signs out every other session of the account**, browser sessions and API tokens alike: each of them raises `BaseCradle::AuthenticationError` (`401`) from then on, so if you run several clients on one account, mint each a new token with `BaseCradle::Client.login(...)` after the change. **The token that made the call keeps working** — this client goes on as before. So a password change does cut off a credential someone else holds, but not the one you just used: if that is the token you suspect, revoke it too (`bc.sign_out`, or `bc.sessions.revoke_all` to end everything at once). A change that fails signs nothing out. A wrong current password raises `BaseCradle::CurrentPasswordIncorrectError`, a mismatched confirmation raises `BaseCradle::PasswordConfirmationMismatchError`, and a new password that fails the platform's rules (10+ characters, mixed case, a number or symbol) raises `BaseCradle::ValidationError` carrying the model's `errors`. The first two are **subclasses** of the third, so rescue them before `ValidationError` — rescuing only `ValidationError` catches all three, and the first two carry no `errors`.
354
372
 
355
373
  ## Users & trust
356
374
 
@@ -361,7 +379,7 @@ require "basecradle"
361
379
 
362
380
  bc = BaseCradle::Client.new
363
381
 
364
- bc.users.each do |user| # the directory — every peer you can see, newest first
382
+ bc.users.each do |user| # the directory — every peer you can see, A to Z by handle
365
383
  puts [user.handle, user.kind, user.trust.mutual].inspect
366
384
  end
367
385
  puts bc.users.total_count # how many peers you can see
@@ -382,7 +400,7 @@ timeline = bc.timelines.create(name: "Incident response")
382
400
  timeline.add_participant(nova)
383
401
  ```
384
402
 
385
- The directory is a list like every other: newest first (the most recently created user leads), paged through to its end as you iterate. It used to arrive in one response ordered by handle; iterating it still yields every user you can see, only the order has changed. If you relied on alphabetical order, sort it yourself: `bc.users.sort_by(&:handle)`.
403
+ The directory reads A to Z by handle: a user created today takes its place by name, not the top. It is the one list not ordered by time, and it pages like every other, through to its end as you iterate. A newcomer can land on any page, so to see who is new, read the directory again. A handle changes only when an admin renames a user, but a user renamed while you are iterating can be missed or met twice: if the number of distinct users you collected (by `uuid`) does not match `bc.users.total_count`, read it again.
386
404
 
387
405
  ## Contact messages & notes (admin-only)
388
406
 
@@ -205,10 +205,13 @@ module BaseCradle
205
205
  # +password_confirmation+ must match +password+ — the API rejects a mismatch rather
206
206
  # than guessing which one you meant.
207
207
  #
208
- # A password change is *not* a sign-out: every session stays valid, web and API
209
- # tokens alike, this client's included. Revoke separately if a credential is suspect
210
- # (+session.revoke+, or +bc.sessions.revoke_all+ for all of them). It is never
211
- # auto-retried either — an unkeyed write, so +max_retries+ leaves it alone.
208
+ # A successful change signs out every *other* session of the account, browser
209
+ # sessions and API tokens alike: each raises AuthenticationError (401) from then on,
210
+ # so another client on the same account needs a new token (+Client.login+). The token
211
+ # that made the call keeps working, so this client goes on as before; if that token
212
+ # is the one you suspect, revoke it too (+sign_out+, or +sessions.revoke_all+). A
213
+ # change that fails signs nothing out. It is never auto-retried — an unkeyed write,
214
+ # so +max_retries+ leaves it alone.
212
215
  #
213
216
  # Raises +CurrentPasswordIncorrectError+ when the current password is wrong,
214
217
  # +PasswordConfirmationMismatchError+ when the confirmation differs, and a
@@ -134,7 +134,9 @@ module BaseCradle
134
134
  # The request was malformed (HTTP 400).
135
135
  class InvalidRequestError < Error; end
136
136
 
137
- # +invalid_cursor+ — the +before+ pagination cursor is not a valid record UUID.
137
+ # +invalid_cursor+ — the +before+ pagination cursor is not one a list could have returned:
138
+ # not a valid record UUID, or, in the user directory (whose cursor is a handle), not a
139
+ # plain string.
138
140
  class InvalidCursorError < InvalidRequestError; end
139
141
 
140
142
  # +invalid_filter+ — a list filter value is malformed.
@@ -3,10 +3,14 @@
3
3
  require_relative "serialization"
4
4
 
5
5
  module BaseCradle
6
- # The shared cursor-pagination engine. Every list endpoint paginates the same way:
7
- # newest first, up to 50 per page, +next_cursor+ in the response passed back as
8
- # +?before=+ for the next (older) page, a +null+ cursor meaning the end. Every page also
9
- # carries +total_count+: how many records the whole list holds under the filters passed.
6
+ # The shared cursor-pagination engine. Every list endpoint paginates the same way: up to
7
+ # 50 per page, +next_cursor+ in the response passed back as +?before=+ for the next page,
8
+ # a +null+ cursor meaning the end. Every list is newest first except the user directory,
9
+ # which reads A to Z by handle. Every page also carries +total_count+: how many records
10
+ # the whole list holds under the filters passed.
11
+ #
12
+ # The cursor is opaque: a record uuid in most lists, a handle in the directory. It is
13
+ # passed back exactly as received, and nothing here checks its shape.
10
14
  #
11
15
  # Lazy and +Enumerable+: the first page is fetched when iteration starts, and page N+1
12
16
  # only when iteration crosses the page boundary — so +first+/+take+/+find+ stop early
@@ -95,9 +95,10 @@ module BaseCradle
95
95
  end
96
96
  end
97
97
 
98
- # The directory of other users — you are never listed; hidden users are omitted. It is a
99
- # list like every other: newest first (the most recently created user leads),
100
- # auto-paginating to the end, with +total_count+ for how many users you can see.
98
+ # The directory of other users — you are never listed; hidden users are omitted. It reads
99
+ # A to Z by handle (a user created today takes its place by name, not the top), the one
100
+ # list not ordered by time. It auto-paginates to the end like every other, its cursor a
101
+ # handle rather than a uuid, with +total_count+ for how many users you can see.
101
102
  #
102
103
  # bc.users.each { |user| puts [user.handle, user.kind, user.trust.mutual].inspect }
103
104
  class UsersResource
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BaseCradle
4
- VERSION = "0.17.0"
4
+ VERSION = "0.17.2"
5
5
  end
@@ -17,8 +17,13 @@ module BaseCradle
17
17
  # +endpoint.clear_verification+.
18
18
  class WebhookVerification < ApiObject
19
19
  attribute :enabled
20
- attribute :signature_header # for a "github" endpoint, always "X-Hub-Signature-256"
21
- attribute :verifier # "hmac_sha256_hex" or "github" — an open set; read it as a string
20
+ # The header deliveries are checked against: the signature's under "hmac_sha256_hex",
21
+ # the secret's under "shared_secret_header". A "github" endpoint reports its fixed
22
+ # X-Hub-Signature-256 here; a "slack" endpoint always reads X-Slack-Signature.
23
+ attribute :signature_header
24
+ # "hmac_sha256_hex", "github", "shared_secret_header" or "slack" today — an open set;
25
+ # read it as a string.
26
+ attribute :verifier
22
27
  end
23
28
 
24
29
  # An endpoint's content: identity, state, and the rotatable ingest URL.
@@ -71,20 +76,31 @@ module BaseCradle
71
76
  # stays as it is; pass at least one, or this raises ArgumentError before any request
72
77
  # is made.
73
78
  #
74
- # - +verifier+ is the scheme: "hmac_sha256_hex" (the default) or "github". It is
75
- # passed through as given, so a scheme the platform adds later works here unchanged;
76
- # one it does not know raises ValidationError.
79
+ # - +verifier+ is the scheme, one of four today: "hmac_sha256_hex" (the default; any
80
+ # sender you control signs the body), "github" (a GitHub webhook), "slack" (a Slack
81
+ # app's Events API; the endpoint answers Slack's url_verification handshake itself,
82
+ # and the handshake creates no event) or "shared_secret_header" (a sender that
83
+ # cannot sign sends the secret itself in a header). It is passed through as given,
84
+ # so a scheme the platform adds later works here unchanged; one it does not know
85
+ # raises ValidationError.
77
86
  # - +credential+ is the signing secret, sent as +verification_credential+: setting it
78
- # turns verification on. A blank one is sent as given and the API treats it as no
79
- # change: the current secret, if any, stays, and +content.verification.enabled+
87
+ # turns verification on. Under "shared_secret_header" nothing is signed: it is the
88
+ # header's exact value, compared as sent, so include any prefix the sender adds. A
89
+ # blank one is sent as given and the API treats it as no change: the current
90
+ # secret, if any, stays, and +content.verification.enabled+
80
91
  # cannot tell that skipped rotation from a real one, so make sure a secret read from
81
92
  # the environment is not empty before passing it. It is sent as its bytes, which
82
93
  # must be UTF-8 (a BINARY string read from a file is fine); a credential that is not
83
94
  # a String, or whose bytes are not UTF-8, raises ArgumentError before any request,
84
95
  # and the error never shows it. It is write-only: the API never returns it, and this
85
96
  # SDK keeps no copy and never puts it in an inspect or an error message.
86
- # - +signature_header+ is the header the signature is read from, for
87
- # "hmac_sha256_hex" only; a "github" endpoint always reads X-Hub-Signature-256.
97
+ # - +signature_header+ is the header that is read: the signature's under
98
+ # "hmac_sha256_hex", the secret's under "shared_secret_header". A "github" or
99
+ # "slack" endpoint ignores it. Pass it in the same call that moves an endpoint to
100
+ # "shared_secret_header", or from it back to "hmac_sha256_hex": a header named for
101
+ # one is never carried over to the other, so passing only +verifier+ there raises
102
+ # ValidationError. A move from "shared_secret_header" to "github" or "slack" that
103
+ # names no header resets it to X-Signature.
88
104
  #
89
105
  # Any viewer of the endpoint's timeline may configure it, locked timeline or not.
90
106
  # Returns this endpoint, which adopts the one the API returns, so
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: basecradle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.17.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Drawk Kwast