Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Compose SCAP 1.3 DataStreams #1323

Closed
wants to merge 1 commit into from

Conversation

yuumasato
Copy link
Member

This is a very early and rough patch to update openscap to compose SCAP 1.3 compliant Data Streams.

What this PR does for now:

  • When a check-content-ref's href attribute is a supported URL (i.e.: http:// or https://)
    • Add a uri entry in the Benchmarks component-ref catalog, but don't include its contents in DS
    • Add a component-ref to datastream's <ds:checks>

What it needs to do:

  • Get the path from the URL and generate the component name and uri.
  • oscap_source_new_from_url not sure if makes sense to implement it.

Related to ComplianceAsCode/content#4302


oscap_document_type_t doc_type = oscap_source_get_scap_type(component_source);
if (oscap_str_startswith(filepath, "com.")) {
Copy link
Member

Choose a reason for hiding this comment

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

This is suspicious for me. Is it remote when the file path starts with "com."?

Also, ds_sds_compose_add_component_source_with_ref is called from ds_sds_compose_add_component_with_ref which is called from ds_sds_compose_add_component which is used when composing datastreams.
What if I have a local file com.example.xml in current working directory and I run this:
oscap ds sds-compose com.example.xml ds.xml

Copy link
Member Author

Choose a reason for hiding this comment

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

Is it remote when the file path starts with "com."?

No. I just used a hardcoded string, and a dumb match to it just to see how the output would lookl ike. This PR is very rough, take it with a grain of salt, :)

* downloaded once the scan is run. */
xmlFree(href);
continue;
* it within the DataStream. Such component shall only be
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean after this change it will get included?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not the contents, just a component-ref in the <ds:checks> that will reference the remote content, and a <uri> in each Benchmark component that uses the remote resource.

// fix real_path for remote source
// Update href name to be only remote file (com.redhat.rhsa-RHEL7.xml)
// char *real_path = oscap_strdup(href)
real_path = oscap_strdup("com.redhat.rhsa-RHEL7.xml");
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand. If content references any remote content from anywhere, will it always get replaced by RHEL 7 RHSA? Hard coding anything here seems suspicious.

Copy link
Member Author

Choose a reason for hiding this comment

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

I was just lazy to implement a URL parser before I could test that this is a good approach.

@jan-cerny
Copy link
Member

I think we will need a test for this.

@jan-cerny jan-cerny added this to the 1.3.1 milestone Apr 29, 2019
@jan-cerny jan-cerny modified the milestones: 1.3.1, 1.3.2 Jun 13, 2019
@evgenyz evgenyz modified the milestones: 1.3.2, 1.3.3 Jan 14, 2020
@evgenyz evgenyz modified the milestones: 1.3.3, 1.3.4 Apr 29, 2020
@evgenyz evgenyz mentioned this pull request Jul 31, 2020
@evgenyz evgenyz modified the milestones: 1.3.4, 1.3.5 Oct 1, 2020
@evgenyz evgenyz modified the milestones: 1.3.5, 1.4 Mar 22, 2021
@evgenyz
Copy link
Contributor

evgenyz commented Apr 19, 2023

We are not using OpenSCAP to compose DS anymore. Closing.

@evgenyz evgenyz closed this Apr 19, 2023
@evgenyz evgenyz removed this from the 1.4 milestone Feb 13, 2024
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.

3 participants