Skip to content

enable gosec #969

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 4 commits into from
Oct 19, 2022
Merged

enable gosec #969

merged 4 commits into from
Oct 19, 2022

Conversation

kim-tsao
Copy link
Contributor

Signed-off-by: Kim Tsao [email protected]

What does this PR do?:

enables the gosec scanner and addresses any high sev findings

Which issue(s) this PR fixes:

#937

PR acceptance criteria:

Testing and documentation do not need to be complete in order for this PR to be approved. We just need to ensure tracking issues are opened.

  • Open new test/doc issues under the devfile/api repo
  • Check each criteria if:
  • There is a separate tracking issue. Add the issue link under the criteria
    or
  • test/doc updates are made as part of this PR
  • If unchecked, explain why it's not needed

How to test changes / Special notes to the reviewer:

Signed-off-by: Kim Tsao <[email protected]>
@codecov
Copy link

codecov bot commented Oct 18, 2022

Codecov Report

Base: 35.51% // Head: 35.63% // Increases project coverage by +0.11% 🎉

Coverage data is based on head (5e29da5) compared to base (fe7c10e).
Patch coverage: 80.95% of modified lines in pull request are covered.

❗ Current head 5e29da5 differs from pull request most recent head 52b968a. Consider uploading reports for the commit 52b968a to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #969      +/-   ##
==========================================
+ Coverage   35.51%   35.63%   +0.11%     
==========================================
  Files          52       52              
  Lines        6653     6671      +18     
==========================================
+ Hits         2363     2377      +14     
- Misses       4145     4149       +4     
  Partials      145      145              
Impacted Files Coverage Δ
...workspaces/v1alpha1/component_plugin_conversion.go 19.14% <0.00%> (-0.56%) ⬇️
pkg/apis/workspaces/v1alpha1/conversion.go 74.28% <100.00%> (+1.55%) ⬆️
pkg/apis/workspaces/v1alpha1/parent_conversion.go 56.22% <100.00%> (+1.15%) ⬆️
...g/apis/workspaces/v1alpha1/union_implementation.go 61.84% <100.00%> (ø)
...g/apis/workspaces/v1alpha2/union_implementation.go 43.42% <100.00%> (ø)
pkg/utils/unions/normalize.go 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Signed-off-by: Kim Tsao <[email protected]>
Signed-off-by: Kim Tsao <[email protected]>
@kim-tsao kim-tsao marked this pull request as ready for review October 18, 2022 16:36
@@ -27,6 +27,7 @@ func convertPluginComponentTo_v1alpha2(srcComponent *Component, destComponent *v
destComponent.Name = pluginKey

for _, srcCommand := range src.Commands {
srcCommand := srcCommand
Copy link
Contributor

Choose a reason for hiding this comment

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

This line appears to be a no-op?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it ensures the address is not reused. It's one of the approaches you can use to fix this issue (the other is to use an index) according to this discussion: https://stackoverflow.com/questions/62446118/implicit-memory-aliasing-in-for-loop.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah makes sense, I didn't realize we used &srcCommand below.

run_gosec.sh Outdated
echo "error gosec must be installed with this command: go install github.com/securego/gosec/v2/cmd/gosec@latest" && exit 1
fi

gosec -no-fail -fmt=sarif -out=gosec.sarif -exclude-dir test -exclude-dir generator ./...
Copy link
Contributor

Choose a reason for hiding this comment

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

Trailling newline missing.

Signed-off-by: Kim Tsao <[email protected]>
@openshift-ci
Copy link

openshift-ci bot commented Oct 19, 2022

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: amisevsk, kim-tsao

The full list of commands accepted by this bot can be found 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

@kim-tsao kim-tsao merged commit 0d16344 into devfile:main Oct 19, 2022
yangcao77 added a commit that referenced this pull request Oct 11, 2023
* 2.2.0 release cut

Signed-off-by: Stephanie <[email protected]>

* enable gosec (#969)

* enable gosec

Signed-off-by: Kim Tsao <[email protected]>

* Fix G601 errors

Signed-off-by: Kim Tsao <[email protected]>

* Fix warnings

Signed-off-by: Kim Tsao <[email protected]>

* Add newline

Signed-off-by: Kim Tsao <[email protected]>

Signed-off-by: Kim Tsao <[email protected]>

* Update the devfile spec to 2.2.1 alpha (#980)

Signed-off-by: Paul Schultz <[email protected]>

* Bump kubernetes-client/gen revision to fix git dubious ownership error (#1045)

* bump kubernetes-client/gen revision to fix git dubious ownership error

Signed-off-by: Michael Valdron <[email protected]>

* whitespace changes.

Signed-off-by: Michael Valdron <[email protected]>

* set openapi generator ref to version which supports typescript generation.

Signed-off-by: Michael Valdron <[email protected]>

---------

Signed-off-by: Michael Valdron <[email protected]>

* Fix Dependabot issues (#1047)

* fix dependabot issues, requires a bump in k8s versions

Signed-off-by: Kim Tsao <[email protected]>

* re-generated devworkspace files

Signed-off-by: Kim Tsao <[email protected]>

* Vendor updates

Signed-off-by: Kim Tsao <[email protected]>

---------

Signed-off-by: Kim Tsao <[email protected]>

* fix gosec v2.14.0 (#1034)

Signed-off-by: Michael Valdron <[email protected]>

* Update python runtime version for `release-typescript-models` job (#1051)

* bump python runtime version for 'release-typescript-models' job.

Signed-off-by: Michael Valdron <[email protected]>

* bump setup-python action to v4 for 'release-typescript-models' job.

Signed-off-by: Michael Valdron <[email protected]>

---------

Signed-off-by: Michael Valdron <[email protected]>

* Add workflow for managing stale issues & PRs (#1055)

Adds a GitHub workflow for managing stale & rotten issues and PRs. 

Issues & PRs are marked stale after 90 days of inactivity. After 60 further days, they are marked as rotten and closed.

* Clarify hotReloadCapable field (#1091)

* Clarify hotReloadCapable field

Signed-off-by: Philippe Martin <[email protected]>

* Auto-generated

Signed-off-by: Philippe Martin <[email protected]>

* Specify isDefault

Signed-off-by: Philippe Martin <[email protected]>

* Clarify description

Signed-off-by: Philippe Martin <[email protected]>

---------

Signed-off-by: Philippe Martin <[email protected]>

* update kubernetes/openshift endpoint validation (#1098)

* update endpoint validation

Signed-off-by: Stephanie <[email protected]>

* update unit test

Signed-off-by: Stephanie <[email protected]>

* update the test error check to be more clear

Signed-off-by: Stephanie <[email protected]>

* add unit test for two kube components

Signed-off-by: Stephanie <[email protected]>

---------

Signed-off-by: Stephanie <[email protected]>

* Update release doc (#1110)

Signed-off-by: Kim Tsao <[email protected]>

* Update directly executed scripts inside workflows (#1107)

* Update directly executed scripts on workflows

Signed-off-by: thepetk <[email protected]>

* Update directly executed scripts on bash scripts

Signed-off-by: thepetk <[email protected]>

---------

Signed-off-by: thepetk <[email protected]>

* Add area alizer label to all issue templates (#1149)

Signed-off-by: thepetk <[email protected]>

* Update deprecated github actions to latest version (#1231)

* Update deprecated github actions

Signed-off-by: thepetk <[email protected]>

* Remove jsonschema dep from validate samples

Signed-off-by: thepetk <[email protected]>

---------

Signed-off-by: thepetk <[email protected]>

* Add license header file and script (#1256)

* add license header file

Signed-off-by: Michael Valdron <[email protected]>

* addlicense script

Signed-off-by: Michael Valdron <[email protected]>

* update README with instructions on adding license headers

Signed-off-by: Michael Valdron <[email protected]>

* update license headers under source files

Signed-off-by: Michael Valdron <[email protected]>

* remove license header from generated source

Signed-off-by: Michael Valdron <[email protected]>

* add_license.sh ignores zz_generated.* source files

Signed-off-by: Michael Valdron <[email protected]>

* check license headers script added

Signed-off-by: Michael Valdron <[email protected]>

* check license headers script added to CI workflow

Signed-off-by: Michael Valdron <[email protected]>

---------

Signed-off-by: Michael Valdron <[email protected]>

* add signoff

Signed-off-by: Stephanie <[email protected]>

---------

Signed-off-by: Stephanie <[email protected]>
Signed-off-by: Kim Tsao <[email protected]>
Signed-off-by: Paul Schultz <[email protected]>
Signed-off-by: Michael Valdron <[email protected]>
Signed-off-by: Philippe Martin <[email protected]>
Signed-off-by: thepetk <[email protected]>
Co-authored-by: Kim Tsao <[email protected]>
Co-authored-by: Paul Schultz <[email protected]>
Co-authored-by: Michael Valdron <[email protected]>
Co-authored-by: Michael Valdron <[email protected]>
Co-authored-by: John Collier <[email protected]>
Co-authored-by: Philippe Martin <[email protected]>
Co-authored-by: Theofanis Petkos <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants