Skip to content

skip gosec linting for now #134

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

Merged
merged 1 commit into from
Sep 6, 2018

Conversation

mengqiy
Copy link
Member

@mengqiy mengqiy commented Sep 6, 2018

gosec complains when we load from a file path which is a variable. Example error message:

pkg/envtest/crd.go:204::warning: Potential file inclusion via variable,MEDIUM,HIGH (gosec)

One possible way to make it work is ignoring this kind of error by running gosec as a custom linter and exclude G304 errors.

@mengqiy mengqiy requested a review from droot September 6, 2018 17:54
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 6, 2018
@@ -201,7 +201,7 @@ func readCRDs(path string) ([]*apiextensionsv1beta1.CustomResourceDefinition, er
}

// Unmarshal the file into a struct
b, err := ioutil.ReadFile(filepath.Join(path, file.Name()))
b, err := ioutil.ReadFile(filepath.Join(path, file.Name())) // nolint: gosec
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we configure the gosec linter to ignore these types or errors (or specific files) ? Annotating the source code to exclude is not right.

@mengqiy
Copy link
Member Author

mengqiy commented Sep 6, 2018

I have tried to follow the document about how to add an custom linter.
My plan was to run gosec by ourself and exclude G304 errors.
But I can't really make it work. It seems it doesn't parse the linter output correctly and eats the error messages that it should emit.
I disable it for now. And I will try to fix it next week when get more time :)

@DirectXMan12
Copy link
Contributor

Can you write a PR description about why you're doing this, for posterity?

@mengqiy mengqiy changed the title skip gosec linting for a few lines skip gosec linting for now Sep 6, 2018
@droot droot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Sep 6, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by: mengqiy

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

@k8s-ci-robot k8s-ci-robot merged commit 2d4d049 into kubernetes-sigs:master Sep 6, 2018
@mengqiy mengqiy deleted the skip_linting branch September 14, 2018 20:41
justinsb pushed a commit to justinsb/controller-runtime that referenced this pull request Dec 7, 2018
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants