mirror of https://github.com/helm/helm
Signed-off-by: yzewei <141103849+yzewei@users.noreply.github.com>pull/12708/head
commit
37924eb21c
@ -1,14 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
# This file can be removed when Helm no longer uses CircleCI on any release
|
|
||||||
# branches. Once CircleCI is turned off this file can be removed.
|
|
||||||
version: 2
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
docker:
|
|
||||||
- image: cimg/go:1.18
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
|||||||
|
name: govulncheck
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- go.sum
|
||||||
|
schedule:
|
||||||
|
- cron: "0 0 * * *"
|
||||||
|
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
govulncheck:
|
||||||
|
name: govulncheck
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # pin@5.1.0
|
||||||
|
with:
|
||||||
|
go-version: '1.22'
|
||||||
|
check-latest: true
|
||||||
|
- name: govulncheck
|
||||||
|
uses: golang/govulncheck-action@b625fbe08f3bccbe446d94fbf87fcc875a4f50ee # pin@1.0.4
|
||||||
|
with:
|
||||||
|
go-package: ./...
|
@ -0,0 +1,69 @@
|
|||||||
|
name: Scorecard supply-chain security
|
||||||
|
on:
|
||||||
|
# For Branch-Protection check. Only the default branch is supported. See
|
||||||
|
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
|
||||||
|
branch_protection_rule:
|
||||||
|
# To guarantee Maintained check is occasionally updated. See
|
||||||
|
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
|
||||||
|
schedule:
|
||||||
|
- cron: '25 7 * * 0'
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
|
||||||
|
# Declare default permissions as read only.
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analysis:
|
||||||
|
name: Scorecard analysis
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
# Needed to upload the results to code-scanning dashboard.
|
||||||
|
security-events: write
|
||||||
|
# Needed to publish results and get a badge (see publish_results below).
|
||||||
|
id-token: write
|
||||||
|
# Uncomment the permissions below if installing in a private repository.
|
||||||
|
# contents: read
|
||||||
|
# actions: read
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: "Checkout code"
|
||||||
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: "Run analysis"
|
||||||
|
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
|
||||||
|
with:
|
||||||
|
results_file: results.sarif
|
||||||
|
results_format: sarif
|
||||||
|
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
|
||||||
|
# - you want to enable the Branch-Protection check on a *public* repository, or
|
||||||
|
# - you are installing Scorecard on a *private* repository
|
||||||
|
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional.
|
||||||
|
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
|
||||||
|
|
||||||
|
# Public repositories:
|
||||||
|
# - Publish results to OpenSSF REST API for easy access by consumers
|
||||||
|
# - Allows the repository to include the Scorecard badge.
|
||||||
|
# - See https://github.com/ossf/scorecard-action#publishing-results.
|
||||||
|
# For private repositories:
|
||||||
|
# - `publish_results` will always be set to `false`, regardless
|
||||||
|
# of the value entered here.
|
||||||
|
publish_results: true
|
||||||
|
|
||||||
|
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
||||||
|
# format to the repository Actions tab.
|
||||||
|
- name: "Upload artifact"
|
||||||
|
uses: actions/upload-artifact@c24449f33cd45d4826c6702db7e49f7cdb9b551d # v3.2.1-node20
|
||||||
|
with:
|
||||||
|
name: SARIF file
|
||||||
|
path: results.sarif
|
||||||
|
retention-days: 5
|
||||||
|
|
||||||
|
# Upload the results to GitHub's code scanning dashboard (optional).
|
||||||
|
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
|
||||||
|
- name: "Upload to code-scanning"
|
||||||
|
uses: github/codeql-action/upload-sarif@v3
|
||||||
|
with:
|
||||||
|
sarif_file: results.sarif
|
@ -1,58 +0,0 @@
|
|||||||
//go:build !windows
|
|
||||||
|
|
||||||
/*
|
|
||||||
Copyright The Helm Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"os"
|
|
||||||
"os/user"
|
|
||||||
"path/filepath"
|
|
||||||
)
|
|
||||||
|
|
||||||
func checkPerms() {
|
|
||||||
// This function MUST NOT FAIL, as it is just a check for a common permissions problem.
|
|
||||||
// If for some reason the function hits a stopping condition, it may panic. But only if
|
|
||||||
// we can be sure that it is panicking because Helm cannot proceed.
|
|
||||||
|
|
||||||
kc := settings.KubeConfig
|
|
||||||
if kc == "" {
|
|
||||||
kc = os.Getenv("KUBECONFIG")
|
|
||||||
}
|
|
||||||
if kc == "" {
|
|
||||||
u, err := user.Current()
|
|
||||||
if err != nil {
|
|
||||||
// No idea where to find KubeConfig, so return silently. Many helm commands
|
|
||||||
// can proceed happily without a KUBECONFIG, so this is not a fatal error.
|
|
||||||
return
|
|
||||||
}
|
|
||||||
kc = filepath.Join(u.HomeDir, ".kube", "config")
|
|
||||||
}
|
|
||||||
fi, err := os.Stat(kc)
|
|
||||||
if err != nil {
|
|
||||||
// DO NOT error if no KubeConfig is found. Not all commands require one.
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
perm := fi.Mode().Perm()
|
|
||||||
if perm&0040 > 0 {
|
|
||||||
warning("Kubernetes configuration file is group-readable. This is insecure. Location: %s", kc)
|
|
||||||
}
|
|
||||||
if perm&0004 > 0 {
|
|
||||||
warning("Kubernetes configuration file is world-readable. This is insecure. Location: %s", kc)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,82 +0,0 @@
|
|||||||
//go:build !windows
|
|
||||||
|
|
||||||
/*
|
|
||||||
Copyright The Helm Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"io"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func checkPermsStderr() (string, error) {
|
|
||||||
r, w, err := os.Pipe()
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
stderr := os.Stderr
|
|
||||||
os.Stderr = w
|
|
||||||
defer func() {
|
|
||||||
os.Stderr = stderr
|
|
||||||
}()
|
|
||||||
|
|
||||||
checkPerms()
|
|
||||||
w.Close()
|
|
||||||
|
|
||||||
var text bytes.Buffer
|
|
||||||
io.Copy(&text, r)
|
|
||||||
return text.String(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCheckPerms(t *testing.T) {
|
|
||||||
tdir := t.TempDir()
|
|
||||||
tfile := filepath.Join(tdir, "testconfig")
|
|
||||||
fh, err := os.OpenFile(tfile, os.O_CREATE|os.O_APPEND|os.O_RDWR, 0440)
|
|
||||||
if err != nil {
|
|
||||||
t.Errorf("Failed to create temp file: %s", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
tconfig := settings.KubeConfig
|
|
||||||
settings.KubeConfig = tfile
|
|
||||||
defer func() { settings.KubeConfig = tconfig }()
|
|
||||||
|
|
||||||
text, err := checkPermsStderr()
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("could not read from stderr: %s", err)
|
|
||||||
}
|
|
||||||
expectPrefix := "WARNING: Kubernetes configuration file is group-readable. This is insecure. Location:"
|
|
||||||
if !strings.HasPrefix(text, expectPrefix) {
|
|
||||||
t.Errorf("Expected to get a warning for group perms. Got %q", text)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := fh.Chmod(0404); err != nil {
|
|
||||||
t.Errorf("Could not change mode on file: %s", err)
|
|
||||||
}
|
|
||||||
text, err = checkPermsStderr()
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("could not read from stderr: %s", err)
|
|
||||||
}
|
|
||||||
expectPrefix = "WARNING: Kubernetes configuration file is world-readable. This is insecure. Location:"
|
|
||||||
if !strings.HasPrefix(text, expectPrefix) {
|
|
||||||
t.Errorf("Expected to get a warning for world perms. Got %q", text)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,2 +1,3 @@
|
|||||||
|
_activeHelp_ This command does not take any more arguments (but may accept flags).
|
||||||
:4
|
:4
|
||||||
Completion ended with directive: ShellCompDirectiveNoFileComp
|
Completion ended with directive: ShellCompDirectiveNoFileComp
|
||||||
|
@ -1 +1 @@
|
|||||||
{"name":"thomas-guide","chart":"foo","version":"0.1.0-beta.1","appVersion":"1.0","namespace":"default","revision":1,"status":"deployed","deployedAt":"1977-09-02T22:04:05Z"}
|
{"name":"thomas-guide","chart":"foo","version":"0.1.0-beta.1","appVersion":"1.0","annotations":{"category":"web-apps","supported":"true"},"dependencies":[{"name":"cool-plugin","version":"1.0.0","repository":"https://coolplugin.io/charts","condition":"coolPlugin.enabled","enabled":true},{"name":"crds","version":"2.7.1","repository":"","condition":"crds.enabled"}],"namespace":"default","revision":1,"status":"deployed","deployedAt":"1977-09-02T22:04:05Z"}
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
NAME: secrets
|
||||||
|
LAST DEPLOYED: Fri Sep 2 22:04:05 1977
|
||||||
|
NAMESPACE: default
|
||||||
|
STATUS: pending-install
|
||||||
|
REVISION: 1
|
||||||
|
DESCRIPTION: Dry run complete
|
||||||
|
TEST SUITE: None
|
||||||
|
HOOKS:
|
||||||
|
MANIFEST:
|
||||||
|
---
|
||||||
|
# Source: chart-with-secret/templates/secret.yaml
|
||||||
|
# HIDDEN: The Secret output has been suppressed
|
||||||
|
---
|
||||||
|
# Source: chart-with-secret/templates/configmap.yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: test-configmap
|
||||||
|
data:
|
||||||
|
foo: bar
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
NAME: secrets
|
||||||
|
LAST DEPLOYED: Fri Sep 2 22:04:05 1977
|
||||||
|
NAMESPACE: default
|
||||||
|
STATUS: pending-install
|
||||||
|
REVISION: 1
|
||||||
|
DESCRIPTION: Dry run complete
|
||||||
|
TEST SUITE: None
|
||||||
|
HOOKS:
|
||||||
|
MANIFEST:
|
||||||
|
---
|
||||||
|
# Source: chart-with-secret/templates/secret.yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: test-secret
|
||||||
|
stringData:
|
||||||
|
foo: bar
|
||||||
|
---
|
||||||
|
# Source: chart-with-secret/templates/configmap.yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: test-configmap
|
||||||
|
data:
|
||||||
|
foo: bar
|
||||||
|
|
@ -0,0 +1 @@
|
|||||||
|
Error: INSTALLATION FAILED: Hiding Kubernetes secrets requires a dry-run mode
|
@ -1,7 +1,7 @@
|
|||||||
==> Linting testdata/testcharts/chart-with-bad-subcharts
|
==> Linting testdata/testcharts/chart-with-bad-subcharts
|
||||||
[INFO] Chart.yaml: icon is recommended
|
[INFO] Chart.yaml: icon is recommended
|
||||||
[ERROR] templates/: error unpacking bad-subchart in chart-with-bad-subcharts: validation: chart.metadata.name is required
|
[ERROR] templates/: error unpacking subchart bad-subchart in chart-with-bad-subcharts: validation: chart.metadata.name is required
|
||||||
[ERROR] : unable to load chart
|
[ERROR] : unable to load chart
|
||||||
error unpacking bad-subchart in chart-with-bad-subcharts: validation: chart.metadata.name is required
|
error unpacking subchart bad-subchart in chart-with-bad-subcharts: validation: chart.metadata.name is required
|
||||||
|
|
||||||
Error: 1 chart(s) linted, 1 chart(s) failed
|
Error: 1 chart(s) linted, 1 chart(s) failed
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
|
_activeHelp_ This command does not take any more arguments (but may accept flags).
|
||||||
:4
|
:4
|
||||||
Completion ended with directive: ShellCompDirectiveNoFileComp
|
Completion ended with directive: ShellCompDirectiveNoFileComp
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
|
_activeHelp_ This command does not take any more arguments (but may accept flags).
|
||||||
:4
|
:4
|
||||||
Completion ended with directive: ShellCompDirectiveNoFileComp
|
Completion ended with directive: ShellCompDirectiveNoFileComp
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue