Skip to content

Commit 55e7b5f

Browse files
committed
addressing comment
1 parent fa9edf6 commit 55e7b5f

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

nylas/resources/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def _build_query(config: dict) -> dict:
3535
if "scope" in config:
3636
config["scope"] = " ".join(config["scope"])
3737

38-
if config.get("smtp_required"):
38+
if config.pop("smtp_required", None):
3939
config["options"] = "smtp_required"
4040

4141
return config

tests/resources/test_auth.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def test_build_query_with_smtp_required_true(self):
4545
}
4646
result = _build_query(config)
4747
assert result["options"] == "smtp_required"
48+
assert "smtp_required" not in result # must not leak into URL params
4849

4950
def test_build_query_smtp_required_false_omits_options(self):
5051
config = {
@@ -83,6 +84,7 @@ def test_build_query_with_pkce_and_smtp_required(self):
8384
}
8485
result = _build_query_with_pkce(config, "secret-hash-123")
8586
assert result["options"] == "smtp_required"
87+
assert "smtp_required" not in result # must not leak into URL params
8688
assert result["code_challenge"] == "secret-hash-123"
8789
assert result["code_challenge_method"] == "s256"
8890

0 commit comments

Comments
 (0)