warmpath 0.3.0__tar.gz → 0.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {warmpath-0.3.0 → warmpath-0.3.1}/PKG-INFO +1 -1
- {warmpath-0.3.0 → warmpath-0.3.1}/pyproject.toml +1 -1
- {warmpath-0.3.0 → warmpath-0.3.1}/tests/test_auth.py +38 -0
- {warmpath-0.3.0 → warmpath-0.3.1}/uv.lock +1 -1
- {warmpath-0.3.0 → warmpath-0.3.1}/warmpath/auth.py +5 -3
- {warmpath-0.3.0 → warmpath-0.3.1}/.gitignore +0 -0
- {warmpath-0.3.0 → warmpath-0.3.1}/AGENTS.md +0 -0
- {warmpath-0.3.0 → warmpath-0.3.1}/README.md +0 -0
- {warmpath-0.3.0 → warmpath-0.3.1}/Taskfile.yaml +0 -0
- {warmpath-0.3.0 → warmpath-0.3.1}/UNLICENSE +0 -0
- {warmpath-0.3.0 → warmpath-0.3.1}/docs/skill.md +0 -0
- {warmpath-0.3.0 → warmpath-0.3.1}/scripts/release.sh +0 -0
- {warmpath-0.3.0 → warmpath-0.3.1}/tests/test_cli_commands.py +0 -0
- {warmpath-0.3.0 → warmpath-0.3.1}/tests/test_mutual_connections.py +0 -0
- {warmpath-0.3.0 → warmpath-0.3.1}/warmpath/__init__.py +0 -0
- {warmpath-0.3.0 → warmpath-0.3.1}/warmpath/cli.py +0 -0
- {warmpath-0.3.0 → warmpath-0.3.1}/warmpath.jpg +0 -0
|
@@ -50,6 +50,43 @@ def test_import_reads_only_the_selected_browser(browser, browser_cookies, monkey
|
|
|
50
50
|
assert auth.load_auth().browser == browser
|
|
51
51
|
|
|
52
52
|
|
|
53
|
+
@pytest.mark.parametrize("secure", [0, 1])
|
|
54
|
+
def test_browser_cookie_integer_secure_flag_round_trips(secure, reader, browser_cookies, auth_path):
|
|
55
|
+
# browser-cookie3 passes Chrome's SQLite integer flags through to Cookie.
|
|
56
|
+
for cookie in list(browser_cookies):
|
|
57
|
+
browser_cookies.set_cookie(auth.browser_cookie3.create_cookie(
|
|
58
|
+
cookie.domain, cookie.path, secure, cookie.expires,
|
|
59
|
+
cookie.name, cookie.value, True,
|
|
60
|
+
))
|
|
61
|
+
|
|
62
|
+
cli.main(["auth", "import", "--browser", "chrome"])
|
|
63
|
+
cli.main(["auth", "status"])
|
|
64
|
+
|
|
65
|
+
payload = json.loads(auth_path.read_text())
|
|
66
|
+
assert all(record["secure"] is bool(secure) for record in payload["cookies"])
|
|
67
|
+
assert auth.load_cookies().get_dict() == browser_cookies.get_dict()
|
|
68
|
+
assert all(cookie.secure is bool(secure) for cookie in auth.load_cookies())
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@pytest.mark.parametrize("secure", [0, 1])
|
|
72
|
+
def test_existing_integer_secure_flags_load_without_reimport(secure, reader, auth_path):
|
|
73
|
+
auth.import_browser("chrome")
|
|
74
|
+
payload = json.loads(auth_path.read_text())
|
|
75
|
+
for record in payload["cookies"]:
|
|
76
|
+
record["secure"] = secure
|
|
77
|
+
auth_path.write_text(json.dumps(payload))
|
|
78
|
+
before = auth_path.read_bytes()
|
|
79
|
+
reader.reset_mock()
|
|
80
|
+
|
|
81
|
+
cli.main(["auth", "status"])
|
|
82
|
+
cookies = auth.load_cookies()
|
|
83
|
+
|
|
84
|
+
assert not auth.load_auth().missing_cookies()
|
|
85
|
+
assert all(cookie.secure is bool(secure) for cookie in cookies)
|
|
86
|
+
assert auth_path.read_bytes() == before
|
|
87
|
+
reader.assert_not_called()
|
|
88
|
+
|
|
89
|
+
|
|
53
90
|
def test_import_filters_unrelated_expired_and_out_of_scope_cookies(reader, browser_cookies, auth_path):
|
|
54
91
|
for name, domain, path, expires, value in [
|
|
55
92
|
("tracking", ".linkedin.com", "/", None, "unrelated-tracking-token"),
|
|
@@ -215,6 +252,7 @@ def test_corrupt_store_has_reimport_guidance(content, auth_path, capsys):
|
|
|
215
252
|
|
|
216
253
|
@pytest.mark.parametrize("field,value", [
|
|
217
254
|
("domain", "example.org"), ("path", "/jobs"), ("secure", "true"),
|
|
255
|
+
("secure", 2), ("secure", -1), ("secure", 0.0), ("secure", 1.0), ("secure", None),
|
|
218
256
|
("expires", "tomorrow"), ("expires", 10**20),
|
|
219
257
|
("domain_specified", False), ("value", "token\r\nInjected: header"),
|
|
220
258
|
])
|
|
@@ -93,7 +93,7 @@ def save_auth(session: AuthSession) -> None:
|
|
|
93
93
|
"domain": cookie.domain,
|
|
94
94
|
"domain_specified": cookie.domain_specified,
|
|
95
95
|
"path": cookie.path,
|
|
96
|
-
"secure": cookie.secure,
|
|
96
|
+
"secure": bool(cookie.secure),
|
|
97
97
|
"expires": cookie.expires,
|
|
98
98
|
}
|
|
99
99
|
for cookie in session.cookies
|
|
@@ -173,7 +173,9 @@ def load_auth() -> AuthSession:
|
|
|
173
173
|
not isinstance(record.get(key), str)
|
|
174
174
|
for key in ("name", "value", "domain", "path")
|
|
175
175
|
)
|
|
176
|
-
|
|
176
|
+
# Older imports saved browser-cookie3's integer 0/1 Secure flag.
|
|
177
|
+
or type(record.get("secure")) not in (bool, int)
|
|
178
|
+
or record["secure"] not in (0, 1)
|
|
177
179
|
or type(record.get("domain_specified")) is not bool
|
|
178
180
|
or (
|
|
179
181
|
record.get("expires") is not None
|
|
@@ -186,7 +188,7 @@ def load_auth() -> AuthSession:
|
|
|
186
188
|
value=record["value"],
|
|
187
189
|
domain=record["domain"],
|
|
188
190
|
path=record["path"],
|
|
189
|
-
secure=record["secure"],
|
|
191
|
+
secure=bool(record["secure"]),
|
|
190
192
|
expires=record.get("expires"),
|
|
191
193
|
)
|
|
192
194
|
cookie.domain_specified = record["domain_specified"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|