Skip to content

Commit 0b33664

Browse files
committed
fix: mask password in __repr__, remove redundant clean_message in _send_bulk (v0.7.38)
Security audit fixes: KwtSMS and AsyncKwtSMS now mask password in repr() output. Removed redundant clean_message() call in _send_bulk() since send() already cleans before passing to it.
1 parent f5ef555 commit 0b33664

4 files changed

Lines changed: 14 additions & 3 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "kwtsms"
3-
version = "0.7.37"
3+
version = "0.7.38"
44
description = "Python client for kwtSMS, the Kuwait SMS gateway trusted by top businesses to deliver messages worldwide, with private Sender ID, free API testing, and non-expiring credits."
55
readme = "README.md"
66
requires-python = ">=3.8"

src/kwtsms/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626
__all__ = ["KwtSMS", "AsyncKwtSMS", "normalize_phone", "clean_message",
2727
"validate_phone_input", "parse_webhook",
2828
"find_country_code", "validate_phone_format"]
29-
__version__ = "0.7.37"
29+
__version__ = "0.7.38"

src/kwtsms/_async.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ def __init__(self, username: str, password: str, sender_id: str = "KWT-SMS",
106106
self._cached_balance: Optional[float] = None
107107
self._cached_purchased: Optional[float] = None
108108

109+
def __repr__(self) -> str:
110+
return (
111+
f"AsyncKwtSMS(username={self.username!r}, password='***', "
112+
f"sender_id={self.sender_id!r}, test_mode={self.test_mode!r})"
113+
)
114+
109115
@classmethod
110116
def from_env(cls, env_file: str = ".env") -> "AsyncKwtSMS":
111117
"""Load credentials from environment variables, falling back to .env file."""

src/kwtsms/_core.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,12 @@ def __init__(
634634
self._cached_balance: Optional[float] = None
635635
self._cached_purchased: Optional[float] = None
636636

637+
def __repr__(self) -> str:
638+
return (
639+
f"KwtSMS(username={self.username!r}, password='***', "
640+
f"sender_id={self.sender_id!r}, test_mode={self.test_mode!r})"
641+
)
642+
637643
@classmethod
638644
def from_env(cls, env_file: str = ".env") -> "KwtSMS":
639645
"""
@@ -1009,7 +1015,6 @@ def _send_bulk(self, numbers: List[str], message: str, sender: str) -> dict:
10091015
BATCH_DELAY = 0.5
10101016
ERR013_WAIT = [30, 60, 120]
10111017

1012-
message = clean_message(message)
10131018
batches = [numbers[i:i + BATCH_SIZE] for i in range(0, len(numbers), BATCH_SIZE)]
10141019
total_batches = len(batches)
10151020

0 commit comments

Comments
 (0)