Skip to content

feat: add support for Service.trustZone#980

Open
VanL wants to merge 2 commits into
CycloneDX:mainfrom
modelmonster:feat/service-trust-zone
Open

feat: add support for Service.trustZone#980
VanL wants to merge 2 commits into
CycloneDX:mainfrom
modelmonster:feat/service-trust-zone

Conversation

@VanL
Copy link
Copy Markdown

@VanL VanL commented May 19, 2026

Adds the optional trust_zone field to Service, available in CycloneDX v1.5 and later. Serializes as trustZone in JSON and <trustZone> in XML for schemas 1.5, 1.6, and 1.7; omitted for earlier versions.

Implements part of issue #578.

Description

Adds the optional trust_zone field to Service, available in
CycloneDX v1.5 and later. Serializes as trustZone in JSON and
<trustZone> in XML for schemas 1.5/1.6/1.7; omitted for earlier
versions.

Resolves a part of: #578

AI Tool Disclosure

  • My contribution does not include any AI-generated content
  • My contribution includes AI-generated content, as disclosed below:
    • AI Tools: Codex, Claude Code
    • LLMs and versions: Opus 4.7, Codex 5.5 (XHigh)
    • Prompts: Reviewed the existing TODO in cyclonedx/model/service.py:242-251,
      drafted an implementation plan, and implemented per the CycloneDX 1.5+
      service.trustZone schema. Implemented multiple agent adversarial review.

Affirmation

Adds the optional `trust_zone` field to `Service`, available in
CycloneDX v1.5 and later. Serializes as `trustZone` in JSON and
`<trustZone>` in XML for schemas 1.5, 1.6, and 1.7; omitted for earlier
versions.

Implements part of issue CycloneDX#578.

Signed-off-by: VanL <van@ospo.co>
@VanL VanL requested a review from a team as a code owner May 19, 2026 17:13
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 19, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented May 19, 2026

Documentation build overview

📚 CycloneDX Python Library | 🛠️ Build #32763311 | 📁 Comparing 94e1e43 against latest (0daf3f9)

  🔍 Preview build  

2 files changed
± genindex.html
± autoapi/cyclonedx/model/service/index.html

Signed-off-by: VanL <van@ospo.co>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds CycloneDX v1.5+ support for Service.trustZone (Python attribute trust_zone) in the Service model, ensuring it serializes/deserializes correctly and is omitted for earlier schema versions.

Changes:

  • Added optional trust_zone: Optional[str] to cyclonedx.model.service.Service, with schema-version-gated serialization (v1.5+ only) and XML normalized-string handling.
  • Added/updated JSON and XML output validation tests to confirm presence/absence by schema version and schema rejection for pre-1.5 documents.
  • Updated deserialization tests and snapshot fixtures/models to include trustZone for v1.5–v1.7 outputs.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
cyclonedx/model/service.py Introduces trust_zone property with v1.5+ serialization views and normalized XML string handling; updates equality/hash tuple.
tests/test_output_xml.py Adds XML output tests for trustZone across schema versions, including normalization and pre-1.5 rejection validation.
tests/test_output_json.py Adds JSON output tests for trustZone across schema versions and pre-1.5 rejection validation.
tests/test_model_service.py Adds model-level tests for default/setter behavior and equality/sorted-set membership impact.
tests/test_deserialize_xml.py Adds XML deserialization test for trustZone (v1.7).
tests/test_deserialize_json.py Adds JSON deserialization test and JSON→XML roundtrip test preserving trust_zone.
tests/_data/models.py Updates complex services fixture to set trust_zone so snapshots include the new field where applicable.
tests/_data/snapshots/get_bom_with_services_complex-1.5.xml.bin Snapshot updated to include <trustZone> for schema v1.5.
tests/_data/snapshots/get_bom_with_services_complex-1.5.json.bin Snapshot updated to include trustZone for schema v1.5.
tests/_data/snapshots/get_bom_with_services_complex-1.6.xml.bin Snapshot updated to include <trustZone> for schema v1.6.
tests/_data/snapshots/get_bom_with_services_complex-1.6.json.bin Snapshot updated to include trustZone for schema v1.6.
tests/_data/snapshots/get_bom_with_services_complex-1.7.xml.bin Snapshot updated to include <trustZone> for schema v1.7.
tests/_data/snapshots/get_bom_with_services_complex-1.7.json.bin Snapshot updated to include trustZone for schema v1.7.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request schema 1.5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants