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

[REQ] add guardrails for parsing OS version #438

Open
1 task done
sozercan opened this issue Dec 8, 2023 · 6 comments · May be fixed by #619
Open
1 task done

[REQ] add guardrails for parsing OS version #438

sozercan opened this issue Dec 8, 2023 · 6 comments · May be fixed by #619
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@sozercan
Copy link
Member

sozercan commented Dec 8, 2023

What kind of request is this?

Improvement of existing experience

What is your request or suggestion?

For example, for ubuntu if a scanner return X.Y.Z, copa tries to pull in the ubuntu:X.Y.Z image which doesn't exist

related to #437

Are you willing to submit PRs to contribute to this feature request?

  • Yes, I am willing to implement it.
@h4l0gen
Copy link

h4l0gen commented May 10, 2024

Hii @sozercan I am interested in this issue. Can you assign it to me.
Also Can you explain me what we actually want through this. Do we need to throw error as per this for ubuntu if a scanner return X.Y.Z, copa tries to pull in the ubuntu:X.Y.Z image which doesn't exist that image doesn't exist or check availability of the Docker image corresponding to the reported OS version before attempting to pull it

@h4l0gen
Copy link

h4l0gen commented May 10, 2024

On first looking, I got this idea
We can change like this

   case strings.Contains(osType, "ubuntu"):
        // For Ubuntu, extract the major and minor version (e.g., 22.04)
        versionParts := strings.Split(osVersion, ".")
        if len(versionParts) >= 2 {
            osVersion = strings.Join(versionParts[:2], ".")
        } else {
            return "", "", fmt.Errorf("invalid Ubuntu version format: %s", osVersion)
        }
        return "ubuntu", osVersion, nil

here. By defining osVersion := osData["VERSION_ID"] in getOSType function. This can easily remove this issue. WDYT @sozercan @ashnamehrotra

@h4l0gen
Copy link

h4l0gen commented May 10, 2024

Most of work on this issue with this approach is complete, If you all agree then i would like to raise a PR.

@ashnamehrotra
Copy link
Contributor

Hi @h4l0gen, that sounds good. We recently merged a getOSVersion() function in #570, which can be used here.

@h4l0gen
Copy link

h4l0gen commented May 11, 2024

/assign

@h4l0gen h4l0gen linked a pull request May 11, 2024 that will close this issue
@h4l0gen
Copy link

h4l0gen commented May 12, 2024

Hii @ashnamehrotra I have used getOSVersion() function as you suggested and raised a PR, PTAL whenever you find time :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Status: 📋 Backlog
Development

Successfully merging a pull request may close this issue.

3 participants