Skip to content

Commit 06d33bd

Browse files
authored
Novatechflow/dependabot vuln remediation (#136)
1 parent 8018c8d commit 06d33bd

24 files changed

Lines changed: 1088 additions & 872 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ jobs:
4646
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v5
4747
with:
4848
go-version-file: go.mod
49-
cache-dependency-path: go.sum
49+
cache-dependency-path: |
50+
go.sum
51+
addons/processors/skeleton/go.sum
52+
addons/processors/sql-processor/go.sum
53+
addons/processors/iceberg-processor/go.sum
5054
5155
- name: Prepare Go build cache
5256
run: mkdir -p "$GOCACHE"
@@ -57,6 +61,9 @@ jobs:
5761
- name: Run go test -race ./...
5862
run: go test -race ./...
5963

64+
- name: Run nested module tests
65+
run: make test-nested-modules
66+
6067
go-coverage:
6168
name: Go Coverage Gate
6269
runs-on: ubuntu-latest

.github/workflows/codeql.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@ on:
2424
- main
2525
workflow_dispatch:
2626

27-
permissions:
28-
actions: read
29-
contents: read
30-
security-events: write
31-
3227
jobs:
3328
analyze:
3429
name: Analyze
3530
runs-on: ubuntu-latest
31+
permissions:
32+
actions: read
33+
contents: read
34+
security-events: write
3635
strategy:
3736
fail-fast: false
3837
matrix:
@@ -44,10 +43,10 @@ jobs:
4443

4544
steps:
4645
- name: Checkout
47-
uses: actions/checkout@v4
46+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
4847

4948
- name: Initialize CodeQL
50-
uses: github/codeql-action/init@v4
49+
uses: github/codeql-action/init@c6f931105cb2c34c8f901cc885ba1e2e259cf745 # v4
5150
with:
5251
languages: ${{ matrix.language }}
5352
queries: security-extended,security-and-quality
@@ -59,9 +58,9 @@ jobs:
5958
- 'third_party/**'
6059
6160
- name: Autobuild
62-
uses: github/codeql-action/autobuild@v4
61+
uses: github/codeql-action/autobuild@c6f931105cb2c34c8f901cc885ba1e2e259cf745 # v4
6362

6463
- name: Analyze
65-
uses: github/codeql-action/analyze@v4
64+
uses: github/codeql-action/analyze@c6f931105cb2c34c8f901cc885ba1e2e259cf745 # v4
6665
with:
6766
category: "/language:${{ matrix.language }}"

.github/workflows/docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ on:
2121
- 'v*'
2222
workflow_dispatch:
2323

24-
permissions: read-all
24+
permissions: {}
2525

2626
jobs:
2727
build-and-push:

Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ LOCAL_NODE_BIN := $(LOCAL_NODE_DIR)/bin
2323
LOCAL_NODE := $(LOCAL_NODE_BIN)/node
2424
LOCAL_NPM := $(LOCAL_NODE_BIN)/npm
2525

26-
.PHONY: proto build test tidy lint generate build-sdk docker-build docker-build-e2e-client docker-build-etcd-tools docker-clean ensure-minio start-minio stop-containers release-broker-ports test-produce-consume test-produce-consume-debug test-consumer-group test-ops-api test-mcp test-multi-segment-durability test-full test-operator test-acl demo demo-platform demo-platform-bootstrap iceberg-demo kafsql-demo platform-demo help clean-kind-all ensure-local-node check vet race fmt fmt-check test-fuzz code-ql code-ql-summary code-ql-gate commit-check
26+
.PHONY: proto build test test-nested-modules tidy lint generate build-sdk docker-build docker-build-e2e-client docker-build-etcd-tools docker-clean ensure-minio start-minio stop-containers release-broker-ports test-produce-consume test-produce-consume-debug test-consumer-group test-ops-api test-mcp test-multi-segment-durability test-full test-operator test-acl demo demo-platform demo-platform-bootstrap iceberg-demo kafsql-demo platform-demo help clean-kind-all ensure-local-node check vet race fmt fmt-check test-fuzz code-ql code-ql-summary code-ql-gate commit-check
2727

2828
REGISTRY ?= ghcr.io/kafscale
2929
STAMP_DIR ?= .build
@@ -164,6 +164,14 @@ test: ## Run unit tests + vet + race
164164
@echo "race passed."
165165
@echo "test passed."
166166

167+
test-nested-modules: ## Run go test across nested Go modules under addons/processors
168+
@set -e; \
169+
for dir in addons/processors/skeleton addons/processors/sql-processor addons/processors/iceberg-processor; do \
170+
echo "==> $$dir: go test ./..."; \
171+
( cd $$dir && go test ./... ); \
172+
done; \
173+
echo "nested module tests passed."
174+
167175
vet: ## Run go vet
168176
@echo "==> go vet"
169177
@go vet ./...
@@ -212,7 +220,7 @@ code-ql-gate: code-ql ## Fail if CodeQL reports any error findings
212220
fi; \
213221
echo "CodeQL gate passed: no error findings found."
214222

215-
commit-check: ensure-local-node check fmt test test-fuzz code-ql-gate ## Run pre-commit quality gates
223+
commit-check: ensure-local-node check fmt test test-nested-modules test-fuzz code-ql-gate ## Run pre-commit quality gates
216224
@echo "commit-check passed."
217225

218226
test-acl: ## Run ACL e2e test (requires KAFSCALE_E2E=1)

addons/processors/iceberg-processor/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
FROM golang:1.25-alpine AS build
17+
FROM golang:1.25-alpine@sha256:8e02eb337d9e0ea459e041f1ee5eece41cbb61f1d83e7d883a3e2fb4862063fa AS build
1818
RUN apk add --no-cache git
1919
ARG REPO_ROOT=.
2020
ARG MODULE_DIR=.
@@ -36,7 +36,7 @@ RUN --mount=type=cache,target=/go/pkg/mod \
3636
--mount=type=cache,target=/root/.cache/go-build \
3737
go build ${GO_BUILD_FLAGS} -o /out/iceberg-processor ./cmd/processor
3838

39-
FROM alpine:3.19
39+
FROM alpine:3.19@sha256:6baf43584bcb78f2e5847d1de515f23499913ac9f12bdf834811a3145eb11ca1
4040
WORKDIR /app
4141
COPY --from=build /out/iceberg-processor /app/iceberg-processor
4242
USER 65532:65532

addons/processors/iceberg-processor/deploy/helm/iceberg-processor/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ config:
5454
uri: https://iceberg-catalog.example.com
5555
token: ""
5656
username: ""
57-
password: ""
57+
password: null
5858
warehouse: s3://iceberg-warehouse/production
5959
offsets:
6060
backend: etcd
@@ -68,7 +68,7 @@ config:
6868
endpoints:
6969
- http://etcd.kafscale.svc.cluster.local:2379
7070
username: ""
71-
password: ""
71+
password: null
7272
schema:
7373
mode: "off"
7474
registry:

addons/processors/iceberg-processor/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ require (
153153
google.golang.org/genproto v0.0.0-20250715232539-7130f93afb79 // indirect
154154
google.golang.org/genproto/googleapis/api v0.0.0-20251213004720-97cd9d5aeac2 // indirect
155155
google.golang.org/genproto/googleapis/rpc v0.0.0-20251213004720-97cd9d5aeac2 // indirect
156-
google.golang.org/grpc v1.79.1 // indirect
156+
google.golang.org/grpc v1.79.3 // indirect
157157
google.golang.org/protobuf v1.36.11 // indirect
158158
)
159159

addons/processors/iceberg-processor/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,8 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20251213004720-97cd9d5aeac2 h1:
776776
google.golang.org/genproto/googleapis/rpc v0.0.0-20251213004720-97cd9d5aeac2/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk=
777777
google.golang.org/grpc v1.79.1 h1:zGhSi45ODB9/p3VAawt9a+O/MULLl9dpizzNNpq7flY=
778778
google.golang.org/grpc v1.79.1/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ=
779+
google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE=
780+
google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ=
779781
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
780782
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
781783
gopkg.in/cenkalti/backoff.v1 v1.1.0 h1:Arh75ttbsvlpVA7WtVpH4u9h6Zl46xuptxqLxPiSo4Y=

addons/processors/iceberg-processor/internal/sink/iceberg.go

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,27 +451,38 @@ type loggingTransport struct {
451451
base http.RoundTripper
452452
}
453453

454+
func sanitizeLogValue(value string) string {
455+
value = strings.ReplaceAll(value, "\n", "\\n")
456+
value = strings.ReplaceAll(value, "\r", "\\r")
457+
return value
458+
}
459+
454460
func (t *loggingTransport) RoundTrip(req *http.Request) (*http.Response, error) {
455461
base := t.base
456462
if base == nil {
457463
base = http.DefaultTransport
458464
}
465+
method := sanitizeLogValue(req.Method)
466+
urlText := ""
467+
if req.URL != nil {
468+
urlText = sanitizeLogValue(req.URL.Redacted())
469+
}
459470
resp, err := base.RoundTrip(req)
460471
if err != nil {
461-
log.Printf("iceberg-rest http %s %s failed: %v", req.Method, req.URL, err)
472+
log.Printf("iceberg-rest http %s %s failed: %v", method, urlText, err)
462473
return resp, err
463474
}
464475
if resp.StatusCode >= 400 {
465476
body, readErr := io.ReadAll(io.LimitReader(resp.Body, 8192))
466477
_ = resp.Body.Close()
467478
resp.Body = io.NopCloser(bytes.NewReader(body))
468479
if readErr != nil {
469-
log.Printf("iceberg-rest http %s %s -> %d (read error: %v)", req.Method, req.URL, resp.StatusCode, readErr)
480+
log.Printf("iceberg-rest http %s %s -> %d (read error: %v)", method, urlText, resp.StatusCode, readErr)
470481
} else {
471-
log.Printf("iceberg-rest http %s %s -> %d body=%s", req.Method, req.URL, resp.StatusCode, strings.TrimSpace(string(body)))
482+
log.Printf("iceberg-rest http %s %s -> %d body=%s", method, urlText, resp.StatusCode, sanitizeLogValue(strings.TrimSpace(string(body))))
472483
}
473484
} else {
474-
log.Printf("iceberg-rest http %s %s -> %d", req.Method, req.URL, resp.StatusCode)
485+
log.Printf("iceberg-rest http %s %s -> %d", method, urlText, resp.StatusCode)
475486
}
476487
return resp, nil
477488
}

addons/processors/skeleton/internal/processor/processor.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,8 @@ func (p *Processor) Run(ctx context.Context) error {
130130
continue
131131
}
132132

133-
if dropped := len(records); dropped > 0 {
133+
if len(records) > 0 {
134134
records = filterRecords(records, state.Offset)
135-
dropped -= len(records)
136135
}
137136
if len(records) == 0 {
138137
continue

0 commit comments

Comments
 (0)