Skip to content

fix: [CI-23226]: remediate vulnerabilities in harnesssecure/gcs#106

Open
imaditya55 wants to merge 2 commits into
drone-plugins:masterfrom
imaditya55:fix/CI-23226-vuln-remediation-1783922267
Open

fix: [CI-23226]: remediate vulnerabilities in harnesssecure/gcs#106
imaditya55 wants to merge 2 commits into
drone-plugins:masterfrom
imaditya55:fix/CI-23226-vuln-remediation-1783922267

Conversation

@imaditya55

@imaditya55 imaditya55 commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

CVE remediation for CI-23226 (harnesssecure/gcs:1.6.10 — same source as plugins/gcs:1.6.10 from drone-plugins/drone-gcs).

Go 1.25.12 + dependency bumps from vuln_remediation pipeline, plus CI fixes for failures caused by library upgrades.

Root cause of CI failures

The vuln_remediation pipeline updated go.mod / go.sum to fix CVEs. Two library upgrades caused CI to fail:

1. Lint failure (SA1019 — deprecated API)

  • Library: google.golang.org/api v0.214.0v0.284.0
  • Issue: New version marks option.WithCredentialsFile as deprecated
  • Symptom: golangci-lint run failed in Test stage

2. Test failure (JSON unmarshal)

  • Library: cloud.google.com/go/storage v1.50.0v1.62.3
  • Issue: New storage client sends crc32C as base64 string in upload metadata JSON
  • Symptom: TestRun failed unmarshaling into storage.ObjectAttrs (uint32 expected)

Go 1.25.12 bump alone did not cause these — the Google library upgrades did.

Fixes in this PR

  • main.go: Replace deprecated WithCredentialsFile with JWTConfigFromJSON + WithTokenSource
  • plugin_test.go: Decode upload metadata via test struct omitting crc32C field
  • .harness/harness.yaml: Pipeline Go image golang:1.25.12

Functional sanity validation

Fake-GCS pipeline — both runs uploaded file1.yaml and file2.yaml successfully:

OnDemand vulnerability scans (CI-23226)

Severity Before — harnesssecure/gcs:1.6.10 After — vinayakharness/gcs-test:gcs-1.6.11--debug
Critical 1 0
High 14 0
Low 3 0
Total (OnDemand) 39 3

Scanner: Harness OnDemand (Snyk + Prisma) · Status: BOTH_OK

CI status

All Harness dronegcsharness checks green (11/11) on commit b94a912.

Related

vinayakharness2026 and others added 2 commits July 13, 2026 05:57
Bump Go toolchain and vulnerable indirect deps to their minimum-safe
versions per Trivy fix column, closing 46/47 unique CVEs found by the
baseline Trivy scan on plugins/gcs:1.6.10 (baseline uses the docker.io
public copy since harnesssecure/gcs is a private mirror built from
the same source).

Edits:
- go directive:                    1.25.7  -> 1.25.12  (stdlib CVEs)
- golang.org/x/crypto (indirect): v0.46.0 -> v0.52.0  (13 HIGH+MED)
- golang.org/x/net    (indirect): v0.48.0 -> v0.55.0  (7 CVEs)
- golang.org/x/sys    (indirect): v0.40.0 -> v0.45.0  (CVE-2026-39824)
- go.opentelemetry.io/otel{,sdk,metric,sdk/metric,trace} (indirect):
                                   v1.40.0 -> v1.43.0  (otel/sdk HIGH)
- github.com/go-jose/go-jose/v4 (indirect): v4.1.3 -> v4.1.4  (CVE-2026-34986)
- cloud.google.com/go/storage:     v1.50.0 -> v1.62.3  (unlocks newer subs)
- google.golang.org/api:           v0.214.0 -> v0.284.0 (unlocks newer subs)
- .drone.yml, .harness/harness.yaml: golang:1.25.7 -> golang:1.25.12
  so CI-built binaries embed the fixed stdlib.

Scans (Harness OnDemand + local Trivy) verify the fix in-pipeline
before merge. See PR body for the full canonical report.
Replace deprecated WithCredentialsFile with JWTConfigFromJSON token
source, and decode upload metadata in tests without CRC32C field.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread main.go
return err
}
} else if c.String("json-key") != "" {
err := os.MkdirAll(os.TempDir(), 0600)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why did we remove this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The temp file was only needed for the old WithCredentialsFile, which reads credentials from a file on disk. That function is now deprecated and it's what broke the lint check in CI. The new approach reads the key straight from memory, so there's no need to create, write, or delete a temp file anymore.

Comment thread main.go
if err := credFile.Close(); err != nil {
return nil, fmt.Errorf("failed to close gcs credentials file: %w", err)
func gcsClientWithJSONKey(jsonKey string) (*storage.Client, error) {
auth, err := google.JWTConfigFromJSON([]byte(jsonKey), storage.ScopeFullControl)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why is this now from google?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

google.JWTConfigFromJSON is from golang.org/x/oauth2/google. It reads the service-account JSON key in memory and returns a token source, which we hand to the storage client. This is actually the exact same approach already used just above in gcsClientWithToken so both auth paths now work the same way instead of the old deprecated file-based one.

This is the exact same approach already used by gcsClientWithToken (the function right above it in main.go) , so both auth paths now work the same way instead of the old deprecated file-based one.

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.

3 participants