Problem/Motivation

Since we now allow anyone to create stable projects, we're partially violating the 'minimum-stability' flag of composer, as there are two classes of stable projects - those with security coverage and those without.
I'm planning on writing a composer plugin to warn about stable modules with no security coverage, but in order to do so, we need that metadata in composer.json.

Proposed resolution

Add metadata drawn from the security-coverage opt-in field to the 'extra' attribute of composer.json so that can be interrogated by composer plugins/scripts etc.

Remaining tasks

Reviews

User interface changes

N/A

API changes

?

Data model changes

?

CommentFileSizeAuthor
#4 include_metadata_about-2863103-4.patch1.11 KBlarowlan
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

larowlan created an issue. See original summary.

larowlan’s picture

Gonna have a go at this while in transit this week

larowlan’s picture

Notes from IRC convo

_project_composer_release_metadata()
$project_wrapper->field_security_advisory_coverage->value() === 'covered'
larowlan’s picture

Status: Active » Needs review
FileSize
1.11 KB
larowlan’s picture

Issue summary: View changes
webflo’s picture

Interesting idea, i could add support for it in the composer_deploy. How does update.module deal with this change?

webflo’s picture

larowlan’s picture

I take it the answer was 'not at all' :)

drumm’s picture

Thanks, looks like a good start.

$project_wrapper->field_security_advisory_coverage->value() is project-wide coverage. Per-release, we also want to check:

  • Is it a full version?
  • Has the maintainer marked it as supported on admin releases for the project?

http://cgit.drupalcode.org/drupalorg/tree/drupalorg/drupalorg.module#n4954 is where this is done for update status XML. (If the line number changes, it is in drupalorg_project_release_xml_release_alter(), after // Add security advisory coverage..) That could be pulled out into a generally-useful function, and get the strings matching the update status plan.

Mixologic’s picture

Im going to go ahead and add what is essentially @larowans patch from #3, except modified to be the release specific values:

$security_coverage = $release_wrapper->field_release_project->field_security_advisory_coverage->value() === 'covered';
  $package_data['packages'][$package_name][$version]['extra']['drupal']['security-coverage'] = $security_coverage;

I dont think that project composer should know about any business logic about what constitutes covered or not. If that field is not supposed to contain "covered" because the project is either not a full version or it's been marked as unsupported then we need to make sure that whatever code is responsible for 'unsupporting' a module also removes coverage from the field.

drumm’s picture

The “covered” for SAs value is per-project, it isn’t the only factor per-release. A covered project might have a stable version, but that doesn’t mean any of the pre-release versions are covered. Or a “covered” project might not have any stable version (yet).

  • Mixologic committed d2ac094 on 7.x-1.x
    Issue #2863103: adds security coverage status to extra section
    

  • 6062b99 committed on 7.x-1.x
    Issue #2863103: Updates security coverage to capture the status and...
Mixologic’s picture

Status: Needs review » Fixed

Okay, so we've refactored the covered status so that we can gather that information per release. The composer facade has been rebuilt to include this data, and it is now gathering that data and returning it in the extra field as both a 'status' and a 'message':

There are three statuses: "covered", "not-covered", and "revoked"

"extra" : {
               "drupal" : {
                  "version" : "7.x-1.11",
                  "datestamp" : "1479787142",
                  "security-coverage" : {
                     "message" : "Covered by Drupal's security advisory policy",
                     "status" : "covered"
                  }
               },
               "branch-alias" : {
                  "dev-1.x" : "1.x-dev"
               }
            },
"extra" : {
               "drupal" : {
                  "datestamp" : "1502252151",
                  "version" : "8.x-4.0-alpha2",
                  "security-coverage" : {
                     "status" : "not-covered",
                     "message" : "Alpha releases are not covered by Drupal security advisories."
                  }
               },
               "branch-alias" : {
                  "dev-4.x" : "4.x-dev"
               }
            },
"extra" : {
               "branch-alias" : {
                  "dev-1.x" : "1.x-dev"
               },
               "drupal" : {
                  "version" : "7.x-1.0",
                  "datestamp" : "1391193505",
                  "security-coverage" : {
                     "message" : "Project has been unsupported by the Drupal Security Team",
                     "status" : "revoked"
                  }
               }
            },

The message is an explanatory text field, and its contents may change, so do not write any logic based off of the message contents as they may change.

This data only reflects the security team's policy for a particular release, and in no way indicates the actual security or insecurity of a particular module.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

grasmash’s picture

larowlan’s picture

Thanks @grasmash, works great

Love it when a plan comes together