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

chore: fix security issues #40

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '1.23'
go-version: '1.23.x'
check-latest: true
- name: Lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 #v6.1.1
with:
version: v1.62
working-directory: .
args: --config .github/golangci.yaml
skip-pkg-cache: true
skip-build-cache: true
18 changes: 9 additions & 9 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ concurrency:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SEMANTIC_RELEASE_PACKAGE: ${{ github.repository }}
GO_VERSION: '1.23'
GO_VERSION: '1.23.x'
APP_NAME: orb-agent

permissions:
Expand All @@ -34,7 +34,7 @@ jobs:
with:
node-version: "lts/*"
- name: Write package.json
uses: DamianReeves/write-file-action@master
uses: DamianReeves/write-file-action@6929a9a6d1807689191dcc8bbe62b54d70a32b42 #v1.3
with:
path: ./package.json
write-mode: overwrite
Expand All @@ -48,7 +48,7 @@ jobs:
}
}
- name: Write .releaserc.json
uses: DamianReeves/write-file-action@master
uses: DamianReeves/write-file-action@6929a9a6d1807689191dcc8bbe62b54d70a32b42 #v1.3
with:
path: ./.releaserc.json
write-mode: overwrite
Expand Down Expand Up @@ -132,13 +132,13 @@ jobs:
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf #v3.2.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 #v3.8.0

- name: Login to Docker Hub
uses: docker/login-action@v3
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 #v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand All @@ -149,7 +149,7 @@ jobs:
echo $BUILD_VERSION > ./agent/version/BUILD_VERSION.txt

- name: Build image and push
uses: docker/build-push-action@v6
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 #v6.10.0
with:
context: .
file: agent/docker/Dockerfile
Expand All @@ -174,7 +174,7 @@ jobs:
with:
node-version: "lts/*"
- name: Write package.json
uses: DamianReeves/write-file-action@master
uses: DamianReeves/write-file-action@6929a9a6d1807689191dcc8bbe62b54d70a32b42 #v1.3
with:
path: ./package.json
write-mode: overwrite
Expand All @@ -188,7 +188,7 @@ jobs:
}
}
- name: Write .releaserc.json
uses: DamianReeves/write-file-action@master
uses: DamianReeves/write-file-action@6929a9a6d1807689191dcc8bbe62b54d70a32b42 #v1.3
with:
path: ./.releaserc.json
write-mode: overwrite
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '1.23'
go-version: '1.23.x'
check-latest: true
- name: Run go build
run: go build ./...
Expand All @@ -54,14 +54,14 @@ jobs:
if: always()
run: cat .coverage/test-report.md
- name: Find comment
uses: peter-evans/find-comment@v3
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e #v3.1.0
id: existing-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Go test coverage
- name: Post comment
uses: peter-evans/create-or-update-comment@v4
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 #v4.0.0
with:
comment-id: ${{ steps.existing-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
Expand Down
4 changes: 3 additions & 1 deletion agent/backend/devicediscovery/device_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,14 @@
"--host", d.apiHost,
"--port", d.apiPort,
"--diode-target", d.diodeTarget,
"--diode-api-key", d.diodeAPIKey,
"--diode-api-key", "********",
"--diode-app-name-prefix", d.diodeAppNamePrefix,
}

d.logger.Info("device-discovery startup", zap.Strings("arguments", pvOptions))

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

Sensitive data returned by an access to diodeAPIKey
flows to a logging call.

pvOptions[7] = d.diodeAPIKey

d.proc = cmd.NewCmdOptions(cmd.Options{
Buffered: false,
Streaming: true,
Expand Down
4 changes: 3 additions & 1 deletion agent/backend/networkdiscovery/network_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,14 @@
"--host", d.apiHost,
"--port", d.apiPort,
"--diode-target", d.diodeTarget,
"--diode-api-key", d.diodeAPIKey,
"--diode-api-key", "********",
"--diode-app-name-prefix", d.diodeAppNamePrefix,
}

d.logger.Info("network-discovery startup", zap.Strings("arguments", pvOptions))

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

Sensitive data returned by an access to diodeAPIKey
flows to a logging call.

pvOptions[7] = d.diodeAPIKey

d.proc = cmd.NewCmdOptions(cmd.Options{
Buffered: false,
Streaming: true,
Expand Down
1 change: 0 additions & 1 deletion agent/config/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ func (cc *cloudConfigManager) request(address string, token string, response int
return err
}
req.Header.Add("Content-Type", "application/json")
cc.logger.Debug("cloud api request", zap.String("url", req.URL.String()), zap.ByteString("body", body))
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", token))

res, getErr := client.Do(req)
Expand Down
Loading