Zum Hauptinhalt springen
LIVE
CVSS 6.5CVE-2026-111315 | The Smaily Connect plugin for WordPress is vulnerable to Insecure Direct Object Reference in versions up to, and including, 3.24.0 This is due to the smaily_get_edit_user_id() function reading an attacker-controlled $_GET['user_id'] parameter without performing any ownership or capability check, and then feeding that id into smaily_get_userdata() (which calls get_user_meta()) when rendering the WooCommerce My Account 'edit-account' form via the smaily_print_CVSS 6.4CVE-2026-137713 | Webmin through 2.670 before ae8feb1 allows XSS via an SVG attachment in a mail queue, relevant if an authenticated user uploads an SVG document and an administrator views it.CVSS 6.9CVE-2026-137678 | A security vulnerability has been detected in code-projects Online Job Portal 1.0. Affected by this issue is some unknown functionality of the file Admin/InsertUser.php. Such manipulation of the argument txtUserName/txtPassword leads to sql injection. The attack can be launched remotely. The exploit has been disclosed publicly and may be used.CVSS 5.3CVE-2026-137703 | Flask-AppBuilder before 5.3.1 contains a path traversal vulnerability in ImageManager.save_file that allows authenticated users to write image files outside IMG_UPLOAD_FOLDER via unsanitized multipart filenames. Attackers with add or edit permission on a ModelView with an ImageColumn can upload filenames containing ../ segments to create or overwrite image files like static assets.CVSS 6.1CVE-2026-130039 | The LiteSpeed Cache plugin for WordPress is vulnerable to Stored Cross-Site Scripting via the 'REQUEST_URI' parameter in all versions up to, and including, 7.9.3 due to insufficient input sanitization and output escaping. This makes it possible for unauthenticated attackers to inject arbitrary web scripts in pages that will execute whenever a user accesses an injected page. Successful exploitation requires comments to be open, a comment author name containinCVSS 6.1CVE-2026-136206 | The Export Products, Orders & Customers for WooCommerce plugin for WordPress is vulnerable to Reflected Cross-Site Scripting via the 'start_date' parameter in all versions up to, and including, 2.4.3 due to insufficient input sanitization and output escaping. This makes it possible for unauthenticated attackers to inject arbitrary web scripts in pages that execute if they can successfully trick a user into performing an action such as clicking on a link. SucCVSS 9.4CVE-2026-137706 | Smart Portal developed by Direk Tech has a Missing Authorization vulnerability. Authenticated remote attackers can add a specified account to the Active Directory Domain Admins group, thereby obtaining domain administrator privileges.CVSS 8.7CVE-2026-137705 | Smart Portal developed by Direk Tech has an Arbitrary File Read vulnerability.Unauthenticated remote attackers can exploit Relative Path Traversal to download arbitrary system files.
Alle im Drawer
Intelligence View
⚡ tsecurity.de Intelligence

The Python exception that leaked tenant secrets

I was lying in my four-year-old's bed at 8:30 PM (long story, Spider-Man was involved) when a Slack message came in: yoo, we're logging all tenant config…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Quelle & Fakten · 10 Min. Lesezeit
Quelle: dev.to
Rubrik: Sichere Programmierung

I was lying in my four-year-old's bed at 8:30 PM (long story, Spider-Man was involved) when a Slack message came in:




yoo, we're logging all tenant config secrets in plain text in prod




Not dev. Not staging. Production. Tenant config. Plain text.



The line that surfaced it was raise e. But switching that to bare raise would not have prevented the incident. The secret was already baked into the exception message string before the raise happened. raise e was the symptom. The actual problem was that nobody had decided what the config object was allowed to look like in a log.



That's what this article is about.









What raise e does and why it matters here



When you write this:




try:
result = process_tenant_config(config)
except Exception as e:
logger.exception("Failed during tenant processing")
raise e






Python re-raises the exception bound to e. But the more common leak path is simpler than that: a sensitive object gets interpolated into the exception message string before the raise even happens.



This can happen two ways. The object itself gets interpolated:




raise ValueError(f"Failed processing config for {config}")






Or fields get pulled out directly, which leaks regardless of what __repr__ does:




raise ValueError(
f"Failed processing tenant={config.tenant_id} api_key={config.api_key}"
)






In the first case, Python calls repr(config) to build the string. For a plain Python class, the default repr is <TenantConfig object at 0x...>, which is safe. The risk shows up when you're using dataclasses, attrs, Pydantic, or any framework that generates a field-level repr automatically. Those are designed to be helpful for debugging, so they serialize everything by default:




from dataclasses import dataclass

@dataclass
class TenantConfig:
tenant_id: str
api_key: str
webhook_secret: str

config = TenantConfig("t-123", "sk-secret", "whsec-secret")
print(repr(config))
# TenantConfig(tenant_id='t-123', api_key='sk-secret', webhook_secret='whsec-secret')






By default, dataclasses include every field in their generated __repr__, which is great for debugging but dangerous when the model contains credentials, tokens, API keys, or other secrets.



Whatever repr(config) returns gets baked into the exception message. That string is what logger.exception() logs verbatim as part of the traceback. By the time raise e runs, the damage is already done.



The reason raise e shows up in this story at all is that it made the handler look intentional and correct during code review. It is valid Python. It does what it says. Nothing about it flags as wrong. But it was sitting in an error path that, after a new configuration feature was deployed, started routing failures through a handler that had a TenantConfig in scope. The config object ended up in the exception message. The exception message ended up in the logs. Two days of tenant secrets, in plain text, faithfully recorded.



The sleeping data leak woke up.









Why this class of bug is hard to catch



The four things that combined to cause the incident:




  1. An object with sensitive data in scope

  2. Code somewhere that interpolated that object into an exception message

  3. A logging setup that captured exception context

  4. A code path change that connected all three for the first time



Any one of those in isolation is fine. Logging exceptions is correct. Having sensitive objects in your codebase is unavoidable. Code path changes happen in every deploy. The problem is that there's no obvious place to look for this combination, and it can sit quietly for a long time before the right conditions arrive.



This is exactly the kind of thing code review misses, because each individual piece looked normal.









Safeguard 1: control what your objects look like when serialized



This is the fix that actually holds. If a sensitive object can never serialize its secrets, it doesn't matter how it ends up in an exception message or a log statement. That's because the leak can't happen.



Give sensitive models an explicit __repr__ that only includes what you'd be comfortable seeing in a log:




class TenantConfig:
def __init__(self, tenant_id, api_key, webhook_secret, integration_type):
self.tenant_id = tenant_id
self.api_key = api_key
self.webhook_secret = webhook_secret
self.integration_type = integration_type

def __repr__(self):
return (
f"TenantConfig("
f"tenant_id={self.tenant_id!r}, "
f"integration_type={self.integration_type!r}"
f")"
)

def __str__(self):
return self.__repr__()






Now f"Failed processing {config}" produces "Failed processing TenantConfig(tenant_id='t-123', integration_type='webhook')". No API key. No webhook secret. No matter what exception handler it passes through or what logging setup captures it.



This is the fix you want because it's unconditional. You're not relying on everyone who touches the codebase to remember to sanitize before logging. The object itself is safe by default.



If you're using Pydantic, SecretStr handles individual secret fields at the field level. It masks the value in repr and str by default, showing SecretStr('**********'), and requires .get_secret_value() to access the raw string:




from pydantic import BaseModel, SecretStr

class TenantConfig(BaseModel):
tenant_id: str
api_key: SecretStr
webhook_secret: SecretStr
integration_type: str

def __repr__(self):
return f"TenantConfig(tenant_id={self.tenant_id!r}, integration_type={self.integration_type!r})"






If you want to suppress specific fields from Pydantic's default repr without replacing the whole thing, Field(repr=False) does it per field:




from pydantic import BaseModel, Field

class TenantConfig(BaseModel):
tenant_id: str
api_key: str = Field(repr=False)
webhook_secret: str = Field(repr=False)
integration_type: str












Safeguard 2: sanitize at the logging layer



