Skip to content

Commit 906c3ea

Browse files
authored
Scrub openai project ids and cookies from recordings (#87)
* scrub more sensitive props in recordings * up * more cookies
1 parent 59fd76c commit 906c3ea

43 files changed

Lines changed: 67 additions & 123 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/instructions/instrumentation.instructions.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ prefer opt-in or additive. Breaking changes need explicit justification in the P
6969
(`from opentelemetry.test_util_genai.fixtures import *` and
7070
`from opentelemetry.test_util_genai.vcr import fixture_vcr, scrub_response_headers`). Do not
7171
re-implement in-memory provider/exporter setup or the VCR pretty-print serializer locally.
72+
- When recording VCR cassettes, scrub account-identifying values in the conftest's
73+
`vcr_config` (`filter_headers` for requests, `scrub_response_headers_overwrite` for
74+
responses) before committing. Examples: `authorization`, `openai-organization`,
75+
`openai-project`, `Set-Cookie`, and any response-body field tied to a real
76+
account.
7277
- Conformance: packages ship `tests/conformance/<scenario>.py` modules (each
7378
defining a subclass of
7479
`opentelemetry.test_util_genai.conformance.Scenario` that sets

AGENTS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ Apply to packages under `instrumentation/`.
116116
`opentelemetry.test_util_genai` (`from opentelemetry.test_util_genai.fixtures import *` and
117117
`from opentelemetry.test_util_genai.vcr import fixture_vcr, scrub_response_headers`) rather
118118
than re-implementing provider/exporter/VCR plumbing.
119+
- When recording VCR cassettes, scrub account-identifying values in the conftest's
120+
`vcr_config` (`filter_headers` for requests, `scrub_response_headers_overwrite` for
121+
responses) before committing. Examples: `authorization`, `openai-organization`,
122+
`openai-project`, `Set-Cookie`, and any response-body field tied to a real
123+
account.
119124

120125
### Conformance tests
121126

instrumentation/opentelemetry-instrumentation-genai-anthropic/tests/cassettes/test_sync_messages_stream.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,6 @@ interactions:
128128
- DYNAMIC
129129
request-id:
130130
- req_011CaSta4VpT5jmAHFwkrWEx
131-
set-cookie:
132-
- _cfuvid=fBfT7HzkROiMbhYZZb.a20S2fBiaSuYdrEdkO.cQAAU-1777229654.7651122-1.0.1.1-MTBV4KVg94Wya_bPOQNKc7u6yC1bHmornZk3mDa_jpA;
133-
HttpOnly; SameSite=None; Secure; Path=/; Domain=api.anthropic.com
134131
strict-transport-security:
135132
- max-age=31536000; includeSubDomains; preload
136133
x-envoy-upstream-service-time:

instrumentation/opentelemetry-instrumentation-genai-anthropic/tests/cassettes/test_sync_messages_stream_api_error.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ interactions:
9393
- req_011CaStaVbvatZBsVSEdCNup
9494
server-timing:
9595
- x-originResponse;dur=24
96-
set-cookie:
97-
- _cfuvid=8TQIv3k3c.VCQiwMFKLGgBJhj79YyFhu9LbIIlsvbQA-1777229660.661682-1.0.1.1-uptE0mJmjr5xQDBoWJKx3DLKES6.BVQIhMDo9KANFKM;
98-
HttpOnly; SameSite=None; Secure; Path=/; Domain=api.anthropic.com
9996
strict-transport-security:
10097
- max-age=31536000; includeSubDomains; preload
10198
vary:

instrumentation/opentelemetry-instrumentation-genai-anthropic/tests/cassettes/test_sync_messages_stream_captures_content.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ interactions:
132132
- req_011CaStaA8ttNQuUt57xTZuL
133133
server-timing:
134134
- x-originResponse;dur=1160
135-
set-cookie:
136-
- _cfuvid=MYGinn5q2GajEKA_1ZXEQSMPZFa_pITpAgkkbV8.mqM-1777229656.10707-1.0.1.1-7.CYqTxyXg1Q3PxRwisVM9dNE5a3H9KCY5kZiqcw9qk;
137-
HttpOnly; SameSite=None; Secure; Path=/; Domain=api.anthropic.com
138135
strict-transport-security:
139136
- max-age=31536000; includeSubDomains; preload
140137
vary:

instrumentation/opentelemetry-instrumentation-genai-anthropic/tests/cassettes/test_sync_messages_stream_closed_early_by_caller.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,6 @@ interactions:
130130
- '1154'
131131
request-id:
132132
- req_011CagT1x9aQyaFmxJ5GNARp
133-
set-cookie:
134-
- _cfuvid=FJE3MQyoJt8lkF4.Kt2pCOiULwrAWJefeAJPW3dEadE-1777848447.712399-1.0.1.1-jh2AssDriF8MBsq43fuPcFLny3DvtSkWWHqOo0x8k18;
135-
HttpOnly; SameSite=None; Secure; Path=/; Domain=api.anthropic.com
136133
strict-transport-security:
137134
- max-age=31536000; includeSubDomains; preload
138135
traceresponse:

instrumentation/opentelemetry-instrumentation-genai-anthropic/tests/cassettes/test_sync_messages_stream_delegates_response_attribute.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,6 @@ interactions:
135135
- req_011CaStaGaM4ju6Mv4ateGNY
136136
server-timing:
137137
- x-originResponse;dur=825
138-
set-cookie:
139-
- _cfuvid=vZNYZnqh1dW.Xjsana2i.xalgEY5pro6FXuKaKY9sGI-1777229657.6146472-1.0.1.1-yjjv90xIDiOv1Wz7BgYKITwNZqlds2H57hBPL5y0KNc;
140-
HttpOnly; SameSite=None; Secure; Path=/; Domain=api.anthropic.com
141138
strict-transport-security:
142139
- max-age=31536000; includeSubDomains; preload
143140
vary:

instrumentation/opentelemetry-instrumentation-genai-anthropic/tests/cassettes/test_sync_messages_stream_interrupted_mid_iteration.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,6 @@ interactions:
130130
- '1166'
131131
request-id:
132132
- req_011CagT1sFeNm1tViDNAWHeZ
133-
set-cookie:
134-
- _cfuvid=rj75w_GU5xV9cWP7nOfJwscHGqT_ppwRllzb6fSv0Fw-1777848446.5684419-1.0.1.1-f0Kmq9td0Tj1eY06Rwpq86V7Zainu268u8hWFi4QmtY;
135-
HttpOnly; SameSite=None; Secure; Path=/; Domain=api.anthropic.com
136133
strict-transport-security:
137134
- max-age=31536000; includeSubDomains; preload
138135
traceresponse:

instrumentation/opentelemetry-instrumentation-genai-anthropic/tests/cassettes/test_sync_messages_stream_user_exception.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ interactions:
132132
- req_011CaStbsWaJNdwuqs2rpEZu
133133
server-timing:
134134
- x-originResponse;dur=874
135-
set-cookie:
136-
- _cfuvid=BaJxW_3cagsuNsmTXrSvzGLeKMfyRWc3_0Gowfc3JHk-1777229679.3546934-1.0.1.1-qSr2meNp_OQHOJ_LjwDvlghr6BtUGC6_SQHghI5eSjo;
137-
HttpOnly; SameSite=None; Secure; Path=/; Domain=api.anthropic.com
138135
strict-transport-security:
139136
- max-age=31536000; includeSubDomains; preload
140137
vary:

instrumentation/opentelemetry-instrumentation-genai-anthropic/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def vcr_config():
4242
],
4343
"decode_compressed_response": True,
4444
"before_record_response": scrub_response_headers(
45-
["anthropic-organization-id"]
45+
["anthropic-organization-id", "set-cookie"]
4646
),
4747
}
4848

0 commit comments

Comments
 (0)