basecradle 0.17.1 → 0.17.3

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: ed712d18801dc382a1d6e7de8d46cb15b38d0a4f5919d088ff9f2f9a2b5ffd74
4
- data.tar.gz: 48d2e6bb60b4bdd1bcecc25f8c408583099e33d695f6878496a7375619bedb71
3
+ metadata.gz: 3678e2e214d103af05b907532dd29db2adf6ab1b952194224bbb72421a44f379
4
+ data.tar.gz: 42fa863ec1f9b122d3c9199323fda9a94060ea54f5b1810afcb966bd8ee83285
5
5
  SHA512:
6
- metadata.gz: b7de34f21883864800cdf9d7af5922e8d395abed103a59b540960ce3bffafbb7575cb48b7c704d65d0b308bfd0d21714037f86d0a77dac297a2cc42da45f8080
7
- data.tar.gz: df8d41490def1a844806f0b605d5f05f48e0f7740ba872d67ace03381c359ba0ced89188cc2ba15d4ffaa307d084611a13cd9afcadaaebe6b00c12ca8c4ad4f5
6
+ metadata.gz: 04c4f0257547edab6f5304807288ee043873af0473d6c1bd31d2ba4e8e734ea2cbd74f7cfe1c4b8f811ba18f878a4534f402c83e8fa559cb64ff11706aafb769
7
+ data.tar.gz: b7b71f2f8fdb4527785fc17cdc023a618419b62c4c22699173df8c33034208b9c25c70319cf76bfd3ad3fcd1ce5386160d5cfe14d4508b6e928b383fc329df76
data/CHANGELOG.md CHANGED
@@ -9,6 +9,64 @@ 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.3] - 2026-11-26
13
+
14
+ A patch release that corrects what the SDK says about a platform change of 2026-11-26
15
+ ([#334](https://github.com/basecradle/basecradle-ruby/issues/334)). No code path changes:
16
+ no verb is added or removed, and no signature changes.
17
+
18
+ ### Fixed
19
+
20
+ - **An endpoint's `verifier` has five schemes, not four.** The platform now verifies
21
+ `twilio`, for the webhooks Twilio sends (an incoming text message, a recording or
22
+ transcription callback, a status callback). It reads Twilio's own `X-Twilio-Signature`,
23
+ fixed, so `signature_header` is ignored as it is under `github` and `slack`, and a move
24
+ from `shared_secret_header` to `twilio` that names no header resets it to `X-Signature`.
25
+ The secret is a shared key made at Twilio for signing webhooks (Twilio's own
26
+ recommendation) or the account's Auth Token. Twilio signs the URL it was given, so give
27
+ it the endpoint's `ingest_url` exactly as the endpoint reports it. Twilio also reads the
28
+ reply to a delivery, so a `twilio` endpoint answers each delivery it stores with
29
+ `200 OK` and an empty TwiML document in place of the empty `201`; that is the
30
+ endpoint's answer to the sender, and nothing this SDK returns changes. The empty answer
31
+ ends a voice call, so an `ingest_url` is never a number's voice URL, and an endpoint
32
+ holds one secret, so a change between a shared key and the Auth Token is made here in
33
+ the same minute as at Twilio; the README says both.
34
+ `configure_verification` already passed the verifier through as a string, so `twilio`
35
+ works with this SDK as it is; only the docs listed four. The README,
36
+ `WebhookVerification` and `configure_verification` now list all five.
37
+
38
+ ## [0.17.2] - 2026-11-26
39
+
40
+ A patch release that corrects what the SDK says about two platform changes of 2026-11-25
41
+ ([#332](https://github.com/basecradle/basecradle-ruby/issues/332)). No code path changes:
42
+ no verb is added or removed, and no signature changes.
43
+
44
+ ### Fixed
45
+
46
+ - **A password change signs out every other session, and the SDK now says so.** Since
47
+ 2026-11-25 a successful `bc.change_password` destroys every other session of the
48
+ account, browser sessions and API tokens alike, and each raises
49
+ `BaseCradle::AuthenticationError` (`401`) from then on. The token that made the call
50
+ keeps working, so the calling client goes on as before; a change that fails signs
51
+ nothing out. The README and `Client#change_password` said the opposite, as security
52
+ advice: that a password change is not a sign-out and every session stays valid. If you
53
+ run several clients on one account, mint each a new token after the change. If the
54
+ token you suspect is the one you called with, revoke it too (`bc.sign_out`, or
55
+ `bc.sessions.revoke_all`).
56
+ - **An endpoint's `verifier` has four schemes, not two.** Besides `hmac_sha256_hex` and
57
+ `github`, the platform now verifies `shared_secret_header`, for a sender that cannot
58
+ sign and sends the secret itself in the header `signature_header` names, and `slack`,
59
+ for a Slack app's Events API, whose `url_verification` handshake the endpoint answers
60
+ itself without creating an event. `configure_verification` already passed the verifier
61
+ through as a string, so both work with this SDK as it is; only the docs listed two.
62
+ The README, `WebhookVerification` and `configure_verification` now list all four, and
63
+ say what `signature_header` means under each: the signature's header under
64
+ `hmac_sha256_hex`, the secret's under `shared_secret_header`, ignored by `github` and
65
+ `slack`. It is required in the same call that moves an endpoint to
66
+ `shared_secret_header`, or from it back to `hmac_sha256_hex`; a call that passes only
67
+ `verifier:` there raises `BaseCradle::ValidationError`.
68
+ *Corrected in 0.17.3: since 2026-11-26 it has five, adding `twilio`.*
69
+
12
70
  ## [0.17.1] - 2026-11-21
13
71
 
14
72
  A patch release that corrects what the SDK says about the user directory
@@ -117,6 +175,10 @@ you upgrade your own Ruby, to 3.3.14, 3.4.13 or 4.0.10.
117
175
  an error message.
118
176
  - **`signature_header:`** names the header the signature is read from, for
119
177
  `hmac_sha256_hex` only. A `github` endpoint always reads `X-Hub-Signature-256`.
178
+ *Corrected in 0.17.2: since 2026-11-25 the platform has four schemes, adding
179
+ `shared_secret_header` and `slack`, and `signature_header:` also names the header a
180
+ `shared_secret_header` endpoint reads the secret from. Corrected again in 0.17.3:
181
+ since 2026-11-26 it has five, adding `twilio`.*
120
182
  - **`clear_verification`** sends `clear_credential: true`, which removes the secret and
121
183
  turns verification off.
122
184
  - Both update the endpoint in place and return it, like `rotate`, so the new state
@@ -847,6 +909,8 @@ enrichments come with them — but three things that worked on a `Hash` no longe
847
909
  and it is never auto-retried, being an unkeyed write. The spec drift-guard is what
848
910
  turned it up: core #585 moved the endpoint to `204`, bringing it into the generated
849
911
  OpenAPI spec for the first time.
912
+ *Corrected in 0.17.2: since 2026-11-25 a password change signs out every other
913
+ session of the account. The token that made the call keeps working.*
850
914
 
851
915
  ### Removed
852
916
 
@@ -1041,6 +1105,8 @@ the Python SDK's behavior in idiomatic Ruby. Zero runtime dependencies.
1041
1105
  - **Quality bars** — a README-as-tested-doc harness (every example runs against a mocked
1042
1106
  API) and a spec drift-guard (CI fails if the live API grows beyond the SDK).
1043
1107
 
1108
+ [0.17.3]: https://github.com/basecradle/basecradle-ruby/releases/tag/v0.17.3
1109
+ [0.17.2]: https://github.com/basecradle/basecradle-ruby/releases/tag/v0.17.2
1044
1110
  [0.17.1]: https://github.com/basecradle/basecradle-ruby/releases/tag/v0.17.1
1045
1111
  [0.17.0]: https://github.com/basecradle/basecradle-ruby/releases/tag/v0.17.0
1046
1112
  [0.16.0]: https://github.com/basecradle/basecradle-ruby/releases/tag/v0.16.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,43 @@ 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 five 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
+ | `"twilio"` | the webhooks Twilio sends (an incoming text message, a recording or transcription callback, a status callback) | `X-Twilio-Signature`, fixed; Twilio signs the URL it was given, so give it the `ingest_url` exactly as the endpoint reports it |
238
+
239
+ Under `twilio` the secret is a shared key made at Twilio for signing webhooks (Twilio's own
240
+ recommendation) or the account's Auth Token. Twilio reads the reply to a delivery, so a
241
+ `twilio` endpoint answers each delivery it stores with `200 OK` and an empty TwiML document
242
+ in place of the empty `201`. That is the endpoint's answer to the sender; nothing this SDK
243
+ returns changes. The empty answer also ends a voice call, so never make the `ingest_url` a
244
+ number's voice URL: answer the call with TwiML of your own that records a message, and point
245
+ the recording's callbacks here. An endpoint holds one secret, a delivery signed with the
246
+ other is refused with `401`, and Twilio does not resend it by default, so when you switch
247
+ between a shared key and the Auth Token, or replace a shared key, change the secret here in
248
+ the same minute you change it at Twilio.
249
+
250
+ The verifier is passed through as given, so a scheme the platform adds later needs no SDK
251
+ release; one it does not know raises `BaseCradle::ValidationError`. Use a signing scheme
252
+ whenever the sender can sign: `shared_secret_header` proves only that the sender holds the
253
+ secret, not that the body arrived unaltered. `credential:` is the signing secret (under
254
+ `shared_secret_header`, the header's exact value, compared as sent, so include any prefix
255
+ 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
256
  stays, and `verification.enabled` cannot tell you a rotation was skipped, so make sure a
232
257
  secret read from the environment is not empty before passing it. It is **write-only**: the
233
258
  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
259
+ error message. `signature_header:` names the header that is read: the signature's under
260
+ `hmac_sha256_hex`, the secret's under `shared_secret_header`; a `github`, `slack` or
261
+ `twilio` endpoint ignores it. **Pass it in the same call that moves an endpoint to
262
+ `shared_secret_header`, or from it back to `hmac_sha256_hex`** — a header named for one
263
+ scheme is never carried over to the other, so a call that passes only `verifier:` raises
264
+ `BaseCradle::ValidationError`. A move from `shared_secret_header` to `github`, `slack` or
265
+ `twilio` that names no header resets it to `X-Signature`. `endpoint.clear_verification` removes the secret and turns verification
236
266
  off. Both return the endpoint, updated in place; read the result at
237
267
  `endpoint.content.verification`. How senders sign is in the API docs:
238
268
  [Verifying Inbound Deliveries](https://basecradle.com/docs/api#verifying-inbound-deliveries-optional).
@@ -350,7 +380,7 @@ bc.change_password(current_password: "correct-horse-battery-staple",
350
380
  # => nil (204 No Content)
351
381
  ```
352
382
 
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`.
383
+ **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
384
 
355
385
  ## Users & trust
356
386
 
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BaseCradle
4
- VERSION = "0.17.1"
4
+ VERSION = "0.17.3"
5
5
  end
@@ -17,8 +17,14 @@ 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, and a
23
+ # "twilio" endpoint X-Twilio-Signature.
24
+ attribute :signature_header
25
+ # "hmac_sha256_hex", "github", "shared_secret_header", "slack" or "twilio" today — an
26
+ # open set; read it as a string.
27
+ attribute :verifier
22
28
  end
23
29
 
24
30
  # An endpoint's content: identity, state, and the rotatable ingest URL.
@@ -71,20 +77,43 @@ module BaseCradle
71
77
  # stays as it is; pass at least one, or this raises ArgumentError before any request
72
78
  # is made.
73
79
  #
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.
80
+ # - +verifier+ is the scheme, one of five today: "hmac_sha256_hex" (the default; any
81
+ # sender you control signs the body), "github" (a GitHub webhook),
82
+ # "shared_secret_header" (a sender that cannot sign sends the secret itself in a
83
+ # header), "slack" (a Slack app's Events API; the endpoint answers Slack's
84
+ # url_verification handshake itself, and the handshake creates no event) or "twilio"
85
+ # (the webhooks Twilio sends: an incoming text message, a recording or transcription
86
+ # callback, a status callback). It is passed through as given, so a scheme the
87
+ # platform adds later works here unchanged; one it does not know raises
88
+ # ValidationError. Twilio signs the URL it was given, so give it +content.ingest_url+
89
+ # exactly as the endpoint reports it. Twilio also reads the reply, so a "twilio"
90
+ # endpoint answers each delivery it stores with 200 OK and an empty TwiML document
91
+ # in place of the empty 201: the answer to the sender, which changes nothing this
92
+ # method returns. That empty answer ends a voice call, so the ingest_url is never a
93
+ # number's voice URL; point a recording's callbacks at it instead.
77
94
  # - +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+
80
- # cannot tell that skipped rotation from a real one, so make sure a secret read from
81
- # the environment is not empty before passing it. It is sent as its bytes, which
82
- # must be UTF-8 (a BINARY string read from a file is fine); a credential that is not
83
- # a String, or whose bytes are not UTF-8, raises ArgumentError before any request,
84
- # and the error never shows it. It is write-only: the API never returns it, and this
85
- # 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.
95
+ # turns verification on. Under "shared_secret_header" nothing is signed: it is the
96
+ # header's exact value, compared as sent, so include any prefix the sender adds.
97
+ # Under "twilio" it is a shared key made at Twilio for signing webhooks (Twilio's own
98
+ # recommendation) or the account's Auth Token. An endpoint holds one secret, a
99
+ # delivery signed with the other is refused with 401, and Twilio does not resend it
100
+ # by default: when you switch between the two, or replace a shared key, change it
101
+ # here in the same minute you change it at Twilio. A blank credential is sent as
102
+ # given and the API treats it as no change: the current secret, if any, stays, and
103
+ # +content.verification.enabled+ cannot tell that skipped rotation from a real one,
104
+ # so make sure a secret read from the environment is not empty before passing it. It
105
+ # is sent as its bytes, which must be UTF-8 (a BINARY string read from a file is
106
+ # fine); a credential that is not a String, or whose bytes are not UTF-8, raises
107
+ # ArgumentError before any request, and the error never shows it. It is write-only:
108
+ # the API never returns it, and this SDK keeps no copy and never puts it in an
109
+ # inspect or an error message.
110
+ # - +signature_header+ is the header that is read: the signature's under
111
+ # "hmac_sha256_hex", the secret's under "shared_secret_header". A "github", "slack"
112
+ # or "twilio" endpoint ignores it. Pass it in the same call that moves an endpoint
113
+ # to "shared_secret_header", or from it back to "hmac_sha256_hex": a header named
114
+ # for one is never carried over to the other, so passing only +verifier+ there
115
+ # raises ValidationError. A move from "shared_secret_header" to "github", "slack" or
116
+ # "twilio" that names no header resets it to X-Signature.
88
117
  #
89
118
  # Any viewer of the endpoint's timeline may configure it, locked timeline or not.
90
119
  # 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.1
4
+ version: 0.17.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Drawk Kwast