Repr control on the model is your first line of defense. A logging sanitizer is the catch-all for anything that slips through, including cases where someone logs a dict of config values directly rather than the model object.




import logging

SENSITIVE_KEYS = frozenset({
"api_key", "secret", "token", "password",
"credential", "webhook_secret", "private_key",
})

class SanitizingFilter(logging.Filter):
def filter(self, record: logging.LogRecord) -> bool:
if isinstance(record.args, dict):
record.args = self._sanitize(record.args)
return True

def _sanitize(self, data: dict) -> dict:
return {
k: "***REDACTED***" if k in SENSITIVE_KEYS else v
for k, v in data.items()
}

logging.getLogger().addFilter(SanitizingFilter())






Worth knowing: this filter only intercepts record.args when it's a dict, which only happens with %-style dict formatting:




logger.error("api_key=%(api_key)s", {"api_key": "sk-secret"})  # filter works
logger.error(f"api_key={api_key}") # filter does nothing
logger.error("api_key=%s", api_key) # filter does nothing






With f-strings, the message is fully formatted before the log record is created, so record.args is an empty tuple by the time the filter runs. Most modern Python logging uses f-strings, so treat this as a safety net for dict-style structured logging, not a complete solution on its own.



For structlog, add a processor instead:




import structlog

SENSITIVE_KEYS = frozenset({
"api_key", "secret", "token", "password",
"credential", "webhook_secret", "private_key",
})

def sanitize_processor(logger, method, event_dict):
for key in SENSITIVE_KEYS:
if key in event_dict:
event_dict[key] = "***REDACTED***"
return event_dict

structlog.configure(
processors=[
sanitize_processor,
structlog.processors.JSONRenderer(),
]
)






The structlog version is more useful in practice because structured logging tends to pass data as explicit key-value pairs, which means the processor actually sees the fields. The stdlib filter is most useful when you have existing code passing dicts to logger.error().









Safeguard 3: write the tests



This is the piece that prevents the next version of this incident. Without tests, a future refactor can quietly undo a safe __repr__, and nobody notices until the logs tell them.




def test_tenant_config_repr_does_not_expose_secrets():
config = TenantConfig(
tenant_id="tenant-abc",
api_key="sk-super-secret-do-not-log",
webhook_secret="whsec-also-secret",
integration_type="webhook",
)
config_repr = repr(config)

assert "sk-super-secret-do-not-log" not in config_repr
assert "whsec-also-secret" not in config_repr
assert "tenant-abc" in config_repr


def test_tenant_config_str_does_not_expose_secrets():
config = TenantConfig(
tenant_id="tenant-abc",
api_key="sk-super-secret-do-not-log",
webhook_secret="whsec-also-secret",
integration_type="webhook",
)
assert "sk-super-secret-do-not-log" not in str(config)


def test_exception_containing_tenant_config_does_not_expose_secrets():
config = TenantConfig(
tenant_id="tenant-abc",
api_key="sk-super-secret-do-not-log",
webhook_secret="whsec-also-secret",
integration_type="webhook",
)
try:
raise ValueError(f"Processing failed for {config}")
except ValueError as e:
assert "sk-super-secret-do-not-log" not in str(e)






The third test is the important one. It explicitly verifies what happens when the config object ends up in an exception message, which is the exact path that caused the original leak. It's two minutes to write and it would have caught this before it reached production.









When secrets are already in your logs



Once they're there, the engineering fix is the easy part. The harder conversation is what to do about the data that already exists.



Logs in production systems are not one thing. They're in your log aggregator, your SIEM, long-term retention storage, compliance archives, monitoring pipelines that may have already exported them somewhere downstream. "Scrub the logs" means figuring out every place those logs landed and understanding what deletion looks like in each one.



Some systems have APIs for deletion. Some have retention policies that make deletion complicated or impossible. Some require opening a support ticket with a vendor. Some require you to accept that the data exists, document it, and focus on reducing exposure going forward.



What you don't want to be figuring out for the first time at midnight during an active incident:




  • Where do your logs go? All destinations, not just the primary one.

  • Who owns each destination?

  • What are your deletion options per system?

  • Do you have a compliance obligation to notify anyone if production secrets are exposed, and what's the notification window?



Rotate the secrets regardless. Treat anything that was in the logs as potentially compromised even without evidence of access. That's standard practice, not an overreaction. Just do it deliberately: a middle-of-the-night rotation done hastily can break customer integrations, which is its own incident. Build the plan, communicate it, execute it carefully.









The actual architectural problem



Logging is treated like a default in most codebases. A thing that happens rather than a thing that's decided. You add logger.exception() when debugging, it stays, and nobody ever asks: what does this object actually look like when it gets serialized?



That's the question that needs to be on your design checklist for any model that touches secrets. Not as an afterthought when something leaks. As part of building the model.



__repr__ is not just for debugging. It's the contract your object has with anything that might serialize it. The danger isn't Python's default object repr — <TenantConfig object at 0x...> is actually fairly safe. The danger is the moment a framework, dataclass, model library, or custom implementation starts serializing fields automatically. At that point, you've implicitly made a decision about what belongs in logs, whether you meant to or not.









Quick checklist



When building a model that handles secrets:




  • For models that may be serialized into logs, define __repr__ and __str__ explicitly rather than relying on framework-generated defaults.

  • Use SecretStr (Pydantic) or Field(repr=False) for individual secret fields.

  • Write a test that asserts secret values don't appear in repr(), str(), or exception messages containing the object.



At the logging layer:




  • Add a sanitizing filter or structlog processor that redacts known sensitive keys.

  • Know what exc_info=True and logger.exception() actually serialize in your stack.

  • Understand the f-string limitation: pre-formatted messages bypass field-level filters.



Before you have an incident:




  • Map where your logs go. All of them.

  • Know your deletion options per destination.

  • Know your compliance notification obligations and timelines.






This is loosely based on a real incident I talked through in Episode 8 of Chaotic Commits. Ghost Spider made it out fine.

Information ergänzen Fachhinweis, Update, Korrektur oder Quelle zur Meldung beitragen
Gäste-Hinweise werden kurz redaktionell geprüft und danach hier angezeigt.

Community-Hinweise zur Meldung

0 freigegeben
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!
Informations-Bewertung:

💬 Community-Diskussion & Kommentare

🌐 Zum Hauptchat

Starte die Diskussion im Social-Chat Broadcast Stream oder reiche oben über „Information ergänzen“ einen Fachbeitrag ein.

Community Rating &amp; Social Proof
⭐ Leser-Wertung
–
Ø / 5.0
Noch keine Leser-Bewertungen
War dieser Artikel hilfreich?
0
Jetzt Bewertung abgeben
Detail-Bewertung (optional)
Inhalt & Qualität
Quelle & Glaubwürdigkeit
Aktualität
Security Briefing Kostenlos · 1-Klick-Abmeldung

Intelligence Digest — kostenlos

Täglich die wichtigsten Security-News · jederzeit abbestellbar

Verwandte Story-Cluster & Quellen (Vektor-KI)

