Comments (1)
Looked into it and it looks like when we handle any /api/v3/device/send
request that doesn't have a Content-Type: application/msgpack
header, like Content-Type: application/json
, it will trigger panic:
case envelope = <-d.messages:
var frameContents []byte
if envelope.request.Format == wrp.Msgpack && len(envelope.request.Contents) > 0 {
frameContents = envelope.request.Contents
} else {
// if the request was in a format other than Msgpack, or if the caller did not pass
// Contents, then do the encoding here.
encoder.ResetBytes(&frameContents)
writeError = encoder.Encode(envelope.request.Message)
encoder.ResetBytes(nil)
}
Where envelope.request.Format == wrp.Msgpack
will evaluate to False and encoder.ResetBytes(nil)
will kick off a panic due to an eventual nil dereferencing caused by ugorji's codec.encInBytes
receiving that nil as its out
func encInBytes(out *[]byte) (in []byte) {
in = *out
I'm not entirely sure why encoder.ResetBytes(nil)
was introduced, but it looks like it can be patched by simply removing it.
Tested the patch with the following:
curl -v --location --request POST 'localhost:6200/api/v3/device/send' \
--header 'Authorization: Basic ${AUTH}' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{
"msg_type":3,
"content_type":"application/json",
"source":"dns:me",
"dest":"mac:112233445566",
"transaction_uuid":"1234567890",
"payload":"eyJjb21tYW5kIjoiR0VUIiwibmFtZXMiOlsiU29tZXRoaW5nIl19",
"partner_ids":["comcast"]
}'
// Output:
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying ::1:6200...
* Connected to localhost (::1) port 6200 (#0)
> POST /api/v3/device/send HTTP/1.1
> Host: localhost:6200
> User-Agent: curl/7.77.0
> Authorization: Basic ${AUTH}
> Content-Type: application/json
> Accept: application/json
> Content-Length: 287
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Length: 648
< Content-Type: application/json
< X-Talaria-Build: 0.1.4
< X-Talaria-Flavor: mint
< X-Talaria-Region: east
< X-Talaria-Server: talaria
< X-Talaria-Start-Time: 21 Apr 22 16:23 UTC
< Date: Thu, 21 Apr 2022 16:42:49 GMT
<
* Connection #0 to host localhost left intact
{"msg_type":3,"source":"mac:112233445566","dest":"dns:me","transaction_uuid":"1234567890","content_type":"application/octet-stream","metadata":{"partner-id":"comcast","hw-serial-number":"mock-rdkb-simulator","hw-manufacturer":"Example","hw-mac":"112233445566","hw-last-reboot-reason":"unknown","fw-name":"mock-rdkb-firmware","boot-time":"1650557221","webpa-last-reconnect-reason":"webpa_process_starts","webpa-protocol":"PARODUS-2.0-1.1.4-6-gad2d43b","hw-model":"aker-testing","webpa-interface-used":"eth0","webpa-uuid":"1234567-345456546"},"payload":"eyJzdGF0dXNDb2RlIjo1MzEsIm1lc3NhZ2UiOiJTZXJ2aWNlIFVuYXZhaWxhYmxlIn0=","partner_ids":["unknown"]}
from talaria.
Related Issues (20)
- Reduce Pong-Pinger Resource Usage
- Free Up Device Metadata
- WebSocket connection closed when increasing pingPeriod HOT 3
- JWK Migration and Clortho Integration
- Logging: Update To Use Uber Zap & Sallust
- Bug: Patch Failing Linter
- Linter Fix & Refactor Functions to Improve Readability
- Remove Deprecated `webpa-common`
- Event Metadata fields mapping is wrong.
- CVE-2022-32149 (High) detected in golang.org/x/text-v0.3.7 - autoclosed HOT 1
- Tracing information is not getting propogated with events
- Feature: Echoing additional Device wrp fields in qos ack
- CVE-2022-41723 (High) detected in golang.org/x/net-v0.4.0 - autoclosed HOT 1
- Talaria should provide a metric showing the maxDevices HOT 1
- Update Candlelight to v0.0.16 HOT 1
- Update Tracing Configurations
- Talaria drain job should provide an ability to drop specific devices. HOT 2
- Add Bascule Helper Package
- CVE-2023-2816 (High) detected in github.com/hashicorp/Consul/api-v1.20.0 - autoclosed HOT 1
- Update Candlelight Version for Tracing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from talaria.