Skip to content

Repository files navigation

CSAF Modifier Tool

CSAF modifier according to the specification: https://docs.oasis-open.org/csaf/csaf/v2.0/os/csaf-v2.0-os.html#918-conformance-clause-8-csaf-modifier

How it works

  • Takes a CSAF document as input (file or stdin)
  • accoding to user configuration it applies:
    • change the publisher
    • add notes
    • replace the legal disclaimer
    • add new references
  • It always
    • changes the document tracking ID
    • adds a reference to the original CSAF document
  • Validates the conformity of the resulting modified CSAF document
  • Writes the result to the output file or stdout

Examples

Set a new disclaimer:

$ csaf-modifier example.json --legal-disclaimer "This is the new disclaimer" | jq .document.notes[2]
{
"category": "legal_disclaimer",
"text": "This is the new disclaimer"
}

Set the publisher:

$ csaf-modifier example.json --publisher-name 'New publisher' --publisher-category discoverer --publisher-contact-details discoverer@example.com --publisher-namespace https://example.com/ | jq .document.publisher
{
"category": "discoverer",
"contact_details": "discoverer@example.com",
"name": "New publisher",
"namespace": "https://example.com/"
}

Usage

ArgumentValueDescription
-h or --help-show help on usage and available arguments

Input and Output

Both the input and the output CSAF document can be either files or stdin/stdout.

ArgumentValueDefaultDescription
positional- (stdin)Input file namePath to the input CSAF document
-o or --output- (stdout)Output file namePath to write the modified CSAF document

Self-reference

ArgumentValueDefaultDescription
--basepathbasepath-Base URL to prefix the new document's filename with, used to build the new self reference. If omitted, the bare filename is used. Required for a valid document

CSAF validation

ArgumentValueDefaultDescription
--force-FalseIf used, the converter produces output even if it is invalid (errors occurred during modification). Target use case: best-effort modification to JSON, fix the errors manually, e.g. in Secvisogram
--no-validation--Deactivate validation by a validator service
--validator-endpointURLhttp://localhost:8082/api/v1/validateThe URL where the validator service is reachable
--validator-modemodesecvisogramThe Validator mode, currently supported: secvisogram
--validator-presetpresetbasicOne or more validation presets. Currently supported: 'schema', 'mandatory', 'optional', 'informative', 'basic', 'extended', 'full'

Publisher

If the publisher is to be set, category, name and namespace are required. Contact details and issuing authority are optional.

ArgumentValueRequiredDescription
--publisher-categoryOne of coordinator,discoverer,other,translator,user,vendorYesNew publisher category
--publisher-namePUBLISHER_NAMEYesNew publisher name
--publisher-namespacePUBLISHER_NAMESPACEYesNew publisher namespace (URI)
--publisher-contact-detailsPUBLISHER_CONTACT_DETAILSNoNew publisher contact details
--publisher-issuing-authorityPUBLISHER_ISSUING_AUTHORITYNoNew publisher issuing authority

Notes

Repeatable: each occurrence of --note-text starts a new note. If --note-category/--note-title/--note-audience are used, they must be given exactly as many times as --note-text, and are paired up by position.

ArgumentValueRequiredDescription
--note-textTEXTYesAdd a note to document.notes with this text
--note-titleTITLENoTitle for the note at the same position as --note-text
--note-audienceAUDIENCENoAudience for the note at the same position as --note-text
--note-categoryOne of 'description', 'details', 'faq', 'general', 'other', 'summary'No, default: otherCategory for the note
--legal-disclaimerTextNoReplace the text of an existing legal_disclaimer note, or add one if none exists

References

Repeatable: each occurrence of --reference-url starts a new reference and requires a matching --reference-summary at the same position.

ArgumentValueRequiredDescription
--reference-urlURLYesAdd an additional entry to document.references with this URL
--reference-summaryTextYesSummary for the reference at the same position as --reference-url
--reference-categoryone of 'external', 'self'No, default: externalCategory for the reference at the same position as --reference-url

License

 SPDX-License-Identifier: Apache-2.0
SPDX-FileCopyrightText: 2024 German Federal Office for Information Security (BSI) <https://www.bsi.bund.de>
Software-Engineering: 2024 Intevation GmbH <https://intevation.de>

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages