Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Bound the OIDC JOSE security graph without changing storage dependencies

pulse-triage[bot]b5d3e5b5b07e
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index 22cefdc2e6..443f3b1d5c 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -15,6 +15,24 @@
```
## Purpose
+
+### OIDC JOSE security graph (28 October 2026)
+
+The root graph advances only go-jose/v4 from 4.1.4 to 4.1.6 for the reachable
+OIDC JWK/token parsing fixes, including GHSA-mgcc-cww5-fp2q. It becomes a direct
+requirement because the new repository-owned JWK regression imports it. The
+three unrelated direct/indirect reclassifications in the managed proposal are
+not imported. Exact module and go.mod checksum pairs are added without pruning
+old records. The compiler, go-oidc, SQLite/libc, all other versions and all
+install/update/deployment interfaces remain unchanged.
+
+`scripts/tests/test-hot-dev-runtime.sh` rejects a downgrade below 4.1.6; the
+normal API suite owns the real consumer and bounded-key controls documented in
+security-privacy. Exact committed-graph acquisition, a fresh matching worker,
+read-only resolution/module verification and a genuine embedded server build
+are still required. A manifest edit, static floor or acquisition receipt is not
+runtime compatibility, installed login recovery or a shipped security fix.
+
### Mechanical stable patch source admission
Stable-regression patches are the sole main-only release exception. The release
diff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.md
index 12a1ae67b5..e217673167 100644
--- a/docs/release-control/v6/internal/subsystems/security-privacy.md
+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md
@@ -18,6 +18,28 @@
## Purpose
+### OIDC retains the bounded JOSE key and token verifier
+
+OIDC discovery, remote JWKS and signed ID tokens use go-oidc's real verifier
+with go-jose/v4 at least 4.1.6. The upstream default RSA JWK modulus ceiling is
+4096 bits; Pulse must not raise its process-global limit to accept larger
+provider keys. Supported RSA 2048/4096, P256/ES256 and Ed25519/EdDSA keys remain
+usable. A larger provider key requires rotation to a supported key, not a
+signature, issuer, audience, expiry or TLS-verification bypass. The ceiling
+also applies while decoding a key set: a mixed JWKS is not automatically usable
+merely because one of its keys is within range.
+
+`TestOIDCJOSEJWKModulusBound` checks the exact default, both supported sizes and
+the first out-of-range size without performing expensive oversized-key crypto.
+`TestOIDCServiceJOSECompatibilityAndRejection` uses Pulse's actual discovery and
+remote-key consumer with independently stdlib-signed tokens. It preserves key
+IDs/subjects containing spaces and rejects invalid signatures, unsigned
+algorithms, wrong issuers/audiences, expired tokens and P256/ES384 confusion.
+Existing mixed unsupported-key and custom-CA/cross-origin controls still apply.
+No verifier skip or library-limit override is introduced. These are source
+obligations, not evidence of installed sign-in or publication.
+
+
### Audit CSV is a spreadsheet projection, not rewritten evidence
The canonical audit exporter prefixes dangerous text cells with one apostrophe
diff --git a/go.mod b/go.mod
index 93b03b0874..2d9698a197 100644
--- a/go.mod
+++ b/go.mod
@@ -10,6 +10,7 @@ require (
github.com/coreos/go-oidc/v3 v3.21.0
github.com/crewjam/saml v0.5.1
github.com/fsnotify/fsnotify v1.10.1
+ github.com/go-jose/go-jose/v4 v4.1.6
github.com/go-pdf/fpdf v0.9.0
github.com/golang-jwt/jwt/v5 v5.3.1
github.com/google/uuid v1.6.0
@@ -56,7 +57,6 @@ require (
github.com/emicklei/go-restful/v3 v3.13.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fxamacker/cbor/v2 v2.9.1 // indirect
- github.com/go-jose/go-jose/v4 v4.1.4 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
diff --git a/go.sum b/go.sum
index 8b5d01c293..7f71cd3196 100644
--- a/go.sum
+++ b/go.sum
@@ -50,6 +50,8 @@ github.com/fxamacker/cbor/v2 v2.9.1 h1:2rWm8B193Ll4VdjsJY28jxs70IdDsHRWgQYAI80+r
github.com/fxamacker/cbor/v2 v2.9.1/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA=
github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
+github.com/go-jose/go-jose/v4 v4.1.6 h1:sNRkftxFJxwsILiQukqp5z83QBSmntVwmgRY7AqBDO4=
+github.com/go-jose/go-jose/v4 v4.1.6/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
diff --git a/internal/api/oidc_jose_security_test.go b/internal/api/oidc_jose_security_test.go
new file mode 100644
index 0000000000..56236f6147
--- /dev/null
+++ b/internal/api/oidc_jose_security_test.go
@@ -0,0 +1,203 @@
+package api
+
+import (
+ "crypto"
+ "crypto/ecdsa"
+ "crypto/ed25519"
+ "crypto/elliptic"
+ "crypto/rand"
+ "crypto/rsa"
+ "crypto/sha256"
+ "crypto/sha512"
+ "encoding/base64"
+ "encoding/json"
+ "fmt"
+ "math/big"
+ "net/http"
+ "testing"
+ "time"
+
+ jose "github.com/go-jose/go-jose/v4"
+ "github.com/rcourtman/pulse-go-rewrite/internal/config"
+)
+
+// Keep the upstream resource bound, rather than raising a process-global limit
+// to make an IdP compatible. The boundary is exercised without generating an
+// oversized private key or doing an expensive RSA verification.
+func TestOIDCJOSEJWKModulusBound(t *testing.T) {
+ if jose.MaxRSAModulusBits != 4096 {
+ t.Fatalf("RSA JWK modulus limit = %d, want upstream default 4096", jose.MaxRSAModulusBits)
+ }
+ for _, bits := range []int{2048, 4096, 4097, 8192} {
+ t.Run(fmt.Sprint(bits), func(t *testing.T) {
+ n := new(big.Int).Lsh(big.NewInt(1), uint(bits-1))
+ n.Add(n, big.NewInt(1))
+ body, err := json.Marshal(map[string]string{
+ "kty": "RSA", "e": "AQAB", "kid": "bounded", "use": "sig",
+ "n": base64.RawURLEncoding.EncodeToString(n.Bytes()),
+ })
+ if err != nil {
+ t.Fatal(err)
+ }
+ var key jose.JSONWebKey
+ err = json.Unmarshal(body, &key)
+ if bits > 4096 {
+ if err == nil {
+ t.Fatalf("parsed out-of-range %d-bit RSA JWK", bits)
+ }
+ return
+ }
+ if err != nil {
+ t.Fatalf("parse supported %d-bit RSA JWK: %v", bits, err)
+ }
+ pub, ok := key.Key.(*rsa.PublicKey)
+ if !ok || pub.N.BitLen() != bits {
+ t.Fatalf("supported JWK changed: %T %+v", key.Key, key)
+ }
+ })
+ }
+}
+
+// Exercise Pulse's real discovery and remote-JWKS consumer, not just jose's API.
+// No verifier skips, algorithm overrides or global library settings are used.
+func TestOIDCServiceJOSECompatibilityAndRejection(t *testing.T) {
+ rsa2048, err := rsa.GenerateKey(rand.Reader, 2048)
+ if err != nil {
+ t.Fatal(err)
+ }
+ rsa4096, err := rsa.GenerateKey(rand.Reader, 4096)
+ if err != nil {
+ t.Fatal(err)
+ }
+ ec, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
+ if err != nil {
+ t.Fatal(err)
+ }
+ _, ed, err := ed25519.GenerateKey(rand.Reader)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ for _, tc := range []struct {
+ name string
+ key crypto.Signer
+ alg string
+ mutate func(map[string]any)
+ badSig bool
+ wantReject bool
+ }{
+ {name: "RSA2048", key: rsa2048, alg: "RS256"},
+ {name: "RSA4096", key: rsa4096, alg: "RS256"},
+ {name: "P256", key: ec, alg: "ES256"},
+ {name: "Ed25519", key: ed, alg: "EdDSA"},
+ {name: "bad signature", key: rsa2048, alg: "RS256", badSig: true, wantReject: true},
+ {name: "unsigned algorithm", key: rsa2048, alg: "none", wantReject: true},
+ {name: "wrong issuer", key: rsa2048, alg: "RS256", mutate: func(c map[string]any) { c["iss"] = "https://other.invalid" }, wantReject: true},
+ {name: "wrong audience", key: rsa2048, alg: "RS256", mutate: func(c map[string]any) { c["aud"] = "another-client" }, wantReject: true},
+ {name: "expired", key: rsa2048, alg: "RS256", mutate: func(c map[string]any) { c["exp"] = time.Now().Add(-time.Hour).Unix() }, wantReject: true},
+ {name: "P256 cannot use ES384", key: ec, alg: "ES384", wantReject: true},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ const kid = "provider key with spaces"
+ jwk := jose.JSONWebKey{Key: tc.key.Public(), KeyID: kid, Use: "sig"}
+ jwks, err := json.Marshal(jose.JSONWebKeySet{Keys: []jose.JSONWebKey{jwk}})
+ if err != nil {
+ t.Fatal(err)
+ }
+ server := newIPv4HTTPServer(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+ switch r.URL.Path {
+ case "/.well-known/openid-configuration":
+ base := "http://" + r.Host
+ _ = json.NewEncoder(w).Encode(map[string]any{
+ "issuer": base, "authorization_endpoint": base + "/authorize",
+ "token_endpoint": base + "/token", "jwks_uri": base + "/jwks",
+ "id_token_signing_alg_values_supported": []string{"RS256", "ES256", "ES384", "EdDSA"},
+ })
+ case "/jwks":
+ _, _ = w.Write(jwks)
+ default:
+ http.NotFound(w, r)
+ }
+ }))
+ defer server.Close()
+ service, err := NewOIDCService(t.Context(), &config.OIDCConfig{
+ Enabled: true, IssuerURL: server.URL, ClientID: "pulse-client",
+ RedirectURL: "http://pulse.invalid/api/oidc/callback", Scopes: []string{"openid"},
+ })
+ if err != nil {
+ t.Fatalf("initialize Pulse OIDC: %v", err)
+ }
+ defer service.Stop()
+ claims := map[string]any{
+ "iss": server.URL, "aud": "pulse-client", "sub": "pulse user",
+ "iat": time.Now().Add(-time.Minute).Unix(), "exp": time.Now().Add(time.Hour).Unix(),
+ }
+ if tc.mutate != nil {
+ tc.mutate(claims)
+ }
+ token := signOIDCJOSEFixture(t, tc.key, tc.alg, kid, claims, tc.badSig)
+ verified, err := service.verifier.Verify(t.Context(), token)
+ if tc.wantReject {
+ if err == nil {
+ t.Fatalf("OIDC accepted %s", tc.name)
+ }
+ return
+ }
+ if err != nil {
+ t.Fatalf("verify supported provider token: %v", err)
+ }
+ if verified.Subject != "pulse user" {
+ t.Fatalf("token parser rewrote subject: %q", verified.Subject)
+ }
+ })
+ }
+}
+
+// Stdlib signing is independent of the upgraded library under test. In the
+// curve-mismatch case the signature is mathematically valid on P256/SHA384;
+// JOSE must still reject that key/algorithm combination.
+func signOIDCJOSEFixture(t *testing.T, key crypto.Signer, alg, kid string, claims map[string]any, badSig bool) string {
+ t.Helper()
+ header, err := json.Marshal(map[string]string{"alg": alg, "kid": kid})
+ if err != nil {
+ t.Fatal(err)
+ }
+ payload, err := json.Marshal(claims)
+ if err != nil {
+ t.Fatal(err)
+ }
+ enc := base64.RawURLEncoding.EncodeToString
+ input := enc(header) + "." + enc(payload)
+ digest := sha256.Sum256([]byte(input))
+ var signature []byte
+ switch k := key.(type) {
+ case *rsa.PrivateKey:
+ signature, err = rsa.SignPKCS1v15(rand.Reader, k, crypto.SHA256, digest[:])
+ case *ecdsa.PrivateKey:
+ hash := digest[:]
+ if alg == "ES384" {
+ sum := sha512.Sum384([]byte(input))
+ hash = sum[:]
+ }
+ var r, s *big.Int
+ r, s, err = ecdsa.Sign(rand.Reader, k, hash)
+ if err == nil {
+ n := (k.Curve.Params().BitSize + 7) / 8
+ signature = make([]byte, 2*n)
+ r.FillBytes(signature[:n])
+ s.FillBytes(signature[n:])
+ }
+ case ed25519.PrivateKey:
+ signature = ed25519.Sign(k, []byte(input))
+ default:
+ t.Fatalf("unsupported fixture signer %T", key)
+ }
+ if err != nil {
+ t.Fatalf("sign fixture: %v", err)
+ }
+ if badSig {
+ signature[0] ^= 1
+ }
+ return input + "." + enc(signature)
+}
diff --git a/scripts/tests/test-hot-dev-runtime.sh b/scripts/tests/test-hot-dev-runtime.sh
index 028566e6a2..5837d44be7 100755
--- a/scripts/tests/test-hot-dev-runtime.sh
+++ b/scripts/tests/test-hot-dev-runtime.sh
@@ -352,12 +352,13 @@ assert_module_at_least() {
test_go_module_security_dependency_floors() {
local output
- output="$(cd "${ROOT_DIR}" && go list -m golang.org/x/net golang.org/x/crypto golang.org/x/term golang.org/x/sys)"
+ output="$(cd "${ROOT_DIR}" && go list -m golang.org/x/net golang.org/x/crypto golang.org/x/term golang.org/x/sys github.com/go-jose/go-jose/v4)"
assert_module_at_least "Go module floor keeps x/net past restricted-outbound advisories" "${output}" "golang.org/x/net" "v0.56.0"
assert_module_at_least "Go module floor excludes SSH connection deadlock advisories" "${output}" "golang.org/x/crypto" "v0.57.0"
assert_module_at_least "Go module floor keeps x/term past the read-error handling release" "${output}" "golang.org/x/term" "v0.46.0"
assert_module_at_least "Go module floor keeps x/sys aligned with security module graph" "${output}" "golang.org/x/sys" "v0.47.0"
+ assert_module_at_least "OIDC JOSE floor keeps bounded RSA JWK parsing and signature verification fixes" "${output}" "github.com/go-jose/go-jose/v4" "v4.1.6"
}
# The metrics and alerting stores run on the pure-Go SQLite driver, so a