fix(logging): bump sirupsen/logrus to v1.10.0, fix nil-Stringer crash it exposes - #4456
Closed
reinkrul wants to merge 3 commits into
Closed
fix(logging): bump sirupsen/logrus to v1.10.0, fix nil-Stringer crash it exposes#4456reinkrul wants to merge 3 commits into
reinkrul wants to merge 3 commits into
Conversation
… it exposes v1.10.0's rewritten TextFormatter.appendValue calls fmt.Stringer.String() directly instead of going through fmt.Sprint (which used to recover panics from it). Several places log a VC/VP's *ssi.URI ID via WithField, which is nil whenever the credential/presentation has no id (optional per the VC/VP data model). URI.String() has a value receiver, so calling it through a nil *URI panics on dereference: under v1.9.4 that produced a garbled log line, under v1.10.0 it crashes the process. Adds core.SafeStringer[T comparable & fmt.Stringer], a small generic helper that returns nil for a nil pointer (logged as "<nil>") instead of the value, so WithField never calls String() on one. Comparability lets it check for nil without reflection. Applied at every call site found logging a VC/VP ID this way: vcr/holder/openid.go, vcr/holder/sql_wallet.go, vcr/issuer/network_publisher.go, vcr/issuer/openid.go, vcr/search.go, vcr/store.go, vcr/revocation/statuslist2021_verifier.go, didman/didman.go, discovery/client.go. Confirmed by two tests that previously panicked under v1.10.0: Test_wallet_HandleCredentialOffer and Test_networkPublisher_PublishCredential.
reinkrul
requested review from
Dirklectisch,
JorisHeadease,
gerardsn,
stevenvegt and
woutslakhorst
as code owners
August 19, 2026 08:46
Contributor
1 new issue
|
Not a fix for an existing bug: the crash only exists because of the logrus v1.10.0 bump this same PR makes, so there's nothing here for a release-note reader to act on.
Contributor
|
Coverage Impact This PR will not change total coverage. Modified Files with Diff Coverage (10)
🛟 Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What
Bumps
github.com/sirupsen/logrusv1.9.4 → v1.10.0 (held back from #4454 pending this fix) and fixes a crash it exposes.Why
v1.10.0's rewritten
TextFormatter.appendValuecallsfmt.Stringer.String()directly instead of going throughfmt.Sprint(which used to recover panics from it). Several places log a VC/VP's*ssi.URIID viaWithField, and that ID is nil whenever the credential/presentation has noid— optional per the VC/VP data model.URI.String()has a value receiver, so calling it through a nil*URIpanics on dereference. Under v1.9.4 that produced a garbled log line; under v1.10.0 it crashes the process.Confirmed by two tests that panicked under v1.10.0 alone:
Test_wallet_HandleCredentialOfferandTest_networkPublisher_PublishCredential.How
Adds
core.SafeStringer[T comparable & fmt.Stringer], a small generic helper that returnsnilfor a nil pointer (which logs as"<nil>") instead of the value, soWithFieldnever callsString()on one. ConstrainingTtocomparable(true for any pointer type) lets it check for nil with a plain==comparison against the zero value — no reflection needed.Applied at every call site found logging a VC/VP ID this way:
vcr/holder/openid.go,vcr/holder/sql_wallet.govcr/issuer/network_publisher.go,vcr/issuer/openid.govcr/search.go,vcr/store.govcr/revocation/statuslist2021_verifier.godidman/didman.godiscovery/client.goOut of scope
A few other spots (
vcr/issuer/issuer.go) call.String()directly on a VC ID rather than passing the pointer toWithField. Those would already panic on a nil ID today, independent of this logrus bump (not a new regression), so left untouched here to keep this PR to the fix at hand.