security: fix audit findings (HMAC bypass, DoS, unauth APIs, hardening)#6
Merged
Conversation
Addresses the issues from the security review: Critical - ioc_feed: remove hardcoded "glasswally_dev_key" HMAC fallback that allowed forging signed cross-provider IOC bundles; require >=32-byte keys and fail closed on verify. High - http_reconstruct: cap per-request buffer (1 MiB), connection map (8192) and Content-Length to stop unbounded-memory DoS from a monitored client that never completes a request. - grpc_api: add optional constant-time shared-secret auth, a connection-concurrency cap, and read timeouts. - otel: bound concurrent /metrics scrape connections + write timeout. - docker-compose: drop `privileged: true` for the eBPF service in favour of the minimal capability set + no-new-privileges; bind all published ports to loopback. Medium - main: `--mode ebpf` now hard-fails instead of silently tailing a file (was a false sense of security); real loader wired under the live-ebpf feature. - defaults moved off world-writable /tmp; output dir locked to 0700. - docker-compose: fix invalid CLI flags that prevented startup; require GRAFANA_ADMIN_PASSWORD and disable anonymous access. - widen truncated fingerprints/account-id to 128-bit and cap cluster fan-out to resist clustering/collision poisoning + algorithmic DoS. - watermark detect: require larger sample + phase-resync, fewer FPs. Low - fix NaN-panic sorts, unaligned RawSslEvent read, oversized JSONL lines; remove unused (broken) md5 dep; add cargo-audit CI job.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the issues found in a full security review of the codebase. 16 files changed;
cargo check/test/clippy -D warnings/fmt --checkandcargo metadata --lockedall pass.Critical
ioc_feed.rs) — removed the hardcodedglasswally_dev_keyfallback that let anyone forge signed cross-provider IOC bundles (poisoning the shared trust channel → cross-provider suspension of innocent IPs/accounts). Keys must now be ≥32 bytes; signing/verify fail closed.High
http_reconstruct.rs) — cap per-request buffer (1 MiB), connection map (8192), and Content-Length; drop stray continuations. A monitored client can no longer OOM the daemon by never completing a request.grpc_api.rs) — optional constant-time shared-secret auth, 256-connection cap, read timeouts.otel.rs) — concurrent-connection cap + write timeout.docker-compose.yml) — droppedprivileged: truefor the eBPF service in favour of the minimal capability set +no-new-privileges+ memlock ulimit; all published ports bound to loopback.Medium
--mode ebpfnow hard-fails instead of silently tailing a file (was a false sense of security); real loader wired under thelive-ebpffeature./tmp; output dir forced to0700(CWE-377/CWE-59).GRAFANA_ADMIN_PASSWORDand disables anonymous access.detect()requires a larger sample + phase resync, reducing false positives and surviving desync.Low
RawSslEventread (read_unaligned), oversized JSONL line handling.md5dependency; added acargo-auditRUSTSEC scan job to CI.Test plan
cargo check -p glasswally -p xtaskcargo test -p glasswallycargo clippy -p glasswally -- -D warningscargo fmt -p glasswally -- --checkcargo metadata --locked(Docker--lockedbuild stays consistent after md5 removal)auth_tokenset on the query API