Hi @blt, as requested I'm including security review notes here. (I'm not particularly Rust-savvy at the moment, so some of this may not be interesting in reality.) PTAL and assess if there's anything worth following up on.
Various “unsafe” usages in Rust code: https://github.com/postmates/cernan/search?q=unsafe&unscoped_q=unsafe
- If any of this involves handling untrusted data, and there is a bug, presumably that can enable memory corruption & thus RCE
- Note from John Koenig: "Lua scripts were only in use while Postmates still relied on Cernan to ingest / transform Postmates owned logs. As we are currently ingesting logs via fluentd, my expectation is that this is a non-issue at lest for us internally."
- For example, here:
- What is parse_descriptor_proto() parsing?
- Note from John Koenig: "This is a generated protobuf definition for prometheus's binary protocol.
AFAIK, this is unused in the code base and is a candidate for deprecation. The Prometheus source currently only supports Prom's text protocol compressed with gzip."
- Or:
|
fl.max_read_bytes = tbl.get("max_read_bytes") |
- “Someday a static analysis system will flag this as unsafe. Welcome.”
- OK =) Well, at least this doesn’t appear to be in an unsafe block, so maybe OK?
“By default cernan will put its on-disk queues into TMPDIR. While this is acceptable for testing and development this is not desirable for production deployments.”
- Is this essentially insecure by default? If it’s insecure with the default setting that should probably at minimum be called out explicitly in the wiki.
https://github.com/postmates/cernan/wiki/Configuration#Scripts-Directory
- Same issue as above. If something can create /tmp/cernan-scripts then it seems cernan will run untrusted scripts
For SourcesNative: “The payload must be length prefixed, the length being an unsigned, network-ordered 32 bit integer.”
- What if it’s not?
- (Ref: https://github.com/postmates/cernan/wiki/SourcesNative)
Similar with SourcesStatsd -- how is malformed input handled? If we can hit any of the code marked unsafe then things get interesting & there is potential for memory corruption / RCE.
https://github.com/postmates/cernan/wiki/SinksElasticSearch
- secure :: whether to attempt HTTPS or not with the elasticsearch host [default: false]
- How about changing the default to True. =)
How does cernan authenticate to any of the sinks (or sources for that matter)?
Sorry if the formatting makes that a bit hard to digest. Let me know if you have any questions on any of this.
Hi @blt, as requested I'm including security review notes here. (I'm not particularly Rust-savvy at the moment, so some of this may not be interesting in reality.) PTAL and assess if there's anything worth following up on.
Various “unsafe” usages in Rust code: https://github.com/postmates/cernan/search?q=unsafe&unscoped_q=unsafe
cernan/src/protocols/prometheus.rs
Line 2988 in b770703
AFAIK, this is unused in the code base and is a candidate for deprecation. The Prometheus source currently only supports Prom's text protocol compressed with gzip."
cernan/src/config.rs
Line 821 in e63c6e6
“By default cernan will put its on-disk queues into TMPDIR. While this is acceptable for testing and development this is not desirable for production deployments.”
https://github.com/postmates/cernan/wiki/Configuration#Scripts-Directory
For SourcesNative: “The payload must be length prefixed, the length being an unsigned, network-ordered 32 bit integer.”
Similar with SourcesStatsd -- how is malformed input handled? If we can hit any of the code marked unsafe then things get interesting & there is potential for memory corruption / RCE.
https://github.com/postmates/cernan/wiki/SinksElasticSearch
How does cernan authenticate to any of the sinks (or sources for that matter)?
Sorry if the formatting makes that a bit hard to digest. Let me know if you have any questions on any of this.