The Wire · Showcase
GO FIXES QUADRATIC URL PARSING BUG, TIGHTENS XML RECURSION DEPTH
By RepoJournal · Filed · About Go
The core library shipped two security-relevant fixes overnight that eliminate algorithmic vulnerabilities in URL resolution and XML decoding that could be exploited to cause denial of service.
A critical performance regression in net/url.resolvePath is now fixed [1]. The function was calling dst.String() and dst.WriteString() inside a loop on deep paths, causing quadratic complexity. The fix switches to index-based backtracking on a byte slice, delivering 23.65% faster simple path resolution and significantly steeper wins on deep paths. In parallel, encoding/xml.Decoder.unmarshal now properly enforces recursion depth limits [2]. Previously, the DecodeElement method bypassed the guard by hardcoding depth to 0, allowing malicious XML documents to bypass depth tracking through custom UnmarshalXML implementations. The fix maintains depth as a stack value adjusted when elements push and pop, eliminating the bypass vector entirely. On the developer tooling front, gopls picked up assembly file support with DocumentHighlight for label scoping [5], while the build team automated stale watchflakes cleanup to keep issue trackers fresh [4]. The http2 implementation also cut memory overhead by building HPACK table lookup maps lazily only for encoders, not decoders [3], a meaningful optimization for servers with idle connections.
One email a day. Unsubscribe in one click.
Keep up with Go in about 3 minutes a day: what actually shipped — the commits, pull requests, releases, and security advisories that matter.
One email a day. Unsubscribe in one click. Read a past issue →
Action items
- → Pull latest golang/go - URL and XML fixes address DoS vectors in production code paths golang/go [immediate]
- → Review any custom UnmarshalXML implementations for depth assumptions and redeploy golang/go [plan]
- → Update gopls to get assembly DocumentHighlight and label scoping improvements golang/tools [monitor]
References
- [1] net/url: avoid quadratic complexity in resolvePath golang/go
- [2] encoding/xml: fix depth processing in (*Decoder).unmarshal golang/go
- [3] http2/hpack: build the table lookup maps lazily, only for encoders golang/net
- [4] cmd/gopherbot: add task to close stale watchflakes issues golang/build
- [5] gopls: add assembly DocumentHighlight, fix label scoping golang/tools