csaf_distribution icon indicating copy to clipboard operation
csaf_distribution copied to clipboard

changes.csv: check quoting

Open tschmidtb51 opened this issue 1 year ago • 6 comments

Currently, the csaf_checker does not report if one of the fields in a changes.csv is not quoted. Can we change that to report this violation?

tschmidtb51 avatar Apr 11 '24 14:04 tschmidtb51

Using the csv package from the standard library it is not possible to change that, I guess. These quotes are automatically being removed: "The beginning and ending quote are not part of the field" (see https://pkg.go.dev/encoding/csv).

One option would be to implement a io.Reader yourself. Or maybe you can build a wrapper around the CSV reader @oxisto?

lebogg avatar Apr 25 '24 14:04 lebogg

@tschmidtb51 can you elaborate, why you see this as a violation?

In CSAF 2.0 there is no precise definition of the format of changes.csv, only an example file.

Assuming that other standards are a good choice to refer to, https://www.rfc-editor.org/rfc/rfc4180#page-2 is the IETF one and has

  1. Each field may or may not be enclosed in double quotes [..]

So some fields without double quotes are allowed by RFC4180. It depends on the field value.

Looking at a different standard body, e.g. https://www.w3.org/TR/sparql12-results-csv-tsv/#csv-terms has and example with fields without double quotes: https://www.w3.org/TR/sparql12-results-csv-tsv/#csv-example

As CSAF 2.0 does not add restrictions, having fields without double quotes is not a documented violation against it.

bernhardreiter avatar May 16 '24 14:05 bernhardreiter