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

remove backticks and LDFLAG variable name to fix vulnerability #1190

Closed
wants to merge 3 commits into from

Conversation

nikita-bhatia
Copy link
Contributor

Following changes are for vulnerability fixes CVE-2023-24538 , CVE-2023-29404, CVE-2023-29405

  1. Removed few backticks (“” -chars) and replaced with "or'`

  2. Re the usage of LDFLAGS variable (we use it as a regular variable in a Makefile, no special meaning, since we’re not compiling any C/C++ code as a part of operator)

Note : Testing still needs to be done

Copy link
Collaborator

@zoxpx zoxpx left a comment

Choose a reason for hiding this comment

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

This looks OK -- thanks Nikita.

Please remember to update that .travis.yml -script

.travis.yml Outdated Show resolved Hide resolved
@@ -51,7 +51,7 @@ const (
)

var (
kbVerRegex = regexp.MustCompile(`^(v\d+\.\d+\.\d+)(.*)`)
kbVerRegex = regexp.MustCompile("^(v\\d+\\.\\d+\\.\\d+)(.*)")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good that you caught it. 👍

@zoxpx
Copy link
Collaborator

zoxpx commented Aug 8, 2023

LOL -- this is too funny -- now the Travis and staticcheck are asking to return the "the executable-backticks" back:

go run github.com/golangci/golangci-lint/cmd/golangci-lint run --timeout=5m ./...
pkg/util/test/util.go:490:13: S1007: should use raw string (`...`) with regexp.MustCompile to avoid having to escape twice (gosimple)
					ver := regexp.MustCompile("\\S+\\/(\\d.\\S+)\\/version").FindStringSubmatch(env.Value)
					       ^
pkg/migration/generate.go:1189:20: S1007: should use raw string (`...`) with regexp.MustCompile to avoid having to escape twice (gosimple)
	validNameRegex := regexp.MustCompile("^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$")
	                  ^
pkg/util/util.go:100:25: S1007: should use raw string (`...`) with regexp.MustCompile to avoid having to escape twice (gosimple)
	hostnameWithDomainRe = regexp.MustCompile("^(?i)[a-z0-9-]+(\\.[a-z0-9-]+)+\\.?$")
	                       ^

We'll probably need to add //lint:ignore S1007 to skip these 3 occurrences of the complaint.

@zoxpx
Copy link
Collaborator

zoxpx commented Aug 9, 2023

Looking good -- but, you might need to rebase the PR, to make the Travis happy...

@nikita-bhatia
Copy link
Contributor Author

Looking good -- but, you might need to rebase the PR, to make the Travis happy...

Travis is still failing because of same issue , after adding lint:ignore, staticcheck looks fine but lint is still complaining about same issue

 S1007: should use raw string (`...`) with regexp.MustCompile to avoid having to escape twice (gosimple)
					ver := regexp.MustCompile("\\S+\\/(\\d.\\S+)\\/version").FindStringSubmatch(env.Value) //lint:ignore S1007 we want to remove backticks to avoid vulnerability 

@github-actions
Copy link

This PR is stale because it has been in review for 3 days with no activity.

Copy link

This PR is stale because it has been open for 90 days with no activity. Update this PR or it will be automatically closed in 30 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants