• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

go-pkgz / auth / 26194755659
85%
master: 85%

Build:
Build:
LAST BUILD BRANCH: refs/tags/v2.1.6
DEFAULT BRANCH: master
Ran 20 May 2026 11:09PM UTC
Jobs 1
Files 25
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

20 May 2026 10:52PM UTC coverage: 85.384% (+0.06%) from 85.323%
26194755659

Pull #290

github

paskal
refactor(avatar): collapse load/resize double-buffering

Before this change a remote avatar was buffered twice: once inside load() to
enforce maxAvatarFetchSize before returning an io.ReadCloser, and again inside
resize() when it called io.ReadAll on that reader to feed image.DecodeConfig.
For a 10 MiB upstream avatar each in-flight login held ~20 MiB peak instead of
~10 MiB. Bounded, but wasteful under concurrent login pressure.

Collapse the duplication by moving the size cap to the trust boundary and
flowing bytes straight through:

  * load() now returns ([]byte, error). No Reader wrapping, no Close needed
    at the caller, no second ReadAll downstream.
  * resize() takes ([]byte, int) instead of (io.Reader, int). It works on the
    same bytes load() already validated against the cap, with a defensive
    len(body) == 0 || > cap check for callers that bypass load (identicon,
    PutContent).
  * PutContent() now runs io.ReadAll(io.LimitReader(content, cap+1)) at the
    public API boundary so the cap is visible to callers reading the code.
    The total work is the same — resize used to do this internally — but
    the size enforcement is now explicit at the trust boundary.
  * Put()'s deferred body.Close() block is gone since load returns bytes.
  * The identicon path drops bytes.NewBuffer(b) wrapping and passes b directly.

No public API change, no behavior change other than halved peak memory per
concurrent login. All existing tests pass on both v1 and v2 unchanged in
intent — only the test inputs were simplified to pass []byte directly to
resize instead of wrapping in strings.NewReader / bytes.NewReader.
Pull Request #290: fix(avatar): prevent stored XSS via content-type spoofing

85 of 93 new or added lines in 2 files covered. (91.4%)

3 existing lines in 1 file now uncovered.

3032 of 3551 relevant lines covered (85.38%)

8.28 hits per line

Uncovered Changes

Lines Coverage ∆ File
8
81.7
1.49% v2/avatar/avatar.go

Coverage Regressions

Lines Coverage ∆ File
3
81.7
1.49% v2/avatar/avatar.go
Jobs
ID Job ID Ran Files Coverage
1 26194755659.1 20 May 2026 11:09PM UTC 25
85.38
GitHub Action Run
Source Files on build 26194755659
  • Tree
  • List 25
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Pull Request #290
  • PR Base - master (#25620289937)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc