Mercurial > farol > farolluz
changeset 11:91d2a97f8bb4
Add some missing elements in the CVRF generation
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Wed, 08 Oct 2014 12:46:45 +0200 |
parents | 7998a57c9b48 |
children | 848fd86d9cbc |
files | farolluz/templates/cvrf.j2 |
diffstat | 1 files changed, 60 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/farolluz/templates/cvrf.j2 Wed Oct 08 12:45:19 2014 +0200 +++ b/farolluz/templates/cvrf.j2 Wed Oct 08 12:46:45 2014 +0200 @@ -25,7 +25,7 @@ <?xml version="1.0" encoding="utf-8"?> -{#- Some macros for producttree generation #} +{#- A macro for producttree generation #} {%- macro FullProductNames(producttree, parent) %} {%- for product in producttree._products %} {%- if product._parent is sameas parent %} @@ -36,11 +36,37 @@ {%- endfor %} {%- endmacro %} +{#- Some macros about more generic types #} {%- macro Note(note) -%} <Note{{ {'Type': note._type, 'Ordinal': note._ordinal, 'Title': note._title, 'Audience': note._audience} | xmlattr }}> {{- note._note | escape -}} </Note> -{%- endmacro %} +{%- endmacro -%} + +{%- macro Reference(reference) -%} + <Reference{{ {'Type': reference._type} | xmlattr }}> + <URL>{{ reference._url }}</URL> + <Description>{{ reference._description }}</Description> + </Reference> +{%- endmacro -%} + +{%- macro Acknowledgment(acknowledgment) -%} + <Acknowledgment> + {%- for name in acknowledgment._names %} + <Name>{{ name }}</Name> + {%- endfor %} + {%- for organization in acknowledgment._organizations %} + <Organization>{{ organization }}</Organization> + {%- endfor %} + {%- if acknowledgment._description %} + <Description>{{ acknowledgment._description }}</Description> + {%- endif %} + {%- if acknowledgment._url %} + <URL>{{ acknowledgment._url }}</URL> + {%- endif %} + </Acknowledgment> +{%- endmacro -%} + <cvrfdoc xmlns="http://www.icasi.org/CVRF/schema/cvrf/1.1"> <DocumentTitle>{{ cvrf._title }}</DocumentTitle> <DocumentType>{{ cvrf._type }}</DocumentType> @@ -107,30 +133,14 @@ {%- if cvrf._references %} <DocumentReferences> {%- for reference in cvrf._references %} - <Reference{{ {'Type': reference._type} | xmlattr }}> - <URL>{{ reference._url }}</URL> - <Description>{{ reference._description }}</Description> - </Reference> + {{ Reference(reference) }} {%- endfor %} </DocumentReferences> {%- endif %} {%- if cvrf._acknowledgments %} <Acknowledgments> {%- for acknowledgment in cvrf._acknowledgments %} - <Acknowledgment> - {%- for name in acknowledgment._names %} - <Name>{{ name }}</Name> - {%- endfor %} - {%- for organization in acknowledgment._organizations %} - <Organization>{{ organization }}</Organization> - {%- endfor %} - {%- if acknowledgment._description %} - <Description>{{ acknowledgment._description }}</Description> - {%- endif %} - {%- if acknowledgment._url %} - <URL>{{ acknowledgment._url }}</URL> - {%- endif %} - </Acknowledgment> + {{ Acknowledgment(acknowledgment) }} {%- endfor %} </Acknowledgments> {%- endif %} @@ -215,6 +225,21 @@ {%- endfor %} </ProductStatuses> {%- endif %} + {%- if vulnerability._threats %} + <Threats> + {%- for threat in vulnerability._threats %} + <Threat Type="{{ threat._type }}"{{ ' Date="%s"' % threat._date.isoformat() if threat._date }}> + <Description>{{ threat._description }}</Description> + {%- for productid in threat._productids %} + <ProductID>{{ productid }}</ProductID> + {%- endfor %} + {%- for groupid in threat._groupids %} + <GroupID>{{ groupid }}</GroupID> + {%- endfor %} + </Threat> + {%- endfor %} + </Threats> + {%- endif %} {%- if vulnerability._cvsss %} <CVSSScoreSets> {%- for cvss in vulnerability._cvsss %} @@ -230,7 +255,7 @@ <Vector>{{ cvss._vector }}</Vector> {%- endif %} {%- for productid in cvss._productids %} - <ProductID>{{productid}}</ProductID> + <ProductID>{{ productid }}</ProductID> {%- endfor %} </ScoreSet> {%- endfor %} @@ -257,6 +282,20 @@ {%- endfor %} </Remediations> {%- endif %} + {%- if vulnerability._references %} + <References> + {%- for reference in vulnerability._references %} + {{ Reference(reference) }} + {%- endfor %} + </References> + {%- endif %} + {%- if vulnerability._acknowledgments %} + <Acknowledgments> + {%- for acknowledgment in vulnerability._acknowledgments %} + {{ Acknowledgment(acknowledgment) }} + {%- endfor %} + </Acknowledgments> + {%- endif %} </Vulnerability> {%- endfor %} </cvrfdoc>