6 Cluster
44 Quellen
Best Black Friday home office deals 2026 — save on our top-tested work essentials from Herman Miller, FlexiSpot, Logitech, Epson and more
Latest from TechRadar vor 19 Min.
43 weitere Quellen
Latest from TechRadarvor 17 Min.Sony WH-1000XM6 just hit a record-low price — now it's Black Friday Latest from TechRadarvor 12 Min.Lenovo's Copilot+ IdeaPad Slim 3 with 16GB RAM and a 512GB SSD is £350 off for Black Friday The Vergevor 7 Min.Our favorite headphones and earbuds are cheaper than ever ahead of Black Friday Computer Bildvor 21 Min.Black Friday: Live-Show ab 16 Uhr – die besten Deals t3n.devor 22 Min.Black Friday: Alle guten Angebote zu Apple, Samsung, Fritz und Co. in der Übersicht Golem.devor 13 Min.Anzeige: Google Pixel 10a am Black Friday bei Amazon erstmals unter 380 Euro COMPUTER BILDvor 1 Std.COMPUTER BILD: Die Deal-Checker! BLACK FRIDAY 2026 WIREDvor 32 Min.The Best Black Friday Streaming Deals (2026): Apple TV, Disney, Paramount, and More GamingOnLinux Latest Articl…vor 39 Min.itch.io Creator Day & Black Friday 2026 sale is live Latest from TechRadarvor 47 Min.Best Black Friday MacBook Air deals: biggest discounts on Apple's thin and light laptop range Latest from TechRadarvor 37 Min.Proton VPN vs ExpressVPN – which secure VPN should you pick this Black Friday? WIREDvor 9 Std.The 108 Best Black Friday Deals Are Now Live: Our Expert Picks for 2026 WIREDvor 44 Min.20 Best Black Friday Tech Deals (2026) WIREDvor 42 Min.The 10 Best Black Friday TV Deals (2026): Save Up to 53% Off Giga.devor 33 Min.Black Friday 2026 bei Back Market: Dyson, Ninja und GoPro jetzt deutlich günstiger Cyber Security Newsvor 1 Std.Black Friday or Black Fraud Day? 7 Cyber Traps to Watch Out for Before You Click ‘Buy’ CNETvor 2 TagenLive: Black Friday Is Here. Shop Our Favorite Deals and Save Up to 60% Apple, Anker, Bose and More WIREDvor 56 Min.22 Best Black Friday Deals Under $100 (2026) WIREDvor 55 Min.Best Black Friday Phone Deals (2026): iPhone, Pixel, and More The Vergevor 1 Std.The absolute best Black Friday deals we’ve found (so far) Giga.devor 54 Min.AirPods Pro 3 im Black-Friday-Sturzflug: So günstig waren Apples Top-In-Ears noch nie PC-WELTvor 52 Min.Black Friday bei Amazon Haul: 20 Prozent Rabatt auf Powerbanks, Batterieprüfer, Speichersticks und mehr PC-WELTvor 52 Min.Black Friday bei Amazon Haul: 20 Prozent Rabatt auf Powerbanks, Batterieprüfer, Speichersticks und mehr t3n.devor 1 Std.Kindle, Echo Dot, Fire TV: Diese neuen Amazon-Geräte sind zum Black Friday stark reduziert Macerkopf.devor 1 Std.Amazon Black Friday Woche: iPad Air, iPhone 18 Cases, AirTag 2, Fire TV Sticks, Echo Dot und mehr appgefahren.devor 1 Std.JMGO mit Black Friday-Deals: Heimkino-Bundles bis zu 60 Prozent günstiger PC-WELTvor 1 Std.Google Pixel 11 jetzt unglaubliche 430 Euro günstiger im Black-Friday-Deal: Tiefstpreis bei Amazon PC-WELTvor 1 Std.Norton 360 Premium-Security an Black Friday nur 19,99 Euro statt 100 Euro Latest from TechRadarvor 1 Std.The best Black Friday headphone deals: Sony, AirPods and more Latest from TechRadarvor 1 Std.Best Black Friday mini PC deals 2026 live: Save on desktops from Apple, Geekom, GMKtec, Minisforum, and more Golem.devor 1 Std.Anzeige: Amazon startet mit Glücksrad-Gewinnspiel in den Black Friday Latest from TechRadarvor 1 Std.These smart and polished backpacks have accompanied me to events all over the world — and they're now 30% for Black Friday PC-WELTvor 1 Std.Riesiger 75 Zoll 4K-QLED-Fernseher fällt bei Amazon auf nur 469 Eur im Black-Friday-Angebot PC-WELTvor 1 Std.Black Friday: Beliebte Mähroboter von Mammotion jetzt ab 599 Euro Latest from TechRadarvor 1 Std.Save up to around £200 on these top mini PCs for Black Friday — with multiple options and configurations available for your exact needs or preferences Caschys Blogvor 3 Std.FlexiSpot Black Friday 2026: Bis zu 40 % Rabatt auf Bestseller bei Amazon Golem.devor 1 Std.Black Friday: Verdi mobilisiert bei Amazon in Gera nur wenige PC-WELTvor 1 Std.Notebooksbilliger Black Friday: 150 Euro Extra-Rabatt – Laptops unter 300 Euro appgefahren.devor 1 Std.tink.de bietet bis zu 50 Euro Extra-Rabatt auf Black-Friday-Angebote PC-WELTvor 1 Std.Notebooksbilliger Black Friday: 150 Euro Extra-Rabatt – Laptops unter 300 Euro Latest from TechRadarvor 2 Std.Which all-in-one Black Friday VPN bundle is really worth it? I compared NordVPN Prime, ExpressVPN Pro, and Proton Unlimited — all under $7 a month — to decide PC-WELTvor 2 Std.Amazon verlost an Black Friday Einkaufsgutscheine im Wert von 2.000 Euro PC-WELTvor 2 Std.Amazon verlost an Black Friday Einkaufsgutscheine im Wert von 2.000 Euro
22 Quellen
CVE-2026-95457 | Google Android Camera reconnect.shard.cml privileges management
VulDB Updates vor 43 Min.
21 weitere Quellen
VulDB Updatesvor 43 Min.CVE-2026-95458 | Google Android Bluetooth Setup bluetooth_setup_impl.cc OnAudioSourceConnectChanged privileges management VulDB Updatesvor 43 Min.CVE-2026-95464 | Google Android logical_link.cc SignalError use after free VulDB Updatesvor 43 Min.CVE-2026-95456 | Google Android a2dp_offload_manager.cc StartA2dpOffload use after free VulDB Updatesvor 43 Min.CVE-2026-95463 | Google Android data_element.cc DataElement::Read recursion Engadgetvor 58 Min.Google will soon share Android developers' addresses publicly VulDB Updatesvor 1 Std.CVE-2026-95429 | Google Android BrEdrDynamicChannel bredr_dynamic_channel.cc resource consumption VulDB Updatesvor 1 Std.CVE-2026-95434 | Google Android LowEnergyScanner low_energy_scanner.cc NotifyPeerFound resource consumption VulDB Updatesvor 1 Std.CVE-2026-95441 | Google Android Bluetooth connection.cc OnDisconnectionComplete denial of service VulDB Updatesvor 1 Std.CVE-2026-95422 | Google Android periodic_advertising_synchronizer.cc OnSyncEstablished assertion VulDB Updatesvor 1 Std.CVE-2026-95423 | Google Android local_service_manager.cc OnWriteCCC null pointer dereference VulDB Updatesvor 1 Std.CVE-2026-95447 | Google Android SDP Client client.cc OnRxFrame memory corruption VulDB Updatesvor 1 Std.CVE-2026-95421 | Google Android Command Processing bredr_signaling_channel.cc DecodeRxUnit use after free VulDB Updatesvor 1 Std.CVE-2026-95435 | Google Android advertising_data.cc FromBytes out-of-bounds VulDB Updatesvor 1 Std.CVE-2026-95446 | Google Android credit_based_flow_control_rx_engine.cc ProcessPdu input validation VulDB Updatesvor 1 Std.CVE-2026-95420 | Google Android Pairing security_manager.cc OnEncryptionChange privileges management VulDB Updatesvor 1 Std.CVE-2026-95419 | Google Android Bluetooth Security Manager security_manager.cc OnPairingRequest unusual condition VulDB Updatesvor 1 Std.CVE-2026-95416 | Google Android Link Encryption Key security_manager.cc OnPairingFailed denial of service VulDB Updatesvor 1 Std.CVE-2026-95415 | Google Android RemoteCharacteristic remote_characteristic.cc denial of service VulDB Updatesvor 1 Std.CVE-2026-95417 | Google Android remote_characteristic.cc ResolvePendingNotifyRequests use after free VulDB Updatesvor 1 Std.CVE-2026-95414 | Google Android http_file_request_handler.cc GetFilePath path traversal VulDB Updatesvor 1 Std.CVE-2026-95418 | Google Android logical_link.cc LogicalLink::SignalError use after free
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten The Python exception that leaked tenant secrets

Thematisch verwandte Begriffe: Python, exception, that, leaked · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
Widgets & Themen
Widgets werden geladen…
Nächster Beitrag