Take control over your live stream video by running it yourself. Streaming + chat out of the box.
HTML activitypubbroadcastingchatdecentralizedfederationfediversegolanghacktoberfesthlslivelivestreamowncastrtmpself-hostedstreaming-videovideo
fix(auth): keep logo endpoints public
Gabe Kangasf184af7a1c84
diff --git a/pluginhost/authgate.go b/pluginhost/authgate.goindex 3ede896ccf..7d897b36f5 100644--- a/pluginhost/authgate.go+++ b/pluginhost/authgate.go@@ -59,6 +59,7 @@ type gateExemption struct {var gateExemptions = []gateExemption{{"admin", exemptAdminRoutes},{"static-assets", exemptStaticAssets},+ {"logo", exemptLogoRoutes},{"active-gate-plugin", exemptActiveGatePluginRoutes},{"external-api", exemptExternalAPIRoutes},{"directory-api", exemptDirectoryAPI},@@ -95,6 +96,13 @@ func exemptStaticAssets(r *http.Request, _ string, _ AuthGateSettings) bool {return err == nil && !info.IsDir()}+// exemptLogoRoutes keeps the instance's own logo publicly reachable. It is+// referenced by the viewer shell and federation metadata, and does not expose+// any viewer or stream content.+func exemptLogoRoutes(r *http.Request, _ string, _ AuthGateSettings) bool {+ return r.URL.Path == "/logo" || r.URL.Path == "/logo/external"+}+// exemptAdminRoutes: the admin surfaces carry their own credential (Basic auth// or the admin session cookie) and have their own RequireAdminAuth gate, so// they are never behind the viewer gate — an operator can always reach thediff --git a/pluginhost/authgate_test.go b/pluginhost/authgate_test.goindex 2791c84d4c..b4160ed37f 100644--- a/pluginhost/authgate_test.go+++ b/pluginhost/authgate_test.go@@ -73,6 +73,8 @@ func TestGateExemptions(t *testing.T) {{"admin API is exempt (cookie-authed, no Authorization header)", req("/api/admin/status", ""), "g", "admin"},{"admin API subpath", req("/api/admin/plugins/x/enable", ""), "g", "admin"},{"public api/config is still gated", req("/api/config", ""), "g", ""},+ {"logo is exempt", req("/logo", ""), "g", "logo"},+ {"external logo is exempt", req("/logo/external", ""), "g", "logo"},{"active gate plugin root", req("/plugins/g", ""), "g", "active-gate-plugin"},{"active gate plugin subpath", req("/plugins/g/callback", ""), "g", "active-gate-plugin"},{"a different plugin is NOT exempt", req("/plugins/other/x", ""), "g", ""},@@ -123,6 +125,8 @@ func TestAuthGateAccessPolicyMatrix(t *testing.T) {{"website-only", websiteOnly, "/api/config", gateLogin},{"website-only", websiteOnly, "/hls/stream.m3u8", gateAllow},{"website-only", websiteOnly, "/hls/0/stream0.ts", gateAllow},+ {"website-only", websiteOnly, "/logo", gateAllow},+ {"website-only", websiteOnly, "/logo/external", gateAllow},{"website-only", websiteOnly, "/api/status", gateAllow},{"website-only", websiteOnly, "/api/yp", gateAllow},@@ -131,6 +135,8 @@ func TestAuthGateAccessPolicyMatrix(t *testing.T) {{"website-and-stream", websiteAndStream, "/hls/0/stream0.ts", gateLogin},{"website-and-stream", websiteAndStream, "/api/status", gateAllow},{"website-and-stream", websiteAndStream, "/api/yp", gateAllow},+ {"website-and-stream", websiteAndStream, "/logo", gateAllow},+ {"website-and-stream", websiteAndStream, "/logo/external", gateAllow},{"website-and-stream", websiteAndStream, "/", gateLogin},// The final mode adds stream status. The directory endpoint stays past@@ -138,6 +144,8 @@ func TestAuthGateAccessPolicyMatrix(t *testing.T) {{"website-stream-and-status", websiteStreamAndStatus, "/hls/0/stream0.ts", gateLogin},{"website-stream-and-status", websiteStreamAndStatus, "/api/status", gateLogin},{"website-stream-and-status", websiteStreamAndStatus, "/api/yp", gateAllow},+ {"website-stream-and-status", websiteStreamAndStatus, "/logo", gateAllow},+ {"website-stream-and-status", websiteStreamAndStatus, "/logo/external", gateAllow},// No mode may ever re-gate the recovery or self-credentialed surfaces.{"website-stream-and-status", websiteStreamAndStatus, "/admin", gateAllow},