Zum Hauptinhalt springen
LIVE
CVSS 7.4CVE-2026-138376 | AsyncSSH 1.13.1 before 2.24.2 contains an improper authentication vulnerability in SSHConnection._match_known_hosts that accumulates trusted client host keys across host-based authentication attempts on one connection. With trust_client_host enabled, attackers holding one known client host's private key can retry naming another known host and log in as users authorized only from that host.CVSS 7.6CVE-2026-138377 | AsyncSSH 1.13.1 before 2.24.2 contains an improper certificate validation vulnerability that allows remote clients to authenticate as users by abusing X.509 certificates matched in known_client_hosts. Attackers can make a failed host-based authentication attempt with any host key, adding host-only CA certificates to the trust anchors, then authenticate using user certificates issued under those CAs.CVSS 9.1CVE-2026-138378 | react-native-pure-jwt before 3.1.1 on Android contains a signature verification bypass vulnerability that allows unauthenticated attackers to forge tokens because RNPureJwtModule decode() calls JJWT parse() without algorithm pinning. Attackers can craft a token with header alg none and an empty signature to have arbitrary claims accepted as verified, forging identities or roles.CVSS 6.9CVE-2026-138379 | flare-redact before 1.13.1 contains a redaction bypass vulnerability that leaks secrets because the redact() object walker masks sensitive keys only when values are strings. Numbers, objects, arrays and binary data under keys such as password, cvv, pin, cookie or authorization pass through unchanged, exposing secrets in clear text to logger, Sentry, gateway and Fluent Bit sinks.CVSS 6.9CVE-2026-138380 | MediaInfoLib before 26.10 contains a heap-based buffer over-read vulnerability in File_Ogg::Data_Parse() that allows attackers to read beyond heap buffers via crafted Ogg segment sizes. Attackers can supply an Ogg file whose segment sizes exceed the page payload, wrapping the unsigned offset check and causing memcpy over-reads that crash the process or leak heap memory.CVSS 6.9CVE-2026-138381 | GNU LibreDWG 0.14 before 0.15 contains a heap use-after-free vulnerability in in_dxf.c new_object() where the OLE2FRAME oleclient pointer references freed memory after DXF import. Attackers can supply a DXF file with an OLE2FRAME entity to crash dxfwrite or similar applications and leak freed heap contents into exported output.CVSS 10.0CVE-2026-138227 | A vulnerability was found in D-Link R95 1.04B04Beta. This affects the function SetTimeSettings of the file /bin/ssi of the component DHMAPI. Performing a manipulation of the argument TZLocation results in os command injection. Remote exploitation of the attack is possible. The exploit has been made public and could be used.CVSS 10.0CVE-2026-138226 | A vulnerability has been found in D-Link R95 1.04B04Beta. Affected by this issue is the function SetSecureDNSSettings of the file /bin/ssi of the component DHMAPI SOAP interface. Such manipulation of the argument URI leads to os command injection. The attack may be launched remotely. The exploit has been disclosed to the public and may be used.
Alle im Drawer
Intelligence View
⚡ tsecurity.de Intelligence

Adding Production-Safe API Logging to Django REST Framework

When a Django REST Framework API starts getting used in production, one of the first debugging problems is visibility. A user reports: “The API failed.” But fro…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Quelle & Fakten · 8 Min. Lesezeit
Quelle: dev.to
Rubrik: Programmation sécurisée

When a Django REST Framework API starts getting used in production, one of the first debugging problems is visibility.



A user reports:




“The API failed.”




But from the backend side, we often need more context:




  • Which endpoint was called?

  • What was the HTTP method?

  • What status code was returned?

  • How long did the request take?

  • Was the request body valid?

  • Did the response fail because of validation, permissions, database latency, or something else?

  • Can we debug this without exposing passwords, tokens, or sensitive payloads?



Many teams solve this by writing custom middleware.



That works at first, but it can become risky over time.



Custom API logging often starts small:




print(request.body)
print(response.data)






Then it grows into:




  • storing logs in the database

  • masking sensitive values

  • handling large request/response bodies

  • tracking slow APIs

  • searching logs from Django admin

  • avoiding extra latency in the request path

  • supporting async deployments

  • adding request correlation or trace IDs

  • avoiding accidental logging of tokens, passwords, cookies, or API keys



