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

Introduce gosec for security checks #2506

Merged
merged 1 commit into from Oct 29, 2019

Conversation

JAORMX
Copy link
Contributor

@JAORMX JAORMX commented Oct 13, 2019

gosec does static code analysis and checks for common security issues in
golang codebases.

This PR introduces a script that will run gosec similarly to other check
tools.

@openshift-ci-robot openshift-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Oct 13, 2019
@JAORMX
Copy link
Contributor Author

JAORMX commented Oct 14, 2019

/test e2e-aws-scaleup-rhel7

1 similar comment
@JAORMX
Copy link
Contributor Author

JAORMX commented Oct 14, 2019

/test e2e-aws-scaleup-rhel7

@abhinavdahiya abhinavdahiya requested review from abhinavdahiya and removed request for jhixson74 and mtnbikenc October 14, 2019 13:22
@abhinavdahiya
Copy link
Contributor

Do you have an example of what kind of security flaws does this script highlight on this repo's master.

I would like top avoid yet another comment to skip the test, if there are toomany false positives with this for installer repo as installer deals with files etc.

And if there is an effort to bring this check in all OpenShift repos, i would expect this to be backed by an enhancement.

gosec does static code analysis and checks for common security issues in
golang codebases.

This PR introduces a script that will run gosec similarly to other check
tools.
@JAORMX
Copy link
Contributor Author

JAORMX commented Oct 21, 2019

Do you have an example of what kind of security flaws does this script highlight on this repo's master.

I switched the configuration to only highlight critical security flaws with high confidence (as opposed to the previous attempt, which was medium flaws with medium confidence). With this configuration, the tool doesn't find any issues in the codebase (which is good!).

Here's the output:

hack/go-sec.sh                                                                                                                                                              add-gosec  
+ '[' '' '!=' '' ']'
+ podman run --rm --env IS_CONTAINER=TRUE --volume /home/josorior/go/src/github.com/openshift/installer:/go/src/github.com/openshift/installer:z --workdir /go/src/github.com/openshift/installer docker.io/openshift/origin-release:golang-1.12 ./hack/go-sec.sh
+ '[' TRUE '!=' '' ']'
++ command -v gosec
+ '[' '!' '' ']'
+ go get github.com/securego/gosec/cmd/gosec
+ gosec -severity high -confidence high -exclude G304 ./cmd/... ./data/... ./pkg/...
[gosec] 2019/10/21 09:56:14 Including rules: default
[gosec] 2019/10/21 09:56:14 Excluding rules: G304
[gosec] 2019/10/21 09:56:14 Import directory: /go/src/github.com/openshift/installer/cmd/openshift-install
[gosec] 2019/10/21 09:58:40 Checking package: main
[gosec] 2019/10/21 09:58:40 Checking file: /go/src/github.com/openshift/installer/cmd/openshift-install/completions.go
[gosec] 2019/10/21 09:58:40 Checking file: /go/src/github.com/openshift/installer/cmd/openshift-install/create.go
...
Results:


Summary:
   Files: 301
   Lines: 27020
   Nosec: 0
  Issues: 0

I would like top avoid yet another comment to skip the test, if there are toomany false positives with this for installer repo as installer deals with files etc.

And if there is an effort to bring this check in all OpenShift repos, i would expect this to be backed by an enhancement.

There is no PR in the enhancements repo as of yet.

@JAORMX
Copy link
Contributor Author

JAORMX commented Oct 21, 2019

/test e2e-aws-scaleup-rhel7-

@abhinavdahiya
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 28, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abhinavdahiya, JAORMX

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 28, 2019
@JAORMX
Copy link
Contributor Author

JAORMX commented Oct 28, 2019

/test e2e-aws-scaleup-rhel7

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Oct 29, 2019

@JAORMX: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/prow/e2e-aws-scaleup-rhel7 0a854cd link /test e2e-aws-scaleup-rhel7

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot merged commit a9d7335 into openshift:master Oct 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants