-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce make targets for sast and address security issues. (#134)
* Introduce make targets for sast and address security issues. * Add license-headers and update go lang version to 1.23.3.
- Loading branch information
Showing
20 changed files
with
138 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,6 @@ kubectl | |
yq_linux* | ||
main | ||
cmi-plugin | ||
|
||
# gosec | ||
gosec-report.sarif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v0.54.0 | ||
v0.55.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set -e | ||
|
||
echo "> Adding Apache License header to all go files where it is not present" | ||
|
||
YEAR=$1 | ||
if [[ -z "$1" ]]; then | ||
cat << EOF | ||
Unspecified 'YEAR' argument. | ||
Usage: add_licence_headers.sh <YEAR> | ||
EOF | ||
exit 1 | ||
fi | ||
|
||
temp_file=$(mktemp) | ||
trap "rm -f $temp_file" EXIT | ||
sed "s/{YEAR}/${YEAR}/g" hack/license_boilerplate.txt > $temp_file | ||
|
||
# Uses the tool https://github.com/google/addlicense | ||
addlicense \ | ||
-f $temp_file \ | ||
-ignore ".idea/**" \ | ||
-ignore ".vscode/**" \ | ||
-ignore "**/*.md" \ | ||
-ignore "**/*.yaml" \ | ||
-ignore "**/Dockerfile" \ | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
SPDX-FileCopyrightText: {YEAR} SAP SE or an SAP affiliate company and Gardener contributors | ||
|
||
SPDX-License-Identifier: Apache-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set -e | ||
|
||
root_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd )" | ||
gosec_report="false" | ||
gosec_report_parse_flags="" | ||
|
||
parse_flags() { | ||
while test $# -gt 1; do | ||
case "$1" in | ||
--gosec-report) | ||
shift; gosec_report="$1" | ||
;; | ||
*) | ||
echo "Unknown argument: $1" | ||
exit 1 | ||
;; | ||
esac | ||
shift | ||
done | ||
} | ||
|
||
parse_flags "$@" | ||
|
||
echo "> Running gosec" | ||
gosec --version | ||
if [[ "$gosec_report" != "false" ]]; then | ||
echo "Exporting report to $root_dir/gosec-report.sarif" | ||
gosec_report_parse_flags="-track-suppressions -fmt=sarif -out=gosec-report.sarif -stdout" | ||
fi | ||
|
||
# MCM uses code-generators https://github.com/kubernetes/code-generator which create lots of G103 (CWE-242: | ||
# Use of unsafe calls should be audited) & G104 (CWE-703: Errors unhandled) errors. | ||
# However, those generators are best-pratice in Kubernetes environment and their results are tested well. | ||
# Thus, generated code is excluded from gosec scan. | ||
# Nested go modules are not supported by gosec (see https://github.com/securego/gosec/issues/501), so the ./hack folder | ||
# is excluded too. It does not contain productive code anyway. | ||
gosec -exclude-generated -exclude-dir=hack $gosec_report_parse_flags ./... |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters