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

fix(fetch/oracle): collect modularity label #401

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

MaineK00n
Copy link
Collaborator

@MaineK00n MaineK00n commented Jun 17, 2024

What did you implement:

Like Red Hat, Oracle also has vulnerabilities defined for modular packages, and it is necessary to collect modularity labels. This PR will collect modularity labels.

$ curl -s https://linux.oracle.com/security/oval/com.oracle.elsa-all.xml.bz2 | bzip2 --decompress | xmllint --format - | grep -A50 "oval:com.oracle.elsa:def:20190975"
    <definition id="oval:com.oracle.elsa:def:20190975" version="501" class="patch">
      <metadata>
        <title>
ELSA-2019-0975: container-tools:rhel8 security and bug fix update (IMPORTANT)
</title>
        <affected family="unix">
          <platform>Oracle Linux 8</platform>
        </affected>
        <reference source="elsa" ref_id="ELSA-2019-0975" ref_url="https://linux.oracle.com/errata/ELSA-2019-0975.html"/>
        <reference source="CVE" ref_id="CVE-2019-5736" ref_url="https://linux.oracle.com/cve/CVE-2019-5736.html"/>
        <description>
container-selinux
[2:2.94-1.git1e99f1d]
- Resolves: #1690286 - bump to v2.94
- Resolves: #1693806, #1689255

[2:2.89-1.git2521d0d]
- bump to v2.89

runc
[1.0.0-55.rc5.dev.git2abd837]
- Resolves: CVE-2019-5736

</description>
        <!--
 ~~~~~~~~~~~~~~~~~~~~   advisory details   ~~~~~~~~~~~~~~~~~~~ 
-->
        <advisory>
          <severity>IMPORTANT</severity>
          <rights>Copyright 2019 Oracle, Inc.</rights>
          <issued date="2019-07-30"/>
          <cve href="https://linux.oracle.com/cve/CVE-2019-5736.html">CVE-2019-5736</cve>
        </advisory>
      </metadata>
      <criteria operator="AND">
        <criterion test_ref="oval:com.oracle.elsa:tst:20190975001" comment="Oracle Linux 8 is installed"/>
        <criteria operator="OR">
          <criteria operator="AND">
            <criterion test_ref="oval:com.oracle.elsa:tst:20190975002" comment="Oracle Linux arch is aarch64"/>
            <criteria operator="AND">
              <criterion test_ref="oval:com.oracle.elsa:tst:20190975003" comment="Module container-tools:ol8 is enabled"/>
              <criteria operator="OR">
                <criteria operator="AND">
                  <criterion test_ref="oval:com.oracle.elsa:tst:20190975004" comment="buildah is earlier than 0:1.5-3.0.1.gite94b4f9.module+el8.0.0+5215+77f672ad"/>
                  <criterion test_ref="oval:com.oracle.elsa:tst:20190975005" comment="buildah is signed with the Oracle Linux 8 key"/>
                </criteria>
                <criteria operator="AND">
                  <criterion test_ref="oval:com.oracle.elsa:tst:20190975006" comment="container-selinux is earlier than 2:2.94-1.git1e99f1d.module+el8.0.0+5215+77f672ad"/>
                  <criterion test_ref="oval:com.oracle.elsa:tst:20190975007" comment="container-selinux is signed with the Oracle Linux 8 key"/>
                </criteria>
                <criteria operator="AND">

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

before

$ goval-dictionary fetch oracle 8
$ sqlite3 oval.sqlite3 "SELECT definitions.definition_id, packages.name, packages.version, packages.arch, packages.modularity_label FROM definitions JOIN packages ON packages.definition_id = definitions.id WHERE definitions.definition_id = 'oval:com.oracle.elsa:def:20190975';"
oval:com.oracle.elsa:def:20190975|buildah|0:1.5-3.0.1.gite94b4f9.module+el8.0.0+5215+77f672ad|aarch64|
oval:com.oracle.elsa:def:20190975|container-selinux|2:2.94-1.git1e99f1d.module+el8.0.0+5215+77f672ad|aarch64|
oval:com.oracle.elsa:def:20190975|containernetworking-plugins|0:0.7.4-3.git9ebe139.module+el8.0.0+5215+77f672ad|aarch64|
oval:com.oracle.elsa:def:20190975|containers-common|1:0.1.32-3.0.2.git1715c90.module+el8.0.0+5215+77f672ad|aarch64|
oval:com.oracle.elsa:def:20190975|fuse-overlayfs|0:0.3-2.module+el8.0.0+5215+77f672ad|aarch64|
oval:com.oracle.elsa:def:20190975|oci-systemd-hook|1:0.1.15-2.git2d0b8a3.module+el8.0.0+5215+77f672ad|aarch64|
oval:com.oracle.elsa:def:20190975|oci-umount|2:2.3.4-2.git87f9237.module+el8.0.0+5215+77f672ad|aarch64|
oval:com.oracle.elsa:def:20190975|podman|0:1.0.0-2.0.1.git921f98f.module+el8.0.0+5215+77f672ad|aarch64|
oval:com.oracle.elsa:def:20190975|podman-docker|0:1.0.0-2.0.1.git921f98f.module+el8.0.0+5215+77f672ad|aarch64|
oval:com.oracle.elsa:def:20190975|runc|0:1.0.0-55.rc5.dev.git2abd837.module+el8.0.0+5215+77f672ad|aarch64|
oval:com.oracle.elsa:def:20190975|skopeo|1:0.1.32-3.0.2.git1715c90.module+el8.0.0+5215+77f672ad|aarch64|
oval:com.oracle.elsa:def:20190975|slirp4netns|0:0.1-2.dev.gitc4e1bc5.module+el8.0.0+5215+77f672ad|aarch64|
oval:com.oracle.elsa:def:20190975|buildah|0:1.5-3.0.1.gite94b4f9.module+el8.0.0+5215+77f672ad|x86_64|
oval:com.oracle.elsa:def:20190975|container-selinux|2:2.94-1.git1e99f1d.module+el8.0.0+5215+77f672ad|x86_64|
oval:com.oracle.elsa:def:20190975|containernetworking-plugins|0:0.7.4-3.git9ebe139.module+el8.0.0+5215+77f672ad|x86_64|
oval:com.oracle.elsa:def:20190975|containers-common|1:0.1.32-3.0.2.git1715c90.module+el8.0.0+5215+77f672ad|x86_64|
oval:com.oracle.elsa:def:20190975|fuse-overlayfs|0:0.3-2.module+el8.0.0+5215+77f672ad|x86_64|
oval:com.oracle.elsa:def:20190975|oci-systemd-hook|1:0.1.15-2.git2d0b8a3.module+el8.0.0+5215+77f672ad|x86_64|
oval:com.oracle.elsa:def:20190975|oci-umount|2:2.3.4-2.git87f9237.module+el8.0.0+5215+77f672ad|x86_64|
oval:com.oracle.elsa:def:20190975|podman|0:1.0.0-2.0.1.git921f98f.module+el8.0.0+5215+77f672ad|x86_64|
oval:com.oracle.elsa:def:20190975|podman-docker|0:1.0.0-2.0.1.git921f98f.module+el8.0.0+5215+77f672ad|x86_64|
oval:com.oracle.elsa:def:20190975|runc|0:1.0.0-55.rc5.dev.git2abd837.module+el8.0.0+5215+77f672ad|x86_64|
oval:com.oracle.elsa:def:20190975|skopeo|1:0.1.32-3.0.2.git1715c90.module+el8.0.0+5215+77f672ad|x86_64|
oval:com.oracle.elsa:def:20190975|slirp4netns|0:0.1-2.dev.gitc4e1bc5.module+el8.0.0+5215+77f672ad|x86_64|

after

$ goval-dictionary fetch oracle 8
$ sqlite3 oval.sqlite3 "SELECT definitions.definition_id, packages.name, packages.version, packages.arch, packages.modularity_label FROM definitions JOIN packages ON packages.definition_id = definitions.id WHERE definitions.definition_id = 'oval:com.oracle.elsa:def:20190975';"
oval:com.oracle.elsa:def:20190975|buildah|0:1.5-3.0.1.gite94b4f9.module+el8.0.0+5215+77f672ad|aarch64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|container-selinux|2:2.94-1.git1e99f1d.module+el8.0.0+5215+77f672ad|aarch64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|containernetworking-plugins|0:0.7.4-3.git9ebe139.module+el8.0.0+5215+77f672ad|aarch64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|containers-common|1:0.1.32-3.0.2.git1715c90.module+el8.0.0+5215+77f672ad|aarch64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|fuse-overlayfs|0:0.3-2.module+el8.0.0+5215+77f672ad|aarch64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|oci-systemd-hook|1:0.1.15-2.git2d0b8a3.module+el8.0.0+5215+77f672ad|aarch64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|oci-umount|2:2.3.4-2.git87f9237.module+el8.0.0+5215+77f672ad|aarch64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|podman|0:1.0.0-2.0.1.git921f98f.module+el8.0.0+5215+77f672ad|aarch64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|podman-docker|0:1.0.0-2.0.1.git921f98f.module+el8.0.0+5215+77f672ad|aarch64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|runc|0:1.0.0-55.rc5.dev.git2abd837.module+el8.0.0+5215+77f672ad|aarch64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|skopeo|1:0.1.32-3.0.2.git1715c90.module+el8.0.0+5215+77f672ad|aarch64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|slirp4netns|0:0.1-2.dev.gitc4e1bc5.module+el8.0.0+5215+77f672ad|aarch64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|buildah|0:1.5-3.0.1.gite94b4f9.module+el8.0.0+5215+77f672ad|x86_64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|container-selinux|2:2.94-1.git1e99f1d.module+el8.0.0+5215+77f672ad|x86_64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|containernetworking-plugins|0:0.7.4-3.git9ebe139.module+el8.0.0+5215+77f672ad|x86_64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|containers-common|1:0.1.32-3.0.2.git1715c90.module+el8.0.0+5215+77f672ad|x86_64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|fuse-overlayfs|0:0.3-2.module+el8.0.0+5215+77f672ad|x86_64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|oci-systemd-hook|1:0.1.15-2.git2d0b8a3.module+el8.0.0+5215+77f672ad|x86_64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|oci-umount|2:2.3.4-2.git87f9237.module+el8.0.0+5215+77f672ad|x86_64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|podman|0:1.0.0-2.0.1.git921f98f.module+el8.0.0+5215+77f672ad|x86_64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|podman-docker|0:1.0.0-2.0.1.git921f98f.module+el8.0.0+5215+77f672ad|x86_64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|runc|0:1.0.0-55.rc5.dev.git2abd837.module+el8.0.0+5215+77f672ad|x86_64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|skopeo|1:0.1.32-3.0.2.git1715c90.module+el8.0.0+5215+77f672ad|x86_64|container-tools:ol8
oval:com.oracle.elsa:def:20190975|slirp4netns|0:0.1-2.dev.gitc4e1bc5.module+el8.0.0+5215+77f672ad|x86_64|container-tools:ol8

Checklist:

You don't have to satisfy all of the following.

  • Write tests
  • Write documentation
  • Check that there aren't other open pull requests for the same issue/feature
  • Format your source code by make fmt
  • Pass the test by make test
  • Provide verification config / commands
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES

Reference

@MaineK00n MaineK00n self-assigned this Jun 17, 2024
@MaineK00n MaineK00n force-pushed the MaineK00n/oracle-modular branch from ba6aaad to 992bf90 Compare June 17, 2024 08:42
@MaineK00n MaineK00n marked this pull request as ready for review June 17, 2024 08:42
@MaineK00n MaineK00n requested a review from shino June 17, 2024 08:43
@MaineK00n
Copy link
Collaborator Author

MaineK00n commented Jun 17, 2024

Vuls Difference on Oracle Linux 8

setup

[root@e86b66e1d6e0 ~]# cat /etc/os-release 
NAME="Oracle Linux Server"
VERSION="8.10"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="8.10"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Oracle Linux Server 8.10"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:8:10:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://github.com/oracle/oracle-linux"

ORACLE_BUGZILLA_PRODUCT="Oracle Linux 8"
ORACLE_BUGZILLA_PRODUCT_VERSION=8.10
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=8.10
[root@e86b66e1d6e0 ~]# dnf module install -y container-tools:ol8:8040020210727075255:81945453:x86_64
[root@e86b66e1d6e0 ~]# rpm -qa --queryformat "%{NAME} %{EPOCHNUM} %{VERSION} %{RELEASE} %{ARCH} %{MODULARITYLABEL}\n" | grep module+el
crun 0 0.20.1 1.module+el8.4.0+20289+730b73cc x86_64 container-tools:ol8:8040020210727075255:81945453
libslirp 0 4.3.1 1.module+el8.4.0+20289+730b73cc x86_64 container-tools:ol8:8040020210727075255:81945453
runc 0 1.0.0 74.rc95.module+el8.4.0+20289+730b73cc x86_64 container-tools:ol8:8040020210727075255:81945453
conmon 2 2.0.29 1.module+el8.4.0+20289+730b73cc x86_64 container-tools:ol8:8040020210727075255:81945453
containers-common 1 1.3.1 5.0.1.module+el8.4.0+20289+730b73cc x86_64 container-tools:ol8:8040020210727075255:81945453
container-selinux 2 2.164.1 1.module+el8.4.0+20289+730b73cc noarch container-tools:ol8:8040020210727075255:81945453
podman 0 3.2.3 0.10.0.1.module+el8.4.0+20289+730b73cc x86_64 container-tools:ol8:8040020210727075255:81945453
buildah 0 1.21.4 1.0.1.module+el8.4.0+20289+730b73cc x86_64 container-tools:ol8:8040020210727075255:81945453
udica 0 0.2.4 2.module+el8.4.0+20289+730b73cc noarch container-tools:ol8:8040020210727075255:81945453
slirp4netns 0 1.1.8 1.module+el8.4.0+20289+730b73cc x86_64 container-tools:ol8:8040020210727075255:81945453
criu 0 3.15 1.module+el8.4.0+20289+730b73cc x86_64 container-tools:ol8:8040020210727075255:81945453
containernetworking-plugins 0 0.9.1 1.module+el8.4.0+20289+730b73cc x86_64 container-tools:ol8:8040020210727075255:81945453
python36 0 3.6.8 39.module+el8.10.0+90274+07ba55de x86_64 python36:3.6:8100020240410010355:5ae887d0
fuse-overlayfs 0 1.6 1.module+el8.4.0+20289+730b73cc x86_64 container-tools:ol8:8040020210727075255:81945453
podman-catatonit 0 3.2.3 0.10.0.1.module+el8.4.0+20289+730b73cc x86_64 container-tools:ol8:8040020210727075255:81945453
cockpit-podman 0 32 2.module+el8.4.0+20289+730b73cc noarch container-tools:ol8:8040020210727075255:81945453
skopeo 1 1.3.1 5.0.1.module+el8.4.0+20289+730b73cc x86_64 container-tools:ol8:8040020210727075255:81945453
$ vuls scan
$ cat results/2024-06-18T02-10-23+0900/docker.json | jq -r '.packages.runc'
{
  "name": "runc",
  "version": "1.0.0",
  "release": "74.rc95.module+el8.4.0+20289+730b73cc",
  "newVersion": "1:1.1.9",
  "newRelease": "1.module+el8.9.0+90102+5a5b2dad",
  "arch": "x86_64",
  "repository": "ol8_appstream",
  "modularitylabel": "container-tools:ol8:8040020210727075255:81945453"
}

old OVAL DB

$ vuls report --refresh-cve
$ cat results/2024-06-18T02-10-23+0900/docker.json | jq -r '.scannedCves."CVE-2021-34558"'
(empty)

new OVAL DB

$ vuls report --refresh-cve
$ cat results/2024-06-18T02-10-23+0900/docker.json | jq -r '.scannedCves."CVE-2021-34558"'
{
  "cveID": "CVE-2021-34558",
  "confidences": [
    {
      "score": 100,
      "detectionMethod": "OvalMatch"
    }
  ],
  "affectedPackages": [
    {
      "name": "buildah",
      "fixedIn": "2:1.33.6-2.module+el8.10.0+90298+77a9814d"
    },
    {
      "name": "conmon",
      "fixedIn": "3:2.1.10-1.module+el8.10.0+90298+77a9814d"
    },
    {
      "name": "containernetworking-plugins",
      "fixedIn": "1:1.4.0-2.module+el8.10.0+90298+77a9814d"
    },
    {
      "name": "containers-common",
      "fixedIn": "2:1-81.0.1.module+el8.10.0+90298+77a9814d"
    },
    {
      "name": "criu",
      "fixedIn": "0:3.18-4.module+el8.9.0+90147+a4870853"
    },
    {
      "name": "crun",
      "fixedIn": "0:1.14.3-2.module+el8.10.0+90298+77a9814d"
    },
    {
      "name": "fuse-overlayfs",
      "fixedIn": "0:1.13-1.module+el8.10.0+90298+77a9814d"
    },
    {
      "name": "libslirp",
      "fixedIn": "0:4.4.0-1.module+el8.9.0+90147+a4870853"
    },
    {
      "name": "podman",
      "fixedIn": "3:4.9.4-0.1.module+el8.10.0+90298+77a9814d"
    },
    {
      "name": "podman-catatonit",
      "fixedIn": "3:4.9.4-0.1.module+el8.10.0+90298+77a9814d"
    },
    {
      "name": "runc",
      "fixedIn": "1:1.1.12-1.module+el8.10.0+90298+77a9814d"
    },
    {
      "name": "skopeo",
      "fixedIn": "2:1.14.3-0.1.module+el8.10.0+90298+77a9814d"
    },
    {
      "name": "slirp4netns",
      "fixedIn": "0:1.2.3-1.module+el8.10.0+90298+77a9814d"
    }
  ],
  "distroAdvisories": [
    {
      "advisoryID": "ELSA-2024-2988",
      "severity": "MODERATE",
      "issued": "1000-01-01T00:00:00Z",
      "updated": "1000-01-01T00:00:00Z",
      "description": ""
    }
  ],
...

Copy link
Contributor

@shino shino left a comment

Choose a reason for hiding this comment

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

Test cases are easy to understand! GREAT!

@MaineK00n MaineK00n merged commit 86ee796 into master Jun 18, 2024
13 checks passed
@MaineK00n MaineK00n deleted the MaineK00n/oracle-modular branch June 18, 2024 07:16
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.

2 participants