runlight 0.5.1 → 0.5.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 +4 -4
- data/assets/build.json +3 -3
- data/assets/dashboard.js +10 -10
- data/assets/locales.json +5 -5
- data/lib/runlight/oauth.rb +9 -4
- data/lib/runlight/routes.rb +1 -1
- data/lib/runlight/version.rb +1 -1
- metadata +2 -2
data/lib/runlight/oauth.rb
CHANGED
|
@@ -34,6 +34,9 @@ module Runlight
|
|
|
34
34
|
# The longest client id, which carries the app's name and redirect addresses.
|
|
35
35
|
MAX_CLIENT_ID = 2048
|
|
36
36
|
SCOPES = %w[read manage cms].freeze
|
|
37
|
+
# The scope the MCP endpoint offers. An MCP client asks for every scope it is offered, so it is offered
|
|
38
|
+
# only read: manage and cms are for a hub and the CMS plugins, which ask for them by name.
|
|
39
|
+
MCP_SCOPE = "read"
|
|
37
40
|
# The most an OAuth request's body may be: a registration, a consent form, or a code swap is far smaller.
|
|
38
41
|
MAX_BODY_BYTES = 64 * 1024
|
|
39
42
|
|
|
@@ -110,7 +113,7 @@ module Runlight
|
|
|
110
113
|
end
|
|
111
114
|
|
|
112
115
|
if known.start_with?("/.well-known/oauth-protected-resource")
|
|
113
|
-
return json({ "resource" => "#{issuer}/mcp", "authorization_servers" => [issuer], "scopes_supported" =>
|
|
116
|
+
return json({ "resource" => "#{issuer}/mcp", "authorization_servers" => [issuer], "scopes_supported" => [MCP_SCOPE], "bearer_methods_supported" => ["header"] })
|
|
114
117
|
end
|
|
115
118
|
if known.start_with?("/.well-known/oauth-authorization-server") || known.start_with?("/.well-known/openid-configuration")
|
|
116
119
|
return json({
|
|
@@ -187,9 +190,11 @@ module Runlight
|
|
|
187
190
|
return refuse.call({ "error" => "invalid_request", "error_description" => "PKCE with S256 is required" })
|
|
188
191
|
end
|
|
189
192
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
+
# A hub asks for manage and a CMS plugin for cms, each on its own. An app asking for more than one
|
|
194
|
+
# is a generic client asking for everything it was offered, and gets read, the least of them.
|
|
195
|
+
scopes = (form.get("scope") || "").split(/[#{Js::SPACE}]+/o).select { |s| SCOPES.include?(s) }.uniq
|
|
196
|
+
cms = scopes == ["cms"]
|
|
197
|
+
manage = scopes == ["manage"]
|
|
193
198
|
name = client["name"].to_s
|
|
194
199
|
# A CMS plugin is for the site it runs on: one of the sites counting its admin's domain, or a new one for it.
|
|
195
200
|
host = site_host(redirect)
|
data/lib/runlight/routes.rb
CHANGED
|
@@ -2703,7 +2703,7 @@ module Runlight
|
|
|
2703
2703
|
if access == false || access == "unconfigured"
|
|
2704
2704
|
refused = denied(access)
|
|
2705
2705
|
# Points an OAuth client at the metadata that starts the sign-in.
|
|
2706
|
-
refused.headers.set("www-authenticate", "Bearer realm=\"runlight\", resource_metadata=\"#{OAuth.resource_metadata_url(url.origin, base)}\"")
|
|
2706
|
+
refused.headers.set("www-authenticate", "Bearer realm=\"runlight\", resource_metadata=\"#{OAuth.resource_metadata_url(url.origin, base)}\", scope=\"#{OAuth::MCP_SCOPE}\"")
|
|
2707
2707
|
return refused
|
|
2708
2708
|
end
|
|
2709
2709
|
# Each tool reads the HTTP API with the caller's own headers, so it sees what they may.
|
data/lib/runlight/version.rb
CHANGED
|
@@ -4,7 +4,7 @@ require "json"
|
|
|
4
4
|
|
|
5
5
|
module Runlight
|
|
6
6
|
# The gem's own version, which the release keeps equal to the npm package's.
|
|
7
|
-
GEM_VERSION = "0.5.
|
|
7
|
+
GEM_VERSION = "0.5.3"
|
|
8
8
|
|
|
9
9
|
# The SDK's version and the HTTP API's, read from assets/build.json, which
|
|
10
10
|
# scripts/ruby-assets.mts writes from the TypeScript SDK, so the two always
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runlight
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jon C. Phillips
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|