Skip to content

Commit

Permalink
fix VI cats
Browse files Browse the repository at this point in the history
Summary:
Details on "why": https://fb.workplace.com/groups/2071217289839797/permalink/3401769186784594/

We need to forward these CAT tokens to verify integrity service. Now that we have the land service, we need to forward those CATs also through the land service.

We do that in `get_service_client` called here:
https://www.internalfb.com/code/fbsource/[27503e0eb5ead5894dd3d8c4bfb9b0040c915bca]/fbcode/eden/mononoke/pushrebase/client/facebook/land_service.rs?lines=257

The `get_service_client` in its body has:
https://www.internalfb.com/code/fbsource/[e0f913f7c3b93921f058dc6bd3d11a4d11b3c592]/fbcode/eden/mononoke/common/facebook/thrift_client/src/lib.rs?lines=129-135

Reviewed By: zzl0

Differential Revision: D66599190

fbshipit-source-id: 41359562f4886fe86d3b4782074341d8fa324748
  • Loading branch information
mzr authored and facebook-github-bot committed Nov 29, 2024
1 parent 671ffc6 commit b09fef7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions eden/mononoke/gotham_ext/src/middleware/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const ENCODED_CLIENT_IDENTITY: &str = "x-fb-validated-client-encoded-identity";
const CLIENT_IP: &str = "tfb-orig-client-ip";
const CLIENT_PORT: &str = "tfb-orig-client-port";
const HEADER_REVPROXY_REGION: &str = "x-fb-revproxy-region";
const HEADER_FORWARDED_CATS: &str = "x-forwarded-cats";

#[derive(StateData, Default)]
pub struct MetadataState(Metadata);
Expand Down Expand Up @@ -150,6 +151,13 @@ impl Middleware for MetadataMiddleware {
if let Some(revproxy_region) = revproxy_region_from_headers(headers) {
metadata.add_revproxy_region(revproxy_region);
}
if let Some(vi_cats) = headers
.get(HEADER_FORWARDED_CATS)
.and_then(|x| x.to_str().ok())
.map(|x| x.to_string())
{
metadata.add_raw_encoded_cats(vi_cats);
}

let maybe_identities = if self.mtls_disabled {
ingress_request_identities_from_headers(headers)
Expand Down

0 comments on commit b09fef7

Please sign in to comment.