Skip to content

Commit f03d1c2

Browse files
committed
Add "Expire" operation for cookies
1 parent 29d0502 commit f03d1c2

4 files changed

Lines changed: 32 additions & 13 deletions

File tree

FiddlerImportNetlog/FiddlerInterface.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace FiddlerImportNetlog
1010
{
1111
[ProfferFormat("NetLog JSON",
12-
"Chromium's JSON-based event log format (v1.3.5.1). See https://textslashplain.com/2020/01/17/capture-network-logs-from-edge-and-chrome/ for more info.",
12+
"Chromium's JSON-based event log format (v1.3.6). See https://textslashplain.com/2020/01/17/capture-network-logs-from-edge-and-chrome/ for more info.",
1313
// We handle import of JSON files, whether uncompressed, or compressed with ZIP or GZ. I'm not completely sure I remember the implications
1414
// of declaring .gz here, nor why .zip isn't mentioned. Is this about the drag/drop import feature?
1515
".json;.gz"

FiddlerImportNetlog/Importer.cs

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,17 +1444,28 @@ private void ParseSessionsFromBucket(KeyValuePair<int, List<Hashtable>> kvpUR)
14441444
// bool bIsLegacyCookie = (htParams["msft_browser_legacy_cookie"] as Boolean) ?? false;
14451445
// string bBrowserProvenance = (htParams["browser_provenance"] as string) ?? String.Empty /*Native*/;
14461446

1447-
// TODO: As of Chrome 81, CookieInclusionStatusNetLogParams also adds |domain| and |path| attributes available if "sensitive" data is included.
1447+
// TODO: As of Chrome 81, CookieInclusionStatusNetLogParams also adds |domain| and |path| attributes available if "sensitive" data is included.
14481448

1449-
// In Chrome 81.3993, the |exclusion_reason| field was renamed to |status| because the |cookie_inclusion_status| entries are
1450-
// now also emitted for included cookies.
1451-
string sExclusionReasons = (htParams["exclusion_reason"] as string);
1452-
if (String.IsNullOrEmpty(sExclusionReasons)) sExclusionReasons = (htParams["status"] as string) ?? String.Empty;
1449+
// In Chrome 81.3993, the |exclusion_reason| field was renamed to |status| because the |cookie_inclusion_status| entries are
1450+
// now also emitted for included cookies.
1451+
string sExclusionReasons = (htParams["exclusion_reason"] as string);
1452+
if (String.IsNullOrEmpty(sExclusionReasons)) sExclusionReasons = (htParams["status"] as string) ?? String.Empty;
14531453

14541454
// If the log indicates that the cookie was included, just skip it for now.
1455-
// TODO: Offer a richer cookie-debugging story that exposes the domain/path/inclusion status.
14561455
// https://source.chromium.org/chromium/chromium/src/+/master:net/cookies/canonical_cookie.cc;l=899?q=GetDebugString%20cookie&ss=chromium&originalUrl=https:%2F%2Fcs.chromium.org%2F
1457-
if (sExclusionReasons.OICContains("include")) continue;
1456+
if (sExclusionReasons.OICContains("include"))
1457+
{
1458+
if ("expire" == sOperation)
1459+
{
1460+
// EXCLUDE_INVALID_DOMAIN,EXCLUDE_OVERWRITE_HTTP_ONLY,EXCLUDE_OVERWRITE_SECURE,
1461+
// EXCLUDE_FAILURE_TO_STORE (e.g. Set-Cookie header > 4096 characters),
1462+
// EXCLUDE_NONCOOKIEABLE_SCHEME,EXCLUDE_INVALID_PREFIX
1463+
listCookieSetExclusions.Add(String.Format("The cookie '{0}' was sent already expired.", sCookieName));
1464+
}
1465+
1466+
// TODO: Offer a richer cookie-debugging story that exposes the domain/path/inclusion status.
1467+
continue;
1468+
}
14581469

14591470
// See |ExclusionReason| list in https://cs.chromium.org/chromium/src/net/cookies/canonical_cookie.h?type=cs&q=EXCLUDE_SAMESITE_LAX&sq=package:chromium&g=0&l=304
14601471
// EXCLUDE_HTTP_ONLY, EXCLUDE_SECURE_ONLY,EXCLUDE_DOMAIN_MISMATCH,EXCLUDE_NOT_ON_PATH,EXCLUDE_INVALID_PREFIX
@@ -1469,6 +1480,10 @@ private void ParseSessionsFromBucket(KeyValuePair<int, List<Hashtable>> kvpUR)
14691480
// EXCLUDE_NONCOOKIEABLE_SCHEME,EXCLUDE_INVALID_PREFIX
14701481
listCookieSetExclusions.Add(String.Format("Blocked set of '{0}' due to '{1}'", sCookieName, sExclusionReasons));
14711482
}
1483+
else if ("expire" == sOperation)
1484+
{
1485+
listCookieSetExclusions.Add(String.Format("Blocked expire (set) of '{0}' due to '{1}'", sCookieName, sExclusionReasons));
1486+
}
14721487
else if ("send" == sOperation)
14731488
{
14741489
// Don't warn about cookies which are obviously inapplicable
@@ -1552,7 +1567,7 @@ private void ParseSessionsFromBucket(KeyValuePair<int, List<Hashtable>> kvpUR)
15521567
bool bCookieSetFailed = listCookieSetExclusions.Count > 0;
15531568
if (bCookieSetFailed) {
15541569
dictSessionFlags["ui-backcolor"] = "#FF8080";
1555-
dictSessionFlags["ui-comments"] = "A Set-Cookie was ignored";
1570+
dictSessionFlags["ui-comments"] = "A cookie set by Set-Cookie was not stored.";
15561571
AnnotateHeadersWithUnstoredCookies(oRPH, listCookieSetExclusions);
15571572
}
15581573
BuildAndAddSession(ref oSF, oRQH, oRPH, msResponseBody, dictSessionFlags, sURL, sMethod, oTimers, cbDroppedResponseBody);
@@ -1573,7 +1588,7 @@ private static void AnnotateHeadersWithUnstoredCookies(HTTPResponseHeaders oRPH,
15731588
if (null == oRPH) return;
15741589
foreach (string sExclusion in listExclusions)
15751590
{
1576-
oRPH.Add("$NETLOG-CookieNotSet", sExclusion);
1591+
oRPH.Add("$NETLOG-CookieNotStored", sExclusion);
15771592
}
15781593

15791594
listExclusions.Clear();

FiddlerImportNetlog/Properties/AssemblyInfo.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
[assembly: AssemblyTitle("FiddlerImportNetlog")]
55
[assembly: AssemblyDescription("Import Chromium NetLog events to Fiddler")]
6-
[assembly: AssemblyCopyright("Copyright ©2024 Eric Lawrence")]
6+
[assembly: AssemblyCopyright("Copyright ©2025 Eric Lawrence")]
77
[assembly: System.Resources.NeutralResourcesLanguage("en-US")]
88
[assembly: ComVisible(false)]
9-
[assembly: AssemblyVersion("1.3.5.1")] // ALWAYS UPDATE THE VERSION in the [ProfferFormat] attribute in FiddlerInterface.cs to match!
9+
[assembly: AssemblyVersion("1.3.6.0")] // ALWAYS UPDATE THE VERSION in the [ProfferFormat] attribute in FiddlerInterface.cs to match!
1010
[assembly: Fiddler.RequiredVersion("4.6.0.0")]
1111

1212

@@ -20,6 +20,10 @@ HTTP_STREAM_JOB has a binding between the request and the socket. Hook them up s
2020
--> source_dependency = 1701 (URL_REQUEST)
2121
*/
2222

23+
// v.1.3.6.0
24+
// Support "expire" for cookies (added in Chrome 134)
25+
// Update copyright to 2025
26+
2327
// v.1.3.5.1
2428
// Add support for truncated file recovery.
2529

installer/FiddlerImportNetLog.nsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ VIProductVersion "${VER_ADDON}"
1616
VIAddVersionKey "FileVersion" "${VER_ADDON}"
1717
VIAddVersionKey "ProductName" "Fiddler NetLog Importer"
1818
VIAddVersionKey "Comments" "https://textslashplain.com/"
19-
VIAddVersionKey "LegalCopyright" "©2023 Eric Lawrence"
19+
VIAddVersionKey "LegalCopyright" "©2025 Eric Lawrence"
2020
VIAddVersionKey "CompanyName" "Eric Lawrence"
2121
VIAddVersionKey "FileDescription" "Installer for Fiddler Fiddler NetLog Importer"
2222

0 commit comments

Comments
 (0)