Skip to content

Commit e2b8a49

Browse files
Fix remaining SSC naming vestiges, CI formatting, and dependency sync
- Rename allows_ssc_creation → allows_ec_creation and update all doc comments, test names, and assertion messages to use Edge Cookie (EC) - Fix intra-doc link [`ec`] → [`edge_cookie`] in lib.rs - Downgrade test log from info to debug in edge_cookie.rs for consistency - Add fallback comment and wire-protocol breaking-change doc in openrtb.rs - Run prettier --write on 3 doc files to fix format-docs CI - Update integration-tests Cargo.lock to sync derive_more 2.1.1
1 parent 11e39dd commit e2b8a49

10 files changed

Lines changed: 101 additions & 80 deletions

File tree

crates/common/src/consent/kv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ pub fn save_consent_to_kv(store_name: &str, ec_id: &str, ctx: &ConsentContext, m
362362

363363
/// Deletes a consent entry from the KV Store for a given EC ID.
364364
///
365-
/// Used when a user revokes consent — the existing SSC cookie is being
365+
/// Used when a user revokes consent — the existing EC cookie is being
366366
/// expired, so the persisted consent data must also be removed.
367367
///
368368
/// Errors are logged but never propagated — KV Store failures must not

crates/common/src/consent/mod.rs

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -463,22 +463,22 @@ pub fn gate_eids_by_consent<T>(
463463
}
464464

465465
// ---------------------------------------------------------------------------
466-
// SSC consent gating
466+
// EC consent gating
467467
// ---------------------------------------------------------------------------
468468

469-
/// Determines whether SSC (Synthetic Session Cookie) creation is permitted
470-
/// based on the user's consent and detected jurisdiction.
469+
/// Determines whether Edge Cookie (EC) creation is permitted based on the
470+
/// user's consent and detected jurisdiction.
471471
///
472472
/// The decision follows the jurisdiction's consent model:
473473
///
474474
/// - **GDPR (EU/UK)**: opt-in required — TCF Purpose 1 (store/access
475475
/// information on a device) must be explicitly consented. If no TCF data is
476-
/// available under GDPR, consent is assumed absent and SSC is blocked.
477-
/// - **US state privacy**: opt-out model — SSC is allowed unless the user has
476+
/// available under GDPR, consent is assumed absent and EC is blocked.
477+
/// - **US state privacy**: opt-out model — EC is allowed unless the user has
478478
/// explicitly opted out via the US Privacy string or Global Privacy Control.
479-
/// - **Non-regulated / Unknown**: SSC is allowed (no consent requirement).
479+
/// - **Non-regulated / Unknown**: EC is allowed (no consent requirement).
480480
#[must_use]
481-
pub fn allows_ssc_creation(ctx: &ConsentContext) -> bool {
481+
pub fn allows_ec_creation(ctx: &ConsentContext) -> bool {
482482
match &ctx.jurisdiction {
483483
jurisdiction::Jurisdiction::Gdpr => {
484484
// EU/UK: explicit opt-in required (TCF Purpose 1 = store/access device).
@@ -610,7 +610,7 @@ mod tests {
610610
use fastly::Request;
611611

612612
use super::{
613-
allows_ssc_creation, apply_expiration_check, apply_tcf_conflict_resolution,
613+
allows_ec_creation, apply_expiration_check, apply_tcf_conflict_resolution,
614614
build_consent_context, build_context_from_signals, should_try_kv_fallback,
615615
ConsentPipelineInput,
616616
};
@@ -882,7 +882,7 @@ mod tests {
882882
}
883883

884884
// -----------------------------------------------------------------------
885-
// allows_ssc_creation tests
885+
// allows_ec_creation tests
886886
// -----------------------------------------------------------------------
887887

888888
/// Helper: builds a TCF consent with configurable Purpose 1 (storage).
@@ -891,35 +891,35 @@ mod tests {
891891
}
892892

893893
#[test]
894-
fn ssc_allowed_gdpr_with_storage_consent() {
894+
fn ec_allowed_gdpr_with_storage_consent() {
895895
let ctx = ConsentContext {
896896
jurisdiction: Jurisdiction::Gdpr,
897897
tcf: Some(make_tcf_with_storage(true)),
898898
gdpr_applies: true,
899899
..ConsentContext::default()
900900
};
901901
assert!(
902-
allows_ssc_creation(&ctx),
903-
"GDPR + TCF Purpose 1 consented should allow SSC"
902+
allows_ec_creation(&ctx),
903+
"GDPR + TCF Purpose 1 consented should allow EC"
904904
);
905905
}
906906

907907
#[test]
908-
fn ssc_blocked_gdpr_without_storage_consent() {
908+
fn ec_blocked_gdpr_without_storage_consent() {
909909
let ctx = ConsentContext {
910910
jurisdiction: Jurisdiction::Gdpr,
911911
tcf: Some(make_tcf_with_storage(false)),
912912
gdpr_applies: true,
913913
..ConsentContext::default()
914914
};
915915
assert!(
916-
!allows_ssc_creation(&ctx),
917-
"GDPR + TCF Purpose 1 not consented should block SSC"
916+
!allows_ec_creation(&ctx),
917+
"GDPR + TCF Purpose 1 not consented should block EC"
918918
);
919919
}
920920

921921
#[test]
922-
fn ssc_blocked_gdpr_no_tcf_data() {
922+
fn ec_blocked_gdpr_no_tcf_data() {
923923
let ctx = ConsentContext {
924924
jurisdiction: Jurisdiction::Gdpr,
925925
tcf: None,
@@ -928,13 +928,13 @@ mod tests {
928928
..ConsentContext::default()
929929
};
930930
assert!(
931-
!allows_ssc_creation(&ctx),
932-
"GDPR with no TCF data should block SSC"
931+
!allows_ec_creation(&ctx),
932+
"GDPR with no TCF data should block EC"
933933
);
934934
}
935935

936936
#[test]
937-
fn ssc_allowed_gdpr_via_gpp_embedded_tcf() {
937+
fn ec_allowed_gdpr_via_gpp_embedded_tcf() {
938938
let ctx = ConsentContext {
939939
jurisdiction: Jurisdiction::Gdpr,
940940
tcf: None,
@@ -947,13 +947,13 @@ mod tests {
947947
..ConsentContext::default()
948948
};
949949
assert!(
950-
allows_ssc_creation(&ctx),
951-
"GDPR + GPP embedded TCF with P1 consent should allow SSC"
950+
allows_ec_creation(&ctx),
951+
"GDPR + GPP embedded TCF with P1 consent should allow EC"
952952
);
953953
}
954954

955955
#[test]
956-
fn ssc_allowed_us_state_no_optout() {
956+
fn ec_allowed_us_state_no_optout() {
957957
let ctx = ConsentContext {
958958
jurisdiction: Jurisdiction::UsState("CA".to_owned()),
959959
us_privacy: Some(UsPrivacy {
@@ -965,13 +965,13 @@ mod tests {
965965
..ConsentContext::default()
966966
};
967967
assert!(
968-
allows_ssc_creation(&ctx),
969-
"US state + no opt-out should allow SSC"
968+
allows_ec_creation(&ctx),
969+
"US state + no opt-out should allow EC"
970970
);
971971
}
972972

973973
#[test]
974-
fn ssc_blocked_us_state_opted_out() {
974+
fn ec_blocked_us_state_opted_out() {
975975
let ctx = ConsentContext {
976976
jurisdiction: Jurisdiction::UsState("CA".to_owned()),
977977
us_privacy: Some(UsPrivacy {
@@ -983,65 +983,65 @@ mod tests {
983983
..ConsentContext::default()
984984
};
985985
assert!(
986-
!allows_ssc_creation(&ctx),
987-
"US state + opt-out should block SSC"
986+
!allows_ec_creation(&ctx),
987+
"US state + opt-out should block EC"
988988
);
989989
}
990990

991991
#[test]
992-
fn ssc_blocked_us_state_gpc_implies_optout() {
992+
fn ec_blocked_us_state_gpc_implies_optout() {
993993
let ctx = ConsentContext {
994994
jurisdiction: Jurisdiction::UsState("CA".to_owned()),
995995
us_privacy: None,
996996
gpc: true,
997997
..ConsentContext::default()
998998
};
999999
assert!(
1000-
!allows_ssc_creation(&ctx),
1001-
"US state + GPC=true with no US Privacy string should block SSC"
1000+
!allows_ec_creation(&ctx),
1001+
"US state + GPC=true with no US Privacy string should block EC"
10021002
);
10031003
}
10041004

10051005
#[test]
1006-
fn ssc_allowed_us_state_no_signals() {
1006+
fn ec_allowed_us_state_no_signals() {
10071007
let ctx = ConsentContext {
10081008
jurisdiction: Jurisdiction::UsState("CA".to_owned()),
10091009
us_privacy: None,
10101010
gpc: false,
10111011
..ConsentContext::default()
10121012
};
10131013
assert!(
1014-
allows_ssc_creation(&ctx),
1015-
"US state + no opt-out signals should allow SSC (opt-out model)"
1014+
allows_ec_creation(&ctx),
1015+
"US state + no opt-out signals should allow EC (opt-out model)"
10161016
);
10171017
}
10181018

10191019
#[test]
1020-
fn ssc_allowed_non_regulated() {
1020+
fn ec_allowed_non_regulated() {
10211021
let ctx = ConsentContext {
10221022
jurisdiction: Jurisdiction::NonRegulated,
10231023
..ConsentContext::default()
10241024
};
10251025
assert!(
1026-
allows_ssc_creation(&ctx),
1027-
"non-regulated jurisdiction should always allow SSC"
1026+
allows_ec_creation(&ctx),
1027+
"non-regulated jurisdiction should always allow EC"
10281028
);
10291029
}
10301030

10311031
#[test]
1032-
fn ssc_allowed_unknown_jurisdiction() {
1032+
fn ec_allowed_unknown_jurisdiction() {
10331033
let ctx = ConsentContext {
10341034
jurisdiction: Jurisdiction::Unknown,
10351035
..ConsentContext::default()
10361036
};
10371037
assert!(
1038-
allows_ssc_creation(&ctx),
1039-
"unknown jurisdiction should allow SSC (no geo data available)"
1038+
allows_ec_creation(&ctx),
1039+
"unknown jurisdiction should allow EC (no geo data available)"
10401040
);
10411041
}
10421042

10431043
#[test]
1044-
fn ssc_us_privacy_not_applicable_allows_ssc() {
1044+
fn ec_us_privacy_not_applicable_allows_ec() {
10451045
let ctx = ConsentContext {
10461046
jurisdiction: Jurisdiction::UsState("VA".to_owned()),
10471047
us_privacy: Some(UsPrivacy {
@@ -1053,8 +1053,8 @@ mod tests {
10531053
..ConsentContext::default()
10541054
};
10551055
assert!(
1056-
allows_ssc_creation(&ctx),
1057-
"US Privacy with opt_out=N/A should allow SSC"
1056+
allows_ec_creation(&ctx),
1057+
"US Privacy with opt_out=N/A should allow EC"
10581058
);
10591059
}
10601060
}

crates/common/src/edge_cookie.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ pub fn generate_ec_id(
6969
settings: &Settings,
7070
req: &Request,
7171
) -> Result<String, Report<TrustedServerError>> {
72+
// Fallback to "unknown" when client IP is unavailable (e.g., local testing).
73+
// All such requests share the same HMAC base; the random suffix provides uniqueness.
7274
let client_ip = req
7375
.get_client_ip_addr()
7476
.map(normalize_ip)
@@ -232,7 +234,7 @@ mod tests {
232234
let req = create_test_request(vec![]);
233235

234236
let ec_id = generate_ec_id(&settings, &req).expect("should generate EC ID");
235-
log::info!("Generated EC ID: {}", ec_id);
237+
log::debug!("Generated EC ID: {}", ec_id);
236238
assert!(
237239
is_ec_id_format(&ec_id),
238240
"should match EC ID format: {{64hex}}.{{6alnum}}"

crates/common/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//! - [`privacy`]: Privacy utilities and helpers
1717
//! - [`settings`]: Configuration management and validation
1818
//! - [`streaming_replacer`]: Streaming URL replacement for large responses
19-
//! - [`ec`]: Edge Cookie (EC) ID generation using HMAC
19+
//! - [`edge_cookie`]: Edge Cookie (EC) ID generation using HMAC
2020
//! - [`test_support`]: Testing utilities and mocks
2121
//! - [`why`]: Debugging and introspection utilities
2222

crates/common/src/openrtb.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ pub struct UserExt {
4949
/// Gated by TCF Purpose 1 (storage) and Purpose 4 (personalized ads).
5050
#[serde(skip_serializing_if = "Option::is_none")]
5151
pub eids: Option<Vec<Eid>>,
52+
/// Whether this EC ID was freshly generated for this request.
53+
///
54+
/// **Breaking change:** this wire field was previously named `synthetic_fresh`.
55+
/// Downstream PBS modules or analytics reading the old name must be updated.
5256
#[serde(skip_serializing_if = "Option::is_none")]
5357
pub ec_fresh: Option<String>,
5458
}

crates/common/src/publisher.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use fastly::http::{header, StatusCode};
33
use fastly::{Body, Request, Response};
44

55
use crate::backend::BackendConfig;
6-
use crate::consent::{allows_ssc_creation, build_consent_context, ConsentPipelineInput};
6+
use crate::consent::{allows_ec_creation, build_consent_context, ConsentPipelineInput};
77
use crate::constants::{COOKIE_TS_EC, HEADER_X_COMPRESS_HINT, HEADER_X_TS_EC};
88
use crate::cookies::{expire_ec_cookie, handle_request_cookies, set_ec_cookie};
99
use crate::edge_cookie::get_or_generate_ec_id;
@@ -264,7 +264,7 @@ pub fn handle_publisher_request(
264264
geo: geo.as_ref(),
265265
ec_id: Some(ec_id.as_str()),
266266
});
267-
let ec_allowed = allows_ssc_creation(&consent_context);
267+
let ec_allowed = allows_ec_creation(&consent_context);
268268
log::debug!("Proxy EC ID: {}, ec_allowed: {}", ec_id, ec_allowed,);
269269

270270
let backend_name = BackendConfig::from_url(

0 commit comments

Comments
 (0)