diff --git a/CHANGELOG.md b/CHANGELOG.md index 1652d33..da5b7ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,18 @@ The format is based on [Keep a Changelog][keepachangelog] and adheres to [Semant ### Changed +### Deprecated + +### Fixed + +## [0.52.15] + +### Added + +- Added Base64 encoding for the response body in the anonProxyHandler to prevent corruption of binary data when returned in JSON format. + +### Changed + - **GoReleaser**: Updated to build only `network-cli` binary (v0.52.2+) - Other binaries (node, gateway, identity) now installed via `network-cli setup` - Cleaner, smaller release packages @@ -125,7 +137,7 @@ The format is based on [Keep a Changelog][keepachangelog] and adheres to [Semant ### Fixed -- Regular nodes rqlite not starting +- Regular nodes rqlite not starting ## [0.51.2] - 2025-09-26 @@ -155,7 +167,6 @@ The format is based on [Keep a Changelog][keepachangelog] and adheres to [Semant ### Fixed - ## [0.50.0] - 2025-09-23 ### Added @@ -286,4 +297,3 @@ _Initial release._ [keepachangelog]: https://keepachangelog.com/en/1.1.0/ [semver]: https://semver.org/spec/v2.0.0.html - diff --git a/Makefile b/Makefile index 9ee7a4c..fc86ede 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ test-e2e: .PHONY: build clean test run-node run-node2 run-node3 run-example deps tidy fmt vet lint clear-ports -VERSION := 0.52.14 +VERSION := 0.52.15 COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown) DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ) LDFLAGS := -X 'main.version=$(VERSION)' -X 'main.commit=$(COMMIT)' -X 'main.date=$(DATE)' diff --git a/pkg/gateway/anon_proxy_handler.go b/pkg/gateway/anon_proxy_handler.go index 493a32a..2b27cfb 100644 --- a/pkg/gateway/anon_proxy_handler.go +++ b/pkg/gateway/anon_proxy_handler.go @@ -1,6 +1,7 @@ package gateway import ( + "encoding/base64" "encoding/json" "fmt" "io" @@ -176,11 +177,15 @@ func (g *Gateway) anonProxyHandler(w http.ResponseWriter, r *http.Request) { zap.Int("bytes", len(respBody)), zap.Duration("duration", duration)) + // Base64-encode the body to safely handle binary data in JSON + // This prevents corruption when binary data is converted to a string + bodyBase64 := base64.StdEncoding.EncodeToString(respBody) + // Return the proxied response writeJSON(w, http.StatusOK, anonProxyResponse{ StatusCode: resp.StatusCode, Headers: respHeaders, - Body: string(respBody), + Body: bodyBase64, }) }