omniauth-skubana 0.2.0 → 0.2.1

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: cf465c6f804232f21358d25a1ec37d8b19d21f45b1809152ba04d6fed6cc1a37
4
- data.tar.gz: d0f3400463df8476a185831e61edd0812f82a8b83c84e3851ef69ab5f866adc4
3
+ metadata.gz: 80d19c6f5ab2fb372a01532cfb1814e2ae34efbf840323a89f8c425a399a780d
4
+ data.tar.gz: 19781d6be1140de429cb33a8580fcc37ac67a7eb9699c18b149f500323e25d8c
5
5
  SHA512:
6
- metadata.gz: 5c4439c2a44cb8da6d4b3b472a1d95c0f548558ac71d15778d026256d0a78ed907bf0122e8afbc0a977bbbcce265995de9da1d07338a2123686c8277eff2ca30
7
- data.tar.gz: c2e35dc901b768e97b991c5496781bff14e95784cc1111aaad73995ad9dd8bfc394cb7f4d81179ba7f059c056aef1001c2929eb4239aae018866d8ec3a90c35c
6
+ metadata.gz: da2d068c3a63273dba2e8449ca7b339c52385c57a1a4390a312b112a2a9f7eb79d8bf8e96fa4e8e1d9a69ef043da0541ee085e6f04c911c2ab59a1b2eb42cd58
7
+ data.tar.gz: 402082bfeb8a1716ac77c34eca629f1014928eec66202cae4e6d715297a8d4cf48052ad831e70dc202a82a5e81ec7a9024b994c91419398da566032670f8bd7d
data/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## [Unreleased]
6
+
7
+ ### Changed
8
+
9
+ - **Breaking:** the OAuth `state` check is enforced. The strategy no longer sets
10
+ `provider_ignores_state`, so a callback whose `state` is missing or doesn't match the
11
+ session fails with `csrf_detected`. App Store installs need `app_store_install`.
12
+ - The gem version now comes from the release tag. `lib/omniauth-skubana/version.rb` reads
13
+ a top-level `VERSION` file, committed as a `0.0.0` placeholder, which the release
14
+ workflow writes from the tag with its leading `v` stripped.
15
+
16
+ ### Added
17
+
18
+ - `app_store_install` option, for a provider registered with its callback at the URI
19
+ registered for the app with Skubana. An App Store install arrives there with `cid` and
20
+ `code` but no `state`: such callbacks skip the state check and exchange the code with
21
+ `redirect_uri=<callback URL>?cid=<cid>`, as Skubana requires. Previously such codes
22
+ failed with `invalid_grant`.
23
+
5
24
  ## [0.2.0] - 2026-10-19
6
25
 
7
26
  ### Changed
@@ -47,6 +66,7 @@ All notable changes to this project are documented in this file.
47
66
 
48
67
  - Initial published strategy.
49
68
 
69
+ [Unreleased]: https://github.com/dropstream/omniauth-skubana/compare/v0.2.0...master
50
70
  [0.2.0]: https://github.com/dropstream/omniauth-skubana/releases/tag/v0.2.0
51
71
  [0.1.2]: https://rubygems.org/gems/omniauth-skubana/versions/0.1.2
52
72
  [0.1.0]: https://rubygems.org/gems/omniauth-skubana/versions/0.1.0
data/README.md CHANGED
@@ -64,6 +64,31 @@ otherwise append, because Skubana rejects a `redirect_uri` that does not match t
64
64
  registered one exactly. Pass `callback_url` to override it outright; otherwise it is
65
65
  derived from the request, including the mount prefix.
66
66
 
67
+ ### App Store installs
68
+
69
+ An install from Skubana's App Store doesn't go through the request phase: Skubana
70
+ redirects straight to the callback URI registered for the app with `?cid=...&code=...`,
71
+ and no `state`. The code is bound to that registered URI, and must be exchanged with
72
+ `redirect_uri=<registered URI>?cid=<cid>`.
73
+
74
+ To accept App Store installs, register the strategy a second time, under its own name,
75
+ with its callback at the registered URI and `app_store_install` set:
76
+
77
+ ```ruby
78
+ provider :skubana, 'app_key', 'app_secret',
79
+ :name => 'skubana_app_store',
80
+ :callback_path => '/apps/skubana/install',
81
+ :callback_url => 'https://www.example.com/apps/skubana/install',
82
+ :request_path => ->(_env) { false },
83
+ :app_store_install => true
84
+ ```
85
+
86
+ On that provider, a callback that carries a `cid` and no `state` skips OmniAuth's CSRF
87
+ state check and is exchanged with the `cid` appended. Any other callback is checked as
88
+ usual. Note what accepting installs gives up: anyone can send a signed-in user to that
89
+ URI with a `cid` and `code` of their own, and the user's account gets connected to that
90
+ Skubana account.
91
+
67
92
  ### Client credentials in the token request
68
93
 
