Skip to content

Commit

Permalink
Require security/privacy considerations for W3C specs.
Browse files Browse the repository at this point in the history
This patch teaches the metadata manager about groups that belong to the
W3C in one way or another, and throws a warning if a specification
produced by one of those groups neglects to include a "Security
Considerations" or "Privacy Considerations" section.

Closes speced#513.
  • Loading branch information
mikewest committed Nov 5, 2015
1 parent b2ec3ff commit 2f47d94
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bikeshed/MetadataManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ def vshortname(self):
return "{0}-{1}".format(self.shortname, self.level)
return self.shortname

@property
def groupIsW3C(self):
return self.group in ["csswg", "dap", "fxtf", "geolocation", "houdini", "ricg", "svg",
"texttracks", "web-bluetooth-cg", "webappsec", "webspecs", "whatwg"]

def __init__(self, doc):
self.doc = doc
self.hasMetadata = False
Expand Down
13 changes: 13 additions & 0 deletions bikeshed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,19 +295,32 @@ def resetHeadings(doc, headings):

def addHeadingIds(doc, headings):
neededIds = set()
hadSecurity = False
hadPrivacy = False
for header in headings:
if header.get('id') is None:
if header.get("data-dfn-type") is None:
# dfn headings will get their IDs assigned by the dfn code
neededIds.add(header)
header.set('id', simplifyText(textContent(find(".content", header))))
if header.get('id') is "security-considerations":
hadSecurity = True
if header.get('id') is "privacy-considerations":
hadPrivacy = True
if header.get("oldids"):
oldIDs = [h.strip() for h in header.get("oldids").strip().split(",")]
for oldID in oldIDs:
appendChild(header, E.span({"id":oldID}))
if len(neededIds) > 0:
warn("You should manually provide IDs for your headings:\n{0}",
"\n".join(" "+outerHTML(el) for el in neededIds))
if doc.md.groupIsW3C:
if not hadSecurity and not hadPrivacy:
warn("This specification has neither a 'Security Considerations' nor a 'Privacy Considerations' section. Please consider adding both.")
elif not hadSecurity:
warn("This specification does not have a 'Security Considerations' section. Please consider adding one.")
elif not hadPrivacy:
warn("This specification does not have a 'Privacy Considerations' section. Please consider adding one.")

def addHeadingAlgorithms(doc, headings):
for header in headings:
Expand Down

0 comments on commit 2f47d94

Please sign in to comment.