Hi Larry,
> In concept, I like! However, there's a few important details here.
>
> First, I agree with others who have said that a mandatory file in a repo is
> the wrong approach, for various reasons. I will go a step further, however.
> We don't want to be using a file at all. What we're really talking about
> here is projects offering a standard-format *feed* of security advisories,
> with enough information that it COULD be cross-referenced to a package
> broker service such as composer.
>
> I say feed for a couple of reasons.
>
> 1) Consider a large or older project. Drupal has been around for 13 years.
> We have had a lot of SAs in that time. If you include Drupal's thousands of
> add-on modules that are also served by Drupal.org, there's hundreds.
> (That's not a slam against Drupal; it's a good mark of how seriously we take
> security SA best practices. <g>) Putting all of those in one big file is
> not going to scale at all.
Agreed. My proposal does explicitly mention a JSON file but it should
allow for more scalable resources (as my opening blog post suggested).
I don't believe anyone should expect Drupal, Wordpress or applications
at that level to produce a single epic JSON file. However, I assume
most projects are much much smaller and we can't realistically expect
all of them to operate a service endpoint or generate an XML feed when
many of them lack a website with access to a scripting language (e.g.
relying on Github wiki or static pages).
> 2) We really shouldn't be doing this via "grab a repo and open a file."
> This should be done as a REST API call. What a project should publish is
> simply the URI from which recent SAs can be requested; no more, no less.
> (It can publish it as a composer.json key, but that's just one option.)
As above - it may sink the ship to require every project/package to
maintain a REST API. I'd prefer to maintain a limited set of
alternatives that suit projects with different resources/needs than
force everyone down the same rabbit hole.
> 3) Once you think of it in terms of a feed, you realize that this isn't even
> a PHP-specific question. *Any* software package should be offering a
> machine-readable SA feed. PHP's not special in that regard.
Far from it! There are machine readable formats out there in popular
use for distributing security information in XML. The best matching
one is probably Common Vulnerability Reporting Framework (CVRF):
http://www.icasi.org/cvrf. ICASI is a limited-member indutry group
(Oracle, Microsoft, IBM, Intel, Juniper, et al). There is also Open
Vulnerability and Assessment Language (OVAL) from MITRE (the CVE
guys):
http://oval.mitre.org/about/. OVAL has been around since the
early 2000s but CVRF is practically fresh off the assembly line. If I
remember, Red Hat uses CVRF and Debian/SuSE uses OVAL.
My preference would be CVRF which was heavily influenced by Red Hat's
involvement in the WG and seems to be a tidy format (for XML).
Note: Neither of these are RSS/Atom based and I'm not aware of an Atom
container syntax. It was discussed way back but I've only ever seen
the base format published.
<snip>
The question is though, how interoperable are those RSS feeds? How can
you map generic RSS back to specific versions and package names? You
could specify an RSS extension for new elements to use but this
requires a non-standard specification when we already have a few good
non-RSS standards out there to lean on.
> So it seems a lot of RSS feeds in human-readable format. Of course, I agree
> that machine-parsable would be much more useful for automation like Sensio
> is doing. For public feeds... XML is the dominant player. (Sorry for the
> angle-bracket allergic in the audience.)
From another perspective, the dominant player is to have no feeds.
> So, I would revise/counter-propose to Paddy something simpler:
>
> 1) Projects publish a known-stable URI at which security advisories will be
> served.
> 2) That URI must return Atom, with a to-be-defined machine-readable payload.
> (We could use something existing in RDF, or come up with something, or find
> an IETF standard, or whatever.) Atom offers much better machine parsing
> than RSS, as well as pubsub capability (which would be very useful here).
> 3) That URI must use HTTPS to avoid man-in-the-middle attacks.
> 4) Aggregators (Composer, Sensio, or otherwise) MAY aggregate and present
> that data however is logical for them. That includes caching for a limited
> time.
> 5) Projects MAY aggregate multiple projects into a single feed if that is
> documented in the feed's header.
> 6) There is no step 6. :-)
If we accept XML as an alternative, which I fully support, I'd make
point 2 use CVRF and remove point 3. HTTPS is not necessary for
distributing advisories. At a stretch, an attacker could manipulate a
feed/API result to trick a user into installing an insecure dependency
but they can already try that by manipulating stacks of RSS feeds and
blog posts. HTTPS is another barrier to adoption and, in this case,
the cost seems to outweight the small benefit it would provide.
> Of course, plenty of projects are small enough they wouldn't want to setup
> their own feed service. That's fine; as long as it's a valid URI it can be
> hosted by anyone, which means, for instance, Sensio could host and serve
> feeds for Symfony-related projects if it wanted to, and then individual
> project devs could just manually enter details into a form on Sensio's site
> and it would get published.
That's the system I actually want to avoid at all costs. If the
central service goes down, we lose all of the data. Part of the
Composer/Github duo's charm, versus something like PEAR, is that
should Composer die and Packagist.org fall offline, the entire
packaging ecosystem can be resurrected in short order. The data and
the hosted packages are independent of the services and tools.
Secondly, this also ensures that implementing a checker has options -
you can aggregate advisories or just tell clients which URIs to GET
and analyse outside of the service's domain, i.e. just as Composer
maps package names to downloads from GH.
Thirdly, I suspect that filling out forms on a website imposes more of
a challenge than editing a local file (or database). I want to keep
the effort minimal so this has a better change of being successful in
the community.
> Alternatively, if we can find an existing spec that's already doing this
> (PHP or otherwise), we just piggyback on that and call it a day.
>
> I'd have to speak to the Drupal security team to answer "beneficial or
> annoyance", but I suspect beneficial as long as it's not too difficult to
> implement. We already offer security notice feeds using a completely custom
> XML format that installed Drupal sites pull from by default to notify people
> of SAs. Switching to a standard format for that seems like it would only be
> a good thing.
Is there a URI to those documented somewhere? Might check how
different/compatible it would be to a CVRF feed (anything extra to
CVRF could still be separately namespaced in the XML assuming half
decent parsers).
Paddy