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

Add advanced security tests for docker scan. #27

Closed
wants to merge 1 commit into from

Conversation

gailazar300
Copy link
Contributor

  • The pull request is targeting the dev branch.
  • The code has been validated to compile successfully by running go vet ./....
  • The code has been formatted properly using go fmt ./....
  • All static analysis checks passed.
  • All tests have passed. If this feature is not already covered by the tests, new tests have been added.
  • All changes are detailed at the description. if not already covered at JFrog Documentation, new documentation have been added.

@attiasas attiasas added ignore for release Automatically generated release notes safe to test Approve running integration tests on a pull request labels Feb 25, 2024
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Feb 25, 2024
Copy link
Contributor

@attiasas attiasas left a comment

Choose a reason for hiding this comment

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

Can you merge this PR with #10 ? this PR can't pass tests without the new ability, it should be at the same PR

Comment on lines +245 to +260
func runAdvancedSecurityDockerScan(t *testing.T, imageName string) {
// Pull image from docker repo
imageTag := path.Join(*securityTests.ContainerRegistry, securityTests.DockerVirtualRepo, imageName)
dockerPullCommand := container.NewPullCommand(containerUtils.DockerClient)
dockerPullCommand.SetCmdParams([]string{"pull", imageTag}).SetImageTag(imageTag).SetRepo(securityTests.DockerVirtualRepo).SetServerDetails(securityTests.XrDetails).SetBuildConfiguration(new(build.BuildConfiguration))
if assert.NoError(t, dockerPullCommand.Run()) {
defer commonTests.DeleteTestImage(t, imageTag, containerUtils.DockerClient)
args := []string{"docker", "scan", imageTag, "--server-id=default", "--format=simple-json", "--fail=false", "--min-severity=low", "--fixable-only"}

// Run docker scan on image
output := securityTests.PlatformCli.WithoutCredentials().RunCliCmdWithOutput(t, args...)
if assert.NotEmpty(t, output) {
verifyAdvancedSecurityScanResults(t, output)
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You already have runDockerScan please modify it to fit your changes.
You can pass the verification method func to it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ignore for release Automatically generated release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants