-
Notifications
You must be signed in to change notification settings - Fork 129
chore: remove headers through guard #3288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
PR Review: Remove headers through guardSummaryThis PR removes internal Rivet routing headers ( ✅ Positive Aspects
🔍 Potential IssuesCritical: WebSocket header leakageThe current implementation only removes these headers for HTTP requests in Looking at // Copy headers except Host
for (key, value) in original_headers.iter() {
if key != hyper::header::HOST {
headers.insert(key.clone(), value.clone());
}
}This means Recommendation: Apply the same header filtering for WebSocket requests. You have two options:
// Remove internal routing headers before adding proxy headers
ws_request.headers_mut().remove(X_RIVET_TARGET);
ws_request.headers_mut().remove(X_RIVET_ACTOR);
ws_request.headers_mut().remove(X_RIVET_TOKEN);
if let Err(err) = add_proxy_headers_with_addr(
ws_request.headers_mut(),
&req_headers,
remote_addr,
) {
// ...
}
for (key, value) in original_headers.iter() {
if key != hyper::header::HOST
&& key != X_RIVET_TARGET
&& key != X_RIVET_ACTOR
&& key != X_RIVET_TOKEN {
headers.insert(key.clone(), value.clone());
}
}Option B is cleaner and ensures consistency across all uses of Minor: Unused constant removalThe removal of 📋 Testing Recommendations
🎯 Code Quality
📝 Additional NotesLooking at the codebase, these headers are used in multiple places for routing:
These are all before the proxying happens, which is correct. The headers are used to determine where to route, then stripped before forwarding. VerdictApprove with changes required - The HTTP implementation is correct, but the WebSocket implementation needs the same header filtering to close the security gap and maintain consistency. 🤖 Generated with Claude Code |
8cb5d95 to
79f4777
Compare
Updated PR Review: Remove headers through guardI reviewed this PR previously and the critical WebSocket header leakage issue remains unaddressed. Here's an updated review: 🔴 Critical Issue: WebSocket Header Leakage Still PresentThe current implementation only removes internal headers for HTTP requests (proxy_service.rs:1102-1104), but NOT for WebSocket upgrades. Location of the bug: proxy_service.rs:1313-1316 The WebSocket upgrade handler calls 🔧 Recommended FixThe cleanest solution is to modify fn add_proxy_headers_with_addr(
headers: &mut hyper::HeaderMap,
original_headers: &hyper::HeaderMap,
remote_addr: SocketAddr,
) -> Result<()> {
// Copy headers except Host and internal Rivet headers
for (key, value) in original_headers.iter() {
if key != hyper::header::HOST
&& key != X_RIVET_TARGET
&& key != X_RIVET_ACTOR
&& key != X_RIVET_TOKEN {
headers.insert(key.clone(), value.clone());
}
}
// ... rest of the function
}This ensures both HTTP and WebSocket requests are handled consistently. ✅ What's Good
📊 Other Filesuniversaldb/src/driver/rocksdb/transaction_task.rs:140
🧪 Testing NeededBefore merging, please verify:
VerdictRequest changes - The WebSocket header leakage must be fixed before merging. This is a security issue that could expose internal routing metadata to upstream services. 🤖 Generated with Claude Code |
a7d0289 to
a3e2e41
Compare

No description provided.