At that point, API logging is no longer “just middleware”. It becomes part of production observability.



This is the problem I wanted to solve with DRF API Logger.



Disclosure: I maintain this open-source package. I am sharing it here because I think the problem is common in Django REST Framework projects, and I would also like feedback from other Django developers.






What DRF API Logger does



DRF API Logger is an open-source package for Django REST Framework projects that captures API request and response information.



It can log useful debugging information such as:




  • API URL

  • HTTP method

  • request headers

  • request body

  • response body

  • status code

  • client IP address

  • API execution time

  • optional request tracing information

  • slow API indicators

  • optional profiling information



The goal is not to replace every observability tool.



It is mainly useful when you want structured API-level logging inside a Django/DRF project without building and maintaining custom middleware from scratch.






Why not simply write custom middleware?



You can write your own middleware, and for small projects that may be enough.



But production API logging has some common traps.






1. Sensitive data exposure



This is the biggest issue.



Logging the full request body may accidentally store:




  • passwords

  • access tokens

  • refresh tokens

  • API keys

  • session IDs

  • cookies

  • authorization headers

  • personal user data



That makes logs dangerous.



Good API logging should support masking and exclusion rules from the beginning.



Example:




DRF_API_LOGGER_EXCLUDE_KEYS = [
"password",
"token",
"access",
"refresh",
"secret",
"api_key",
]






Even with masking, teams should still review what they log and decide what is acceptable for their own security, privacy, and compliance requirements.






2. Performance overhead



A simple custom logger may write to the database directly inside the request/response cycle.



That means every API request waits for logging work to finish.



For low traffic, this may be acceptable. For production traffic, this can add unnecessary latency.



A better pattern is to keep request-path work small and move heavier writes out of the main request flow where possible.






3. Large payloads



Some APIs return large JSON responses.



If logs store everything without limits, the logging table can grow quickly and become expensive to query.



A production logging setup should support body-size limits.



Example:




DRF_API_LOGGER_MAX_REQUEST_BODY_SIZE = 32768
DRF_API_LOGGER_MAX_RESPONSE_BODY_SIZE = 65536









4. Search and debugging experience



Storing logs is only useful if developers can find the right records later.



For example:




  • show all 500 responses from the last hour

  • search by URL

  • filter by method

  • find slow APIs

  • inspect a specific failed request

  • compare status codes

  • check execution time



This is where Django admin visibility becomes useful for many teams.






Basic installation



Install the package:




pip install drf-api-logger






Add it to INSTALLED_APPS:




INSTALLED_APPS = [
# ...
"drf_api_logger",
]






Add the middleware:




MIDDLEWARE = [
# ...
"drf_api_logger.middleware.api_logger_middleware.APILoggerMiddleware",
]






Enable database logging:




DRF_API_LOGGER_DATABASE = True






Run migrations:




python manage.py migrate






After this, DRF API logs can be captured and viewed from Django admin.






A more production-aware configuration



For production-like environments, I would avoid enabling full logging blindly.



A safer starting point is:




DRF_API_LOGGER_DATABASE = True

DRF_API_LOGGER_EXCLUDE_KEYS = [
"password",
"token",
"access",
"refresh",
"secret",
"api_key",
"authorization",
"cookie",
"set-cookie",
]

DRF_API_LOGGER_MAX_REQUEST_BODY_SIZE = 32768
DRF_API_LOGGER_MAX_RESPONSE_BODY_SIZE = 65536






This keeps the setup practical while reducing some common risks.



You should still review:




  • which endpoints should be logged

  • which fields should always be masked

  • how long logs should be retained

  • whether request/response bodies should be stored in your environment

  • whether logs contain personal or regulated data

  • whether logs should go to a separate database or storage backend






Using it for slow API investigation



One common use case is finding slow DRF endpoints.



For example, you may want to flag APIs slower than a specific threshold:




DRF_API_LOGGER_SLOW_API_ABOVE = 200






You can also enable profiling when you need deeper investigation:




DRF_API_LOGGER_ENABLE_PROFILING = True






