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

cenkalti / rain / 37147560904
51%

Build:
DEFAULT BRANCH: master
Ran 03 Oct 2026 07:21PM UTC
Jobs 1
Files 169
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

03 Oct 2026 07:14PM UTC coverage: 50.889% (+0.02%) from 50.866%
37147560904

push

github

cenkalti
metainfo: defuse torrent names used as paths

A torrent name reaches the filesystem in three places, unsanitized.
CleanName replaced separators but left a bare ".." alone, and filepath
reads that as navigation rather than as a file name.

Write side, reachable with the default config: a torrent named ".." got
Files[0].Path of "../a.txt", so its data landed one level above its own
directory -- in the shared data dir by default, and outside the data dir
when data-dir-includes-torrent-id is off.

Delete side: Session.stopAndRemoveData joined the raw name onto DataDir
and called os.RemoveAll. With the name ".." that is RemoveAll on the
parent of the data dir, which takes the data dir and everything beside
it. Reaching it needs data-dir-includes-torrent-id off, which is not the
default, plus a remove with keepData false.

Three changes:

  - CleanName now renames "." and ".." to "_" and "__". After separator
    replacement those are the only values left that can move a path. A
    name that merely contains dots, or is padded like " .. ", is an
    ordinary file name and is untouched.
  - stopAndRemoveData cleans the name, which is also what the data was
    written under, so removal stops missing the real directory whenever
    the raw and cleaned names differ.
  - removeDataDir refuses any destination that is not inside DataDir, so
    a recursive delete driven by a torrent-supplied name has a guard
    that does not depend on the cleaning being exhaustive.

Info.Name stays verbatim for display and the RPC surface; only paths
built from it are cleaned. The resume database filename in the download
command is cleaned too.

Each guard was verified to be load-bearing by disabling it and watching
the tests fail.

26 of 34 new or added lines in 3 files covered. (76.47%)

8 existing lines in 4 files now uncovered.

6127 of 12040 relevant lines covered (50.89%)

121.33 hits per line

Uncovered Changes

Lines Coverage ∆ File
6
56.69
1.3% torrent/session.go
2
0.0
0.0% internal/command/download.go

Coverage Regressions

Lines Coverage ∆ File
2
93.19
0.0% internal/peerconn/peerreader/peerreader.go
2
53.92
-1.96% torrent/torrent_commands.go
2
78.18
-3.64% torrent/torrent_run.go
2
51.19
-1.19% torrent/torrent_stats.go
Jobs
ID Job ID Ran Files Coverage
1 37147560904.1 03 Oct 2026 07:21PM UTC 169
50.89
GitHub Action Run
Source Files on build 37147560904
  • Tree
  • List 169
  • Changed 7
  • Source Changed 0
  • Coverage Changed 7
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 75928970 on github
  • Prev Build on master (#37146811107)
  • Next Build on master (#37147571188)
  • Delete
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