basecradle 0.17.1 → 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: ed712d18801dc382a1d6e7de8d46cb15b38d0a4f5919d088ff9f2f9a2b5ffd74
4
- data.tar.gz: 48d2e6bb60b4bdd1bcecc25f8c408583099e33d695f6878496a7375619bedb71
3
+ metadata.gz: 9f95fcda9f2157a91e2278019f201e714dc57a048f1f7e0b819bc2b39e968dfe
4
+ data.tar.gz: a98cad0a7c156461386a585a794051ea6a4c26efd1f315779d46c85b5119049b
5
5
  SHA512:
6
- metadata.gz: b7de34f21883864800cdf9d7af5922e8d395abed103a59b540960ce3bffafbb7575cb48b7c704d65d0b308bfd0d21714037f86d0a77dac297a2cc42da45f8080
7
- data.tar.gz: df8d41490def1a844806f0b605d5f05f48e0f7740ba872d67ace03381c359ba0ced89188cc2ba15d4ffaa307d084611a13cd9afcadaaebe6b00c12ca8c4ad4f5
6
+ metadata.gz: bf93d1e87f3931c3924b5446d090d38307b1d54cfaaa4edb0365b96cc8b7af4111c908638e707c44f1bbed7499055de064324168141339428f895a89def52728
7
+ data.tar.gz: df8cda75e927c9caa6d67066ec5ff4dcdb216981908f649fd8cdc8682006c1f7056c48d6e309a517b8aaf46c1540794f3d686da811ea958cb024e6e9550aadea
data/CHANGELOG.md CHANGED
@@ -9,6 +9,37 @@ 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
+
12
43
  ## [0.17.1] - 2026-11-21
13
44
 
14
45
  A patch release that corrects what the SDK says about the user directory
@@ -117,6 +148,9 @@ you upgrade your own Ruby, to 3.3.14, 3.4.13 or 4.0.10.
117
148
  an error message.
118
149
  - **`signature_header:`** names the header the signature is read from, for
119
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.*
120
154
  - **`clear_verification`** sends `clear_credential: true`, which removes the secret and
121
155
  turns verification off.
122
156
  - Both update the endpoint in place and return it, like `rotate`, so the new state
@@ -847,6 +881,8 @@ enrichments come with them — but three things that worked on a `Hash` no longe
847
881
  and it is never auto-retried, being an unkeyed write. The spec drift-guard is what
848
882
  turned it up: core #585 moved the endpoint to `204`, bringing it into the generated
849
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.*
850
886
 
851
887
  ### Removed
852
888
 
@@ -1041,6 +1077,7 @@ the Python SDK's behavior in idiomatic Ruby. Zero runtime dependencies.
1041
1077
  - **Quality bars** — a README-as-tested-doc harness (every example runs against a mocked
1042
1078
  API) and a spec drift-guard (CI fails if the live API grows beyond the SDK).
1043
1079
 
1080
+ [0.17.2]: https://github.com/basecradle/basecradle-ruby/releases/tag/v0.17.2
1044
1081
  [0.17.1]: https://github.com/basecradle/basecradle-ruby/releases/tag/v0.17.1
1045
1082
  [0.17.0]: https://github.com/basecradle/basecradle-ruby/releases/tag/v0.17.0
1046
1083
  [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,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
 
@@ -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.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.1
4
+ version: 0.17.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Drawk Kwast