This can help identify whether slowness is more likely coming from:




  • SQL queries

  • too many repeated queries

  • middleware overhead

  • view/business logic

  • serialization cost



This is useful when an endpoint “feels slow” but the team does not yet know where the time is going.






Database logging vs signal-based logging



Not every team wants to store API logs in the default database.



Some teams may want to send API log data somewhere else:




  • a file

  • an analytics pipeline

  • a monitoring system

  • a separate database

  • a queue

  • a custom internal tool



For that, signal-based logging can be useful.



Example:




DRF_API_LOGGER_SIGNAL = True






Then a listener can handle the log event:




from drf_api_logger import API_LOGGER_SIGNAL


def send_to_internal_observability_tool(**kwargs):
# Example only.
# Be careful not to export sensitive request/response bodies.
print({
"api": kwargs.get("api"),
"method": kwargs.get("method"),
"status_code": kwargs.get("status_code"),
"execution_time": kwargs.get("execution_time"),
})


API_LOGGER_SIGNAL.listen += send_to_internal_observability_tool






This gives more flexibility if the default database is not the right place for logs.






Security and privacy notes



API logs can be extremely helpful, but they can also become a liability.



Before enabling request/response logging in production, I recommend reviewing these questions:






1. Are we logging secrets?



Avoid storing:




  • passwords

  • tokens

  • API keys

  • cookies

  • session IDs

  • authorization headers






2. Are we logging personal data?



Depending on your application, request and response bodies may contain personal information.



Examples:




  • names

  • phone numbers

  • email addresses

  • addresses

  • payment-related information

  • health-related information

  • user documents



Do not treat API logs as harmless debugging data.






3. Do we need full bodies?



For many APIs, logging metadata is enough:




  • URL

  • method

  • status code

  • execution time

  • client IP

  • trace ID



Full request/response bodies should be enabled carefully.






4. What is the retention policy?



Logs should not live forever by default.



Teams should decide how long API logs are useful and when they should be deleted or archived.






5. Who can access the logs?



If logs are visible in Django admin, make sure admin access is properly restricted.



API logs may reveal internal system behavior and user data.






When I would use this package



I would consider using DRF API Logger when:




  • the project uses Django REST Framework

  • the team needs request/response visibility

  • developers are currently debugging production issues manually

  • custom middleware is growing too complex

  • slow API investigation is needed

  • Django admin visibility is useful

  • sensitive data masking and payload limits are required

  • the team wants a package instead of maintaining logging middleware internally






When I would not use it



I would not enable full API body logging blindly in every project.



I would be careful if:




  • the application handles highly sensitive data

  • compliance requirements are strict

  • the team does not have a retention policy

  • admin access is not well controlled

  • the database is already under heavy write load

  • only high-level metrics are needed



In those cases, metadata-only logging, signal-based logging, OpenTelemetry, APM tools, or custom policies may be more appropriate.






Minimal example



Here is a compact setup:




INSTALLED_APPS = [
# ...
"drf_api_logger",
]

MIDDLEWARE = [
# ...
"drf_api_logger.middleware.api_logger_middleware.APILoggerMiddleware",
]

DRF_API_LOGGER_DATABASE = True

DRF_API_LOGGER_EXCLUDE_KEYS = [
"password",
"token",
"access",
"refresh",
"secret",
"api_key",
]

DRF_API_LOGGER_MAX_REQUEST_BODY_SIZE = 32768
DRF_API_LOGGER_MAX_RESPONSE_BODY_SIZE = 65536

DRF_API_LOGGER_SLOW_API_ABOVE = 200






Then run:




python manage.py migrate













Feedback request



I would appreciate feedback from Django and DRF developers on a few areas:




  • What do you expect from API logging in production?

  • Do you prefer database logging, signals, OpenTelemetry, or another storage backend?

  • What masking rules should be enabled by default?

  • What would make the admin debugging experience more useful?

  • What concerns would stop you from using request/response logging?



I am especially interested in feedback around security, privacy, performance, and real production debugging workflows.



Thanks for reading.

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:

💬 Discussion communautaire et commentaires

🌐 Rejoindre le chat principal

Lancez la discussion dans le flux diffusé du Social Chat ou proposez ci-dessus une contribution experte via le formulaire de complément.

