Network access by Debian package builds
The Debian project is known for strictly adhering to its various internal rules and guidelines; a package that some developers feel is in violation of the Debian Free Software Guidelines, for example, is sure to spawn considerable debate, regardless of its popularity or its origin. Recently, a Debian package maintainer realized that a particular package violated a guideline prohibiting network access during the build process, thus sparking a discussion about that guideline and what its ultimate purpose is.
On September 7, Vincent Bernat wrote to the debian-devel list, noting
that the python-asyncssh package, when building, runs a unit test that
attempts a DNS lookup. That would seem to violate section 4.9 of the
Debian packaging policy, which states "For packages in the main
archive, no required targets may attempt network access.
"
The issue was reported by Chris Lamb in a bug tagged as "serious." Fixing that violation, Bernat said, is simple enough—just disable the test in question—but Bernat wondered whether or not the policy rule is genuinely useful. Since the test originates in the upstream project, Debian would have to carry the patch indefinitely, adding what might be deemed considerable overhead for little real gain.
Furthermore, the test in question performs a lookup for a host named fail, which is expected not to succeed, and the purpose of the test is to ensure that the package handles the lookup failure gracefully. The build, Bernat said, works in an isolated network namespace and the package builds reproducibly with or without network access. Consequently, he asked for feedback on ignoring the violation in this case:
Any thoughts?
Various responses to Bernat's question suggested alternatives to removing the test, but much of the discussion focused on the purpose of the no-network-access rule. Christian Seiler, among others, said the rule was intended to prevent information leaks, which a DNS lookup would certainly cause.
Paul Wise, however, felt that the rule was intended to ensure that nothing outside of the local build environment had any impact on the result of the build process. Steve Langasek concurred with that viewpoint, noting that:
It would appear that there are more than a few packages in the
archive that do violate the no-network-access rule. Christoph Biedl
said "a certain package (name withheld) did a
*lot* of DNS traffic in the test suite, so far nobody has shown
concerns
". And the test in python-asyncssh, as written, is problematic: if there
is a host named fail in the local DNS zone, the lookup will
succeed. While unlikely, this is possible; a better test
would be to look up a hostname that is guaranteed to be nonexistant by
IANA rules (such as .invalid). In addition to being a better test of lookup-failure
handling, that change would avoid the risk of
an information leak through the lookup request (or, at least, reduce
the risk, depending on the behavior of the nameserver).
Russ Allbery contended, though, that there is no genuinely important information leak anyway. He made that comment in reply to Thomas Goirand, who suggested that the issue of attempting network access was valid, but questioned whether "serious" was an appropriate severity level:
Others on the list, starting with Gregor Hermann, suggested revising the wording of the
rule itself. Allbery proposed two
rules, one saying that the package build "must not fail when it doesn't have network
access
" and another
that warns against leaking privacy-related information; several
similar variations arose from other participants in the thread. But Adam
Borowski replied that attempts to
distinguish between different types of network usage are, ultimately,
doomed to fail, making such an effort pointless:
If _some_ network accesses are allowed, we can't easily spot the bad ones. With the current wording of the policy, iptables ... -j LOG is all you need for a QA check.
I'd amend the policy to say explicitly "localhost doesn't count as network, DNS lookup do".
Borowski reiterated the privacy-leak angle, saying that even innocent-looking DNS lookups violate "the Dissident Test"—that is, a user performing the build in some location where state-sponsored surveillance is a threat could put themselves at risk of investigation.
But not everyone found the "Dissident Test" argument persuasive. Allbery, in particular, contended that the lookup of a well-known hostname did not reveal significant personally identifiable data, saying:
Moreover, Allbery continued, the entire issue is somewhat overblown:
Goirand concurred with that
sentiment, noting that Debian already has a contentious relationship
with some upstream projects. Zlatan Todoric also agreed, saying "I
also feel that we are losing too much energy on this and this is not
sustainable long term, nor fun.
"
The discussion eventually tapered off without a firm conclusion as to whether or not Debian policy should be amended and with no guidelines for a broad approach to assessing future network accesses that occur during package builds. It seems that the status quo will remain in place, then. Each package maintainer will have to individually assess any problematic network-access attempts in build targets, and some of those access attempts may survive for some time if they are determined to pose neither a serious privacy risk nor to impact the result of the build.
On the surface, it might seem like the Debian project has decided
to let a minor rules violation slip through the cracks. Bernat had
closed the bug as wontfix prior to raising the issue on the
discussion list and has not revisited it. But, at another level, the
project could be said to have taken the underlying
issues—privacy and reproducible builds—seriously and
determined that those principles were being upheld. And that would
surely be considered Debian behaving as it usually does, with a strict
attention to detail.
Posted Sep 15, 2016 5:35 UTC (Thu)
by pabs (subscriber, #43278)
[Link]
Posted Sep 15, 2016 9:48 UTC (Thu)
by lamby (subscriber, #42621)
[Link]
Clearly, requiring internet access and downloading third-party code, etc. is extremely suspect, but that's actually a different topic altogether to the rather more subtle one being discussed here.
(Whilst the original bug submitter, I am absent from from aforementioned debian-devel thread as I studiously avoid motivation-sapping games of bug severity "ping-pong" and Policy wording hermeneutics…)
Posted Sep 15, 2016 11:02 UTC (Thu)
by emk (subscriber, #1128)
[Link] (7 responses)
If Debian feels that setting up a simple network namespace during a build is too much work and too much disruption, I'm not sure that upstream should be obliged to invest the effort required to uphold this policy, either. Technically, it's better to solve this problem once.
Posted Sep 15, 2016 11:25 UTC (Thu)
by lamby (subscriber, #42621)
[Link] (6 responses)
Alas not. The issue here is that a developer who "just" builds a package on their own machine without such a restriction will not only reveal themselves privacy-wise (the merits of which are discussed elsewhere), but also runs the risk of using code from the internet just as before with all the obvious reproducibility, reliability and security implications.
Paradoxically, I suspect this latter problem would only be more likely if Debian's official build network added such network namespacing as developers would inclined to think it was a solved issue.
This not only applies to developers rebuilding packages locally, but to all Debian derivatives - they would now have to introduce such a restriction to stay at parity.
Posted Sep 15, 2016 16:40 UTC (Thu)
by alonz (subscriber, #815)
[Link] (3 responses)
Posted Sep 15, 2016 18:27 UTC (Thu)
by flussence (guest, #85566)
[Link]
Posted Sep 15, 2016 20:45 UTC (Thu)
by derobert (subscriber, #89569)
[Link] (1 responses)
Posted Sep 16, 2016 12:13 UTC (Fri)
by fishface60 (subscriber, #88700)
[Link]
Posted Sep 15, 2016 18:46 UTC (Thu)
by emk (subscriber, #1128)
[Link] (1 responses)
Basically, this problem has an enormously time-consuming and annoying "social" solution that will annoy upstream maintainers and still overlook packages breaking the rules (as has apparently been the case for 20 years). But there's also a relatively simple "technical" solution that will strictly enforce the necessary policy by simulating an offline build machine. This could be as simple as a short C program invoked as "network_sandbox cmd arg1 arg2" inserted in the right place. Then you only have to fix the packages that assume an actual working internet connection, and not the packages that do DNS lookups on "example.invalid" or which talk to localhost.
We have these shiny new kernel features. Docker uses them every day. Let's use them in other places if it provides real benefits.
Posted Sep 22, 2016 10:09 UTC (Thu)
by rleigh (guest, #14622)
[Link]
Posted Sep 15, 2016 20:00 UTC (Thu)
by epa (subscriber, #39769)
[Link] (2 responses)
Posted Sep 22, 2016 17:25 UTC (Thu)
by pboddie (guest, #50784)
[Link] (1 responses)
I seem to remember a suggestion (by Barry Warsaw, I think) involving a network proxy environment variable workaround that had already been employed to neuter the irritating proliferation of setuptools in Python packaging scripts, with its tendency to want to "dial out" for various things. Such a conflation of concerns has been rife in Python packaging for a long time, so it isn't a surprise to see a network-dependent unit test getting run during a build process for a Python package.
Posted Sep 30, 2016 15:56 UTC (Fri)
by pboddie (guest, #50784)
[Link]
Here is what seems to get done:
Posted Sep 21, 2016 17:44 UTC (Wed)
by bernat (subscriber, #51658)
[Link]
I didn't close the bug before the discussion. I closed it after the first post by Russ: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=830568;.... I should have motivated the whole thing but this kind of "disonnance" between fellow maintainers make me uncomfortable and I already had enough of endless debates.
Network access by Debian package builds
Network access by Debian package builds
Network access by Debian package builds
Network access by Debian package builds
My reading of the previous poster was that Network access by Debian package builds
debian-buildpackage
would set up this “no-access” namespace, so it would apply to local builds as well—not just to the Debian build infrastructure.
Network access by Debian package builds
Network access by Debian package builds
Network access by Debian package builds
Network access by Debian package builds
Network access by Debian package builds
Surely this isn't about building the program, but testing it. The package build process should distinguish between a build step (which can be required not to access the network, as per policy) and a testing step, which happens after a copy of the built package has been made. Test failure might cause the package build to be aborted, but nothing the test code does can affect the content of the package. Then the policy can have more relaxed requirements for the test part, or just require network-using test suites to be flagged specially so paranoid users can avoid running them.
Build versus test
Build versus test
the python-asyncssh package, when building, runs a unit test that attempts a DNS lookup
Build versus test
export http_proxy=127.0.0.1:9
Network access by Debian package builds