69
94
  `client_options[:auth_scheme]` is pinned to `:basic_auth`, because Skubana expects the
@@ -85,20 +110,21 @@ GitHub Actions builds and publishes the gem to [rubygems.org](https://rubygems.o
85
110
  [RubyGems trusted publishing](https://guides.rubygems.org/trusted-publishing/), so no API
86
111
  key is stored in the repo and the gemspec can keep `rubygems_mfa_required`.
87
112
 
88
- 1. Bump `VERSION` in `lib/omniauth-skubana/version.rb` and add a `CHANGELOG.md` section
89
- for it, along with a link definition for the new heading at the bottom of that file.
90
- Commit both on `master`.
113
+ 1. Add a `CHANGELOG.md` section for the new version, along with a link definition for the
114
+ new heading at the bottom of that file, and merge it to `master`. There is no version
115
+ to bump: the committed `VERSION` file is a `0.0.0` placeholder.
91
116
  2. Draft a new release with the target set to `master` and the tag set to the version
92
- prefixed with `v` — `v0.2.0`, not `0.2.0`. The prefix is stripped before comparing
93
- against `version.rb`; the gem version itself carries no `v`.
117
+ prefixed with `v` — `v0.3.0`, not `0.3.0`. The workflow strips the `v` and uses the
118
+ rest as the gem version.
94
119
  3. Click **Generate release notes** — the preferred method — then publish. The generated
95
120
  notes list the merged pull requests; `CHANGELOG.md` carries the curated prose and
96
121
  links back to each release.
97
122
 
98
123
  Publishing creates the tag, which fires the `Release` workflow: it reruns the full test
99
- matrix, refuses to continue if the tag and `version.rb` disagree, and pushes the gem.
100
- Note that RubyGems versions are immutable — a bad release can be yanked, never replaced,
101
- so the version bump has to be committed before the release is published.
124
+ matrix, refuses to continue unless the tag looks like `vX.Y.Z`, writes the version into
125
+ `VERSION` (and `Gemfile.lock`) in its own checkout, and pushes the gem. That change is
126
+ never pushed back to the repo. Note that RubyGems versions are immutable — a bad release
127
+ can be yanked, never replaced, so double-check the tag before publishing.
102
128
 
103
129
  ### One-time RubyGems setup
104
130
 
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.1
@@ -18,15 +18,40 @@ module OmniAuth
18
18
 
19
19
  option :callback_url
20
20
 
21
- option :provider_ignores_state, true
21
+ # Set on a provider registered for App Store installs, with its
22
+ # callback_path at the callback URI registered for the app with Skubana.
23
+ # An install is started by Skubana, not by us: it redirects there with
24
+ # `?cid=...&code=...` and no state to check. Accepting that means anyone
25
+ # can deliver a code of their choosing to a signed-in user's callback, so
26
+ # installs are only handled when the host app sets this.
27
+ option :app_store_install, false
28
+
29
+ def callback_phase
30
+ # Safe to change: OmniAuth dups the options for every request.
31
+ options.provider_ignores_state = true if app_store_install?
32
+ super
33
+ end
22
34
 
23
35
  # OmniAuth::Strategy#callback_url appends the callback request's own query
24
36
  # string, which would send those params to Skubana as part of redirect_uri.
25
37
  # Skubana requires redirect_uri to exactly match the URI registered for the
26
38
  # app. Note that omniauth 2's `callback_path` already carries SCRIPT_NAME,
27
39
  # so mount prefixes must not be added again.
40
+ #
41
+ # An App Store install's code must be exchanged with
42
+ # `redirect_uri=<registered URI>?cid=<cid>`.
28
43
  def callback_url
29
- options[:callback_url] || (full_host + callback_path)
44
+ url = options[:callback_url] || (full_host + callback_path)
45
+ app_store_install? ? "#{url}?cid=#{request.params["cid"]}" : url
46
+ end
47
+
48
+ private
49
+
50
+ def app_store_install?
51
+ return false unless options.app_store_install && @env
52
+
53
+ cid = request.params["cid"]
54
+ cid.is_a?(String) && !cid.empty? && request.params["state"].to_s.empty?
30
55
  end
31
56
  end
32
57
  end
@@ -2,6 +2,8 @@
2
2
 
3
3
  module OmniAuth
4
4
  module Skubana
5
- VERSION = "0.2.0"
5
+ # The release workflow writes VERSION from the release tag; the committed
6
+ # value is a 0.0.0 placeholder.
7
+ VERSION = File.read(File.expand_path("../../VERSION", __dir__)).strip
6
8
  end
7
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-skubana
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Falconer
@@ -53,6 +53,7 @@ files:
53
53
  - CHANGELOG.md
54
54
  - LICENSE.txt
55
55
  - README.md
56
+ - VERSION
56
57
  - lib/omniauth-skubana.rb
57
58
  - lib/omniauth-skubana/version.rb
58
59
  - lib/omniauth/strategies/skubana.rb