Évaluation communautaire & preuve sociale
⭐ Avis des lecteurs
–
Ø / 5.0
Pas encore d'évaluation des lecteurs
Cet article vous a-t-il été utile ?
0
Donner votre évaluation
Évaluation détaillée (facultatif)
Contenu & qualité
Source & fiabilité
Actualité
Briefing sécurité Gratuit · désabonnement en 1 clic

Intelligence Digest — gratuit

Chaque jour, les principales actualités sécurité · résiliable à tout moment

Groupes d’histoires apparentées & sources (IA vectorielle)

6 Cluster
25 sources
CVE-2026-135550 | Mozilla Firefox Web Codecs memory corruption (Nessus ID 388625)
VulDB Updates il y a 1 h
24 autres sources
VulDB Updatesil y a 1 hCVE-2026-135551 | Mozilla Firefox up to 153.7/160 Layout use after free (Nessus ID 388625) VulDB Updatesil y a 1 hCVE-2026-135552 | Mozilla Firefox up to 115.45/153.7/160 Canvas2D use after free (Nessus ID 388625) VulDB Updatesil y a 1 hCVE-2026-135554 | Mozilla Firefox up to 115.45/153.7/160 Navigation use after free (Nessus ID 388625) VulDB Updatesil y a 1 hCVE-2026-135556 | Mozilla Firefox up to 115.45/153.7/160 JIT memory corruption (Nessus ID 388625) VulDB Updatesil y a 3 hCVE-2026-135540 | Mozilla Firefox up to 115.45/153.7/160 JIT memory corruption (Nessus ID 388625) VulDB Updatesil y a 3 hCVE-2026-135539 | Mozilla Firefox up to 115.45/153.7/160 CSS Object Model use after free (Nessus ID 388625) VulDB Updatesil y a 3 hCVE-2026-135542 | Mozilla Firefox up to 115.45/153.7/160 Layout buffer overflow (Nessus ID 388625) VulDB Updatesil y a 3 hCVE-2026-135541 | Mozilla Firefox up to 115.45/153.7/160 XSLT use after free (Nessus ID 388625) VulDB Updatesil y a 3 hCVE-2026-135544 | Mozilla Firefox up to 115.45/153.7/160 Navigation memory corruption (Nessus ID 388625) VulDB Updatesil y a 3 hCVE-2026-135545 | Mozilla Firefox up to 153.7/160 Editor memory corruption (Nessus ID 388625) VulDB Updatesil y a 3 hCVE-2026-135543 | Mozilla Firefox up to 115.45/153.7/160 Networking memory corruption (Nessus ID 388625) VulDB Updatesil y a 3 hCVE-2026-135547 | Mozilla Firefox up to 115.45/153.7/160 Networking sandbox (Nessus ID 388625) VulDB Updatesil y a 3 hCVE-2026-135549 | Mozilla Firefox up to 115.45/153.7/160 XSLT use after free (Nessus ID 388625) VulDB Updatesil y a 3 hCVE-2026-135548 | Mozilla Firefox up to 115.45/153.7/160 Layout use after free (Nessus ID 388625) VulDB Updatesil y a 4 hCVE-2026-135533 | Mozilla Firefox up to 115.45/153.7/160 Layout Tables off-by-one (Nessus ID 388625) VulDB Updatesil y a 4 hCVE-2026-135536 | Mozilla Firefox up to 115.45/153.7/160 DOM Editor uninitialized pointer (Nessus ID 388625) VulDB Updatesil y a 4 hCVE-2026-135535 | Mozilla Firefox up to 115.45/153.7/160 Skia input validation (Nessus ID 388625) VulDB Updatesil y a 4 hCVE-2026-135537 | Mozilla Firefox up to 115.45/153.7/160 Layout Text/Fonts out-of-bounds (Nessus ID 388625) VulDB Updatesil y a 5 hCVE-2026-135525 | Mozilla Firefox up to 115.45/153.7/160 WebRender use after free (Nessus ID 388625) VulDB Updatesil y a 5 hCVE-2026-135526 | Mozilla Firefox up to 115.45/153.7/160 Networking use after free (Nessus ID 388625) VulDB Updatesil y a 5 hCVE-2026-135527 | Mozilla Firefox up to 115.45/153.7/160 DOM/HTML use after free (Nessus ID 388625) VulDB Updatesil y a 5 hCVE-2026-135528 | Mozilla Firefox up to 153.7/160 HTTP race condition (Nessus ID 388625) VulDB Updatesil y a 5 hCVE-2026-135530 | Mozilla Firefox up to 115.45/153.7/160 HTTP sandbox (Nessus ID 388625) VulDB Updatesil y a 5 hCVE-2026-135529 | Mozilla Firefox up to 153.7/160 Text sandbox (Nessus ID 388625)
17 sources
Apple Cyber Monday Deals (2026): AirPods, iPads, MacBooks, and More
WIRED il y a 18 min.
16 autres sources
The Mac Observeril y a 26 min.Aqara W200 thermostat is $119.99 for Cyber Monday, $40 off and Apple Home ready Latest from TechRadaril y a 44 min.Cyber Monday mini PC deals 2026 live — top tiny desktops from GMKtec, Geekom, Minisforum, and more as the Black Friday sale continues The Mac Observeril y a 51 min.Sonos Beam Gen 2 is $339 for Cyber Monday, $160 off and $359 under two HomePods The Mac Observeril y a 1 hMagic Mouse in black drops to $79.99 for Cyber Monday, $19 under Apple’s $99 The Mac Observeril y a 1 hGarmin fenix 8 47mm drops $250 to $749.99 for Cyber Monday, $49 under Ultra 4 Latest from TechRadaril y a 2 hI've been waiting for a better deal on the Philips LatteGo 4400 — and Amazon has delivered a record-low price for Cyber Monday Latest from TechRadaril y a 2 hLooking to get a last-minute gaming gift before Cyber Monday is over? WIREDil y a 3 hLast Call for Black Friday iPad Deals (2026): Save Up to $100 Latest from Windows Centralil y a 3 hWhy I bought a handheld over a gaming laptop on Cyber Monday Latest from TechRadaril y a 3 hI found the most capable PC under $300 for Cyber Monday — Origimagic's C7 Windows 11 Pro machine packs dual Thunderbolt 4, 2.5Gb LAN, a Core 3 100U, 16GB of RAM, and a 512GB SSD OS X Dailyil y a 3 hCyber Monday Deals: $300 Off 16″ PROLED MacBook Pro, $100 Off AirPods Pro 3, $100 Off iPad Air, & More Latest from TechRadaril y a 4 hCyber Monday home office deals 2026 live — our top workspace picks from FlexiSpot, Dell, Anker, Logitech and more as Black Friday sale rolls on Latest from TechRadaril y a 4 hThe best Cyber Monday deals in the UK in 2026: top picks from Amazon, Argos, Ninja, Lego and more Latest from TechRadaril y a 4 hBlack Friday laptop deals 2026: the huge savings on MacBooks, Chromebooks and Windows 11 laptops still available from Apple, Dell, HP and many more Latest from TechRadaril y a 4 hCyber Monday Australia laptop deals for 2026: score up to 52% off Lenovo, Apple, Dell, HP and more Latest from TechRadaril y a 4 hAmazon Australia Cyber Monday deals
12 sources
CVE-2026-116159 | ImageMagick up to 6.9.13-57/7.1.2-32 CDL Option memory leak (Nessus ID 388637)
VulDB Updates il y a 1 h
11 autres sources
Articles similaires
🔍 Verwandte News

Auch interessante Nachrichten Adding Production-Safe API Logging to Django REST Framework

Thematisch verwandte Begriffe: Adding, ProductionSafe, Logging, Django · 6 Treffer

Laden...

Chargement des articles ...

Laden...

Chargement des vidéos ...

Laden...

Chargement des articles ...

Laden...

Chargement des vidéos ...

Laden...

Chargement des articles ...

Laden...

Chargement des vidéos ...

Laden...

Chargement des articles ...

Laden...

Chargement des vidéos ...

💬 Chargement des commentaires…
Sentinel CTI: ONLINE
Tirer pour actualiser
Widgets & sujets
Chargement des widgets…
Article suivant