Skip to content

core-service panic when key refresh is impossible #1632

Description

@the-glu

Describe the bug
The core-service panics (and therefore shuts down the service) when it is unable to refresh keys on the jwks_endpoint.

To Reproduce
Start the core-service with a jwks_endpoint. Prevent the DSS from accessing this endpoint (e.g. shut down the server).

Monitoring: disabled
Debug Mode: off
2026-08-12T14:16:13.656Z        info    core-service/main.go:255        version {"address": ":8082", "version": "0.0.0+3b904b48-dirty"}
2026-08-12T14:16:13.656Z        info    core-service/main.go:256        build   {"address": ":8082", "description": {"Time":"2026-08-07.16:21:39","Commit":"3b904b48-dirty","Host":"buildkitsandbox"}}
2026-08-12T14:16:13.656Z        info    core-service/main.go:257        config  {"address": ":8082", "scd": true}
2026-08-12T14:16:13.656Z        info    core-service/main.go:259        config  {"address": ":8082", "scdGlobalLock": false}
2026-08-12T14:16:13.656Z        info    core-service/main.go:260        config  {"address": ":8082", "scdHashLock": false}
2026-08-12T14:16:13.656Z        info    core-service/main.go:261        config  {"address": ":8082", "timeBasedNotificationIndex": false}
2026-08-12T14:16:13.787Z        info    core-service/main.go:409        Starting DSS HTTP server        {"address": ":8082"}
2026-08-12T14:16:18.679Z        info    logging/http.go:109     GET /healthy HTTP/1.1   {"address": ":8082", "req_dump": "", "resp_dump": "ok", "req_headers": {"Accept":["*/*"],"Connection":["close"],"User-Agent":["Wget"]}, "resp_status_code": 200, "resp_status_text": "OK", "peer_address": "[::1]:44456", "start_time": "2026-08-12T14:16:18.679Z", "duration_ms": 0.1}

(http://172.17.0.1:8000/oauth2/jwks.json on my machine service a key set stopped)

2026-08-12T14:16:33.779Z        panic   auth/auth.go:161        failed to refresh key   {"error": "Error retrieving JWKS at http://172.17.0.1:8000/oauth2/jwks.json\n --- at /app/pkg/auth/auth.go:94 (JWKSResolver.ResolveKeys) ---\nCaused by: Get \"http://172.17.0.1:8000/oauth2/jwks.json\": dial tcp 172.17.0.1:8000: connect: connection refused"}
github.com/interuss/dss/pkg/auth.NewRSAAuthorizer.func1
        /app/pkg/auth/auth.go:161
panic: failed to refresh key

goroutine 117 [running]:
go.uber.org/zap/zapcore.CheckWriteAction.OnWrite(0x1?, 0x1?, {0x0?, 0x0?, 0x29448e524220?})
        /go/pkg/mod/go.uber.org/zap@v1.27.0/zapcore/entry.go:196 +0x54
go.uber.org/zap/zapcore.(*CheckedEntry).Write(0x29448e24e1a0, {0x29448e246400, 0x1, 0x1})
        /go/pkg/mod/go.uber.org/zap@v1.27.0/zapcore/entry.go:262 +0x26e
go.uber.org/zap.(*Logger).Panic(0x29448deda4e0?, {0x141dd50?, 0x29448df16500?}, {0x29448e246400, 0x1, 0x1})
        /go/pkg/mod/go.uber.org/zap@v1.27.0/logger.go:285 +0x4b
github.com/interuss/dss/pkg/auth.NewRSAAuthorizer.func1()
        /app/pkg/auth/auth.go:161 +0x2b5
created by github.com/interuss/dss/pkg/auth.NewRSAAuthorizer in goroutine 1
        /app/pkg/auth/auth.go:152 +0x245

Expected behavior
I would expect the DSS to cache the keys at least for a while. A number of retries / a delay could be used to still prevent usage of outdated keys, but a single request failure should probably not stop the DSS server.

Metadata

Metadata

Assignees

Labels

P2Normal prioritybugSoftware behaves incorrectly because of this issue

Type

No type

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions