|
13 | 13 |
|
14 | 14 | Resolution precedence (see :func:`resolve_data_collection`): |
15 | 15 |
|
16 | | -* ``data_collection`` set, ``send_default_pii`` unset -> honor ``data_collection`` |
| 16 | +* ``data_collection`` set, ``send_default_pii`` unset -> honour ``data_collection`` |
17 | 17 | using the spec defaults for any omitted field. |
18 | 18 | * ``send_default_pii`` set, ``data_collection`` unset -> derive a |
19 | 19 | resolved ``DataCollection`` that mirrors what ``send_default_pii`` collects today. |
|
37 | 37 | KeyValueCollectionBehaviour, |
38 | 38 | ) |
39 | 39 |
|
40 | | -#: All valid body types. ``http_bodies`` defaults to this (collect everything the |
| 40 | +#: ``http_bodies`` defaults to this (collect everything the |
41 | 41 | #: platform supports); an empty list is the explicit opt-out. |
42 | 42 | ALL_HTTP_BODY_TYPES = [ |
43 | 43 | "incoming_request", |
@@ -90,20 +90,22 @@ def _map_from_send_default_pii( |
90 | 90 | provided explicitly. |
91 | 91 | """ |
92 | 92 | kv_mode: "Literal['deny_list', 'off']" = "deny_list" if send_default_pii else "off" |
| 93 | + terms = [] if send_default_pii else ["forwarded", "-ip", "remote-", "via", "-user"] |
| 94 | + |
93 | 95 | return { |
94 | 96 | "provided_by_user": False, |
95 | 97 | "user_info": send_default_pii, |
96 | | - "cookies": {"mode": kv_mode}, |
| 98 | + "cookies": {"mode": kv_mode, "terms": terms}, |
97 | 99 | # Headers are collected in both PII modes today (sensitive ones filtered |
98 | 100 | # when PII is off), so this never maps to "off". |
99 | 101 | "http_headers": { |
100 | | - "request": {"mode": "deny_list"}, |
101 | | - "response": {"mode": "deny_list"}, |
| 102 | + "request": {"mode": "deny_list", "terms": terms}, |
| 103 | + "response": {"mode": "deny_list", "terms": terms}, |
102 | 104 | }, |
103 | 105 | # Bodies are collected regardless of PII today, bounded by |
104 | 106 | # ``max_request_body_size``. |
105 | 107 | "http_bodies": list(ALL_HTTP_BODY_TYPES), |
106 | | - "query_params": {"mode": kv_mode}, |
| 108 | + "query_params": {"mode": kv_mode, "terms": terms}, |
107 | 109 | "graphql": {"document": send_default_pii, "variables": send_default_pii}, |
108 | 110 | "gen_ai": {"inputs": send_default_pii, "outputs": send_default_pii}, |
109 | 111 | "database": {"query_params": send_default_pii}, |
|
0 commit comments