Skip to content

Commit b144682

Browse files
committed
feat: update apps/walletshield (v0.4.2)
1 parent 63ba4db commit b144682

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

apps/walletshield/main.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ import (
3232
var (
3333
timeout = time.Second * 45
3434
ProxyHTTPService = "http_proxy"
35+
36+
// Note: UserForwardPayloadLength should match the same value passed to genconfig.
37+
UserForwardPayloadLength = 30000
3538
)
3639

3740
func sendRequest(thin *thin.ThinClient, payload []byte) ([]byte, error) {
@@ -175,6 +178,15 @@ func (s *Server) Handler(w http.ResponseWriter, req *http.Request) {
175178
panic(err)
176179
}
177180

181+
// FIXME: resolve with multi-packet transimssion to transcend payload size limitation
182+
// While better solution is developing, pre-emptively reject oversized payloads
183+
size := len(blob)
184+
if size > UserForwardPayloadLength {
185+
s.log.Errorf("(WIP) Rejecting message with oversized payload: %d > %d bytes", size, UserForwardPayloadLength)
186+
http.Error(w, "custom 500", http.StatusInternalServerError)
187+
return
188+
}
189+
178190
rawReply, err := sendRequest(s.thin, blob)
179191
if err != nil {
180192
s.log.Errorf("Failed to send message: %s", err)

0 commit comments

Comments
 (0)