Closed dmth closed 7 years ago
Note https://github.com/xarf/python-xarf/blob/master/pyxarf/xarf.py#L36 the parameter date
is speficied to be string
class Xarf(object):
'''
xarf report generation class
...
:type date: string
:param source: source of report
When entering a yaml report into https://www.blocklist.de/en/xarfvalidatorreport.html (without headers)
there is a problem if some strings are quoted which is not specific to date
. The following reports are indicated as problematic by the blockist.de validator.
Attachment: none
Category: abuse
Date: 2017-03-09T09:41:37+01:00
Report-ID: '4711@example.com'
Report-Type: bot-infection
Reported-From: reporter@example.com
Schema-URL: https://raw.githubusercontent.com/Intevation/xarf-schemata/master/abuse_bot-infection_0.2.0_unstable.json
Source: 192.168.0.1
Source-Type: ip-address
User-Agent: pyxarf 0.0.5bereiter
Attachment: none
Category: abuse
Date: '2017-03-09T09:41:37+01:00'
Report-ID: 4711@example.com
Report-Type: bot-infection
Reported-From: reporter@example.com
Schema-URL: https://raw.githubusercontent.com/Intevation/xarf-schemata/master/abuse_bot-infection_0.2.0_unstable.json
Source: 192.168.0.1
Source-Type: ip-address
User-Agent: pyxarf 0.0.5bereiter
Because my reading of YAML is that single quotes around scalars are fine, see http://www.yaml.org/spec/1.2/spec.html#id2788097 the blocklist.de validator seems to have a problem.
I've created this Issue based on the assumption that the validator validator https://www.blocklist.de/en/xarfvalidatorreport.html is always correct when validating things. Seems like it was not.
As the validator was fixed, I'm closing this issue.
When using pyxarf's
to_yaml()
function RFC3339 dates seem to be invalid. I suspect the yaml library or blocklist's validator to be the source of error here, but I'm not yet sure.For this issue I assume that the validator https://www.blocklist.de/en/xarfvalidatorreport.html is always correct when validating things.
Edit on 2017-03-13 Seems like the validator was not correct. / EDIT
I'm just documenting my tests here. Feel free to react on this issue as you like.
Output Is:
I'd expect:
We use our abuse_bot-infection_0.2.0_unstable schema published in [1], it is similar to abuse_bot-infection_0.1.0
Examples to reproduce:
Converting the Date to RFC 3339 seems to be the right way to do it, as the specification [2] says:
I read this as should be RFC3339, may be RFC2822, thus RFC3339 is preferred.
Nevertheless, the Compatibility Path via RFC2822 works as expected:
I'd expect that PyXARF is capable of converting Python Datetime Objects into the correct format. It seems like it cannot do this, or have I overlooked something?
Again an example:
BR Dustin
[1] https://raw.githubusercontent.com/Intevation/xarf-schemata/master/abuse_bot-infection_0.2.0_unstable.json [2] https://github.com/xarf/xarf-specification/blob/master/xarf-specification_0.2.md#date-mandatoryonly-once