Zum Hauptinhalt springen
LIVE
CVSS 6.9CVE-2026-137679 | A vulnerability was detected in code-projects Online Job Portal 1.0. This affects the function GetSQLValueString of the file JobSeeker/SearchJob.php of the component JobSeeker. Performing a manipulation of the argument cmbQual results in sql injection. The attack may be initiated remotely. The exploit is now public and may be used.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.
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: Programmazione sicura

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:

💬 Discussione della community e commenti

🌐 Entra nella chat principale

Avvia la discussione nel flusso broadcast della Social Chat oppure invia qui sopra un contributo esperto tramite il modulo di integrazione.

Valutazione della community &amp; prova sociale
⭐ Giudizio dei lettori
–
Ø / 5.0
Ancora nessuna valutazione dei lettori
Questo articolo ti è stato utile?
0
Lascia ora la tua valutazione
Valutazione dettagliata (facoltativa)
Contenuto & qualità
Fonte & credibilità
Attualità
Briefing di sicurezza Gratuito · disdetta in 1 clic

Intelligence Digest — gratuito

Ogni giorno le notizie di sicurezza più importanti · annullabile in qualsiasi momento

Cluster di storie correlate & fonti (IA vettoriale)

6 Cluster
46 fonti
Best Black Friday Toy Deals (2026): Up to 50% Off Lego, Board Games, and Toys
WIRED 20 min. fa
45 altre fonti
Latest from TechRadar47 min. faBest Black Friday home office deals 2026 — save on our top-tested work essentials from Herman Miller, FlexiSpot, Logitech, Epson and more Latest from TechRadar45 min. faSony WH-1000XM6 just hit a record-low price — now it's Black Friday Latest from TechRadar40 min. faLenovo's Copilot+ IdeaPad Slim 3 with 16GB RAM and a 512GB SSD is £350 off for Black Friday The Verge35 min. faOur favorite headphones and earbuds are cheaper than ever ahead of Black Friday Computer Bild49 min. faBlack Friday: Live-Show ab 16 Uhr – die besten Deals t3n.de49 min. faBlack Friday: Alle guten Angebote zu Apple, Samsung, Fritz und Co. in der Übersicht Golem.de41 min. faAnzeige: Google Pixel 10a am Black Friday bei Amazon erstmals unter 380 Euro COMPUTER BILD1 h faCOMPUTER BILD: Die Deal-Checker! BLACK FRIDAY 2026 DEV Community35 min. faBest kanban boards for AI coding agents in 2026 WIRED1 h faThe Best Black Friday Streaming Deals (2026): Apple TV, Disney, Paramount, and More GamingOnLinux Latest Articl…1 h faitch.io Creator Day & Black Friday 2026 sale is live IT Security News1 h faIT Security News Hourly Summary 2026-11-27 11h : The AI Threat Horizon: Why Speed, Edge AI and Baselines Are Our Best Defense and 13 more posts Latest from TechRadar1 h faBest Black Friday MacBook Air deals: biggest discounts on Apple's thin and light laptop range Latest from TechRadar1 h faProton VPN vs ExpressVPN – which secure VPN should you pick this Black Friday? WIRED10 h faThe 108 Best Black Friday Deals Are Now Live: Our Expert Picks for 2026 WIRED1 h fa20 Best Black Friday Tech Deals (2026) WIRED1 h faThe 10 Best Black Friday TV Deals (2026): Save Up to 53% Off Giga.de1 h faBlack Friday 2026 bei Back Market: Dyson, Ninja und GoPro jetzt deutlich günstiger DEV Community1 h faSol's Take: Friday — November 27, 2026 Cyber Security News1 h faBlack Friday or Black Fraud Day? 7 Cyber Traps to Watch Out for Before You Click ‘Buy’ CNET2 giorni faLive: Black Friday Is Here. Shop Our Favorite Deals and Save Up to 60% Apple, Anker, Bose and More WIRED1 h fa22 Best Black Friday Deals Under $100 (2026) WIRED1 h faBest Black Friday Phone Deals (2026): iPhone, Pixel, and More The Verge1 h faThe absolute best Black Friday deals we’ve found (so far) Giga.de1 h faAirPods Pro 3 im Black-Friday-Sturzflug: So günstig waren Apples Top-In-Ears noch nie PC-WELT1 h faBlack Friday bei Amazon Haul: 20 Prozent Rabatt auf Powerbanks, Batterieprüfer, Speichersticks und mehr PC-WELT1 h faBlack Friday bei Amazon Haul: 20 Prozent Rabatt auf Powerbanks, Batterieprüfer, Speichersticks und mehr t3n.de2 h faKindle, Echo Dot, Fire TV: Diese neuen Amazon-Geräte sind zum Black Friday stark reduziert Macerkopf.de2 h faAmazon Black Friday Woche: iPad Air, iPhone 18 Cases, AirTag 2, Fire TV Sticks, Echo Dot und mehr appgefahren.de1 h faJMGO mit Black Friday-Deals: Heimkino-Bundles bis zu 60 Prozent günstiger PC-WELT1 h faGoogle Pixel 11 jetzt unglaubliche 430 Euro günstiger im Black-Friday-Deal: Tiefstpreis bei Amazon PC-WELT1 h faNorton 360 Premium-Security an Black Friday nur 19,99 Euro statt 100 Euro Latest from TechRadar2 h faThe best Black Friday headphone deals: Sony, AirPods and more Latest from TechRadar1 h faBest Black Friday mini PC deals 2026 live: Save on desktops from Apple, Geekom, GMKtec, Minisforum, and more Golem.de1 h faAnzeige: Amazon startet mit Glücksrad-Gewinnspiel in den Black Friday IT Security News2 h faIT Security News Hourly Summary 2026-11-27 10h : Top 10 Best Human Risk Management Platforms in 2026 [Ranked & Scored] and 17 more posts Latest from TechRadar2 h faThese smart and polished backpacks have accompanied me to events all over the world — and they're now 30% for Black Friday PC-WELT2 h faRiesiger 75 Zoll 4K-QLED-Fernseher fällt bei Amazon auf nur 469 Eur im Black-Friday-Angebot PC-WELT2 h faBlack Friday: Beliebte Mähroboter von Mammotion jetzt ab 599 Euro Latest from TechRadar2 h faSave 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 Blog4 h faFlexiSpot Black Friday 2026: Bis zu 40 % Rabatt auf Bestseller bei Amazon Golem.de2 h faBlack Friday: Verdi mobilisiert bei Amazon in Gera nur wenige PC-WELT2 h faNotebooksbilliger Black Friday: 150 Euro Extra-Rabatt – Laptops unter 300 Euro appgefahren.de2 h fatink.de bietet bis zu 50 Euro Extra-Rabatt auf Black-Friday-Angebote PC-WELT2 h faNotebooksbilliger Black Friday: 150 Euro Extra-Rabatt – Laptops unter 300 Euro
22 fonti
CVE-2026-95457 | Google Android Camera reconnect.shard.cml privileges management
VulDB Updates 1 h fa
21 altre fonti
VulDB Updates1 h faCVE-2026-95458 | Google Android Bluetooth Setup bluetooth_setup_impl.cc OnAudioSourceConnectChanged privileges management VulDB Updates1 h faCVE-2026-95464 | Google Android logical_link.cc SignalError use after free VulDB Updates1 h faCVE-2026-95456 | Google Android a2dp_offload_manager.cc StartA2dpOffload use after free VulDB Updates1 h faCVE-2026-95463 | Google Android data_element.cc DataElement::Read recursion Engadget1 h faGoogle will soon share Android developers' addresses publicly VulDB Updates1 h faCVE-2026-95429 | Google Android BrEdrDynamicChannel bredr_dynamic_channel.cc resource consumption VulDB Updates1 h faCVE-2026-95434 | Google Android LowEnergyScanner low_energy_scanner.cc NotifyPeerFound resource consumption VulDB Updates1 h faCVE-2026-95441 | Google Android Bluetooth connection.cc OnDisconnectionComplete denial of service VulDB Updates1 h faCVE-2026-95422 | Google Android periodic_advertising_synchronizer.cc OnSyncEstablished assertion VulDB Updates1 h faCVE-2026-95423 | Google Android local_service_manager.cc OnWriteCCC null pointer dereference VulDB Updates1 h faCVE-2026-95447 | Google Android SDP Client client.cc OnRxFrame memory corruption VulDB Updates1 h faCVE-2026-95421 | Google Android Command Processing bredr_signaling_channel.cc DecodeRxUnit use after free VulDB Updates1 h faCVE-2026-95435 | Google Android advertising_data.cc FromBytes out-of-bounds VulDB Updates1 h faCVE-2026-95446 | Google Android credit_based_flow_control_rx_engine.cc ProcessPdu input validation VulDB Updates2 h faCVE-2026-95420 | Google Android Pairing security_manager.cc OnEncryptionChange privileges management VulDB Updates2 h faCVE-2026-95419 | Google Android Bluetooth Security Manager security_manager.cc OnPairingRequest unusual condition VulDB Updates2 h faCVE-2026-95416 | Google Android Link Encryption Key security_manager.cc OnPairingFailed denial of service VulDB Updates2 h faCVE-2026-95415 | Google Android RemoteCharacteristic remote_characteristic.cc denial of service VulDB Updates2 h faCVE-2026-95417 | Google Android remote_characteristic.cc ResolvePendingNotifyRequests use after free VulDB Updates2 h faCVE-2026-95414 | Google Android http_file_request_handler.cc GetFilePath path traversal VulDB Updates2 h faCVE-2026-95418 | Google Android logical_link.cc LogicalLink::SignalError use after free
Articoli simili
🔍 Verwandte News

Auch interessante Nachrichten The Python exception that leaked tenant secrets

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

Laden...

Caricamento dei video ...

Laden...

Caricamento degli articoli ...

Laden...

Caricamento dei video ...

Laden...

Caricamento degli articoli ...

Laden...

Caricamento dei video ...

Laden...

Caricamento degli articoli ...

Laden...

Caricamento dei video ...

Laden...

Caricamento degli articoli ...

Laden...

Caricamento dei video ...

💬 Caricamento dei commenti…
Trascina per aggiornare
Widgets & Topics
Loading widgets…
Nächster Beitrag