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

Fix G402 reports with latest gosec version #1416

Merged
merged 1 commit into from
Nov 6, 2023

Conversation

HeavyWombat
Copy link
Contributor

@HeavyWombat HeavyWombat commented Oct 23, 2023

Changes

Ref: securego/gosec#1044 (comment)

Break up transport setup so that the InsecureSkipVerify is a single line, so that their latest changes can find the ignore statement at the exact statement level to be properly ignored.

Refactor test code to only have the test client setup once.

Submitter Checklist

  • Includes tests if functionality changed/was added
  • Includes docs if changes are user-facing
  • Set a kind label on this PR
  • Release notes block has been filled in, or marked NONE

See the contributor guide
for details on coding conventions, github and prow interactions, and the code review process.

Release Notes

NONE

@openshift-ci openshift-ci bot added the release-note-none Label for when a PR does not need a release note label Oct 23, 2023
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 23, 2023
@@ -52,18 +52,10 @@ func GetOptions(ctx context.Context, imageName name.Reference, insecure bool, do
options = append(options, remote.WithContext(ctx))

transport := http.DefaultTransport.(*http.Transport).Clone()
transport.TLSClientConfig = &tls.Config{MinVersion: tls.VersionTLS12}
Copy link
Member

@SaschaSchwarze0 SaschaSchwarze0 Oct 26, 2023

Choose a reason for hiding this comment

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

With insecure set to true, we in the past also did not set a MinVersion. Not sure if we want to change this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My rational was that with insure, the min version should not matter. But that was a hunch. I can also rewrite it to be more like the previous style.

Copy link
Member

Choose a reason for hiding this comment

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

Hm, just notice that we forgot to even document the spec.output.insecure field in both Build and BuildRun. :-( And in the proposal we have not defined it in details (but wrote that it should be documented :-) ).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is sadly no other way to write that without getting yet another gosec issue.

Ref: securego/gosec#1044 (comment)

Break up transport setup so that the `InsecureSkipVerify` is a single line, so
that their latest changes can find the ignore statement at the exact statement
level to be properly ignored.

Refactor test code to only have the test client setup once.
Copy link
Member

@SaschaSchwarze0 SaschaSchwarze0 left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 26, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 26, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: SaschaSchwarze0

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 openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 26, 2023
@SaschaSchwarze0 SaschaSchwarze0 added this to the release-v0.13.0 milestone Oct 26, 2023
@qu1queee qu1queee removed their request for review October 26, 2023 18:33
@openshift-merge-bot openshift-merge-bot bot merged commit a97c2ba into main Nov 6, 2023
14 checks passed
@openshift-merge-bot openshift-merge-bot bot deleted the fix/gosec-issue branch November 6, 2023 09:44
@HeavyWombat
Copy link
Contributor Author

Wasn't working due to Heroku. Thanks to @SaschaSchwarze0 for shipwright-io/sample-nodejs#11.

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. release-note-none Label for when a PR does not need a release note size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants