Skip to content

feat: support tlp enum conversion - #1334

Open
bshek-xitaso wants to merge 8 commits into
csaf-rs:mainfrom
bshek-xitaso:feat/1067-tlp-label-conversion
Open

bshek-xitaso wants to merge 8 commits into
csaf-rs:mainfrom
bshek-xitaso:feat/1067-tlp-label-conversion

Conversation

@bshek-xitaso

Copy link
Copy Markdown
Contributor

This PR resolves #1067.

@bshek-xitaso
bshek-xitaso force-pushed the feat/1067-tlp-label-conversion branch from da9ce11 to 0dbe88e Compare October 21, 2026 10:11
@bshek-xitaso
bshek-xitaso force-pushed the feat/1067-tlp-label-conversion branch from 0dbe88e to ebd150c Compare October 21, 2026 10:19
@bshek-xitaso
bshek-xitaso marked this pull request as ready for review October 21, 2026 11:12
@bshek-xitaso
bshek-xitaso requested a review from a team as a code owner October 21, 2026 11:12
@Gronner

Gronner commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Currently reviewing 👀

@Gronner Gronner left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks good and working to me, I have some suggestion w.r.t to conversions happens and how the edge cases could be handled

Comment thread csaf-rs/src/converter/mod.rs Resolved
Ok(csaf2_0::schema::LabelOfTlp::Red) => (csaf2_1::schema::LabelOfTlp::Red, false),
Err(_) => {
diagnostics.warning("/document/distribution/tlp/label".into(), Warning::InvalidTlpLabel);
(csaf2_1::schema::LabelOfTlp::Clear, false)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the default for a missing TLP label is explicitly TLP:CLEAR, I'd actually choose the most restrictive one for this case? As a label is set, but we can not identify it, this would assume that the information within the CSAF document is always public. So maybe in case of an invalid value TLP:RED or TLP:ABMER+STRICT would be a more secure default?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be something to discuss with TC?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep CLEAR for now, but we can open a discussion with the TC.

Comment thread csaf-rs/src/converter/mod.rs Outdated
@@ -62,6 +66,14 @@ impl fmt::Display for Warning {
Warning::InvalidCsafVersion => "CSAF version node contained an invalid value",
Warning::InvalidTlpLabel => "TLP label contained an invalid value",
Warning::TlpIsMissingLabel => "TLP node was present but did not contain the `label` property",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a hint, that if the TLP is contained in the distribution's text field, an option to detect this is available?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The required public Settings field introduces a breaking downstream source-compatibility issue.

1 open issue
What changed in this PR

Adds CSAF 2.0-to-2.1 TLP label conversion, optional distribution.text extraction, diagnostics, and conformance coverage.

Changes:

  • Maps TLP v1.0 labels to v2.0 equivalents.
  • Adds configurable text-based TLP overrides and CLI support.
  • Adds warnings and default handling for missing labels.
  • Enables related conformance tests.

A critical compatibility issue remains: the required public Settings field breaks downstream Settings {} usage.

File Description
csaf-rs/​tests/​converter-conformance.rs Enables missing-TLP conformance coverage.
csaf-rs/​src/​converter/​update_tlp_label.rs Implements TLP conversion and text-based overrides.
csaf-rs/​src/​converter/​mod.rs Adds settings and warning variants.
csaf-converter/​src/​main.rs Exposes the CLI option.

Review effort: Lite

Comment thread csaf-rs/src/converter/mod.rs Resolved
@bshek-xitaso
bshek-xitaso marked this pull request as draft October 21, 2026 13:58
@tziemek
tziemek marked this pull request as ready for review November 10, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

converter: tlp enum conversion

4 participants