Zum Hauptinhalt springen
LIVE
CVSS 6.9CVE-2026-138105 | A vulnerability has been found in ssssssss-team magic-api 2.2.2. The affected element is an unknown function of the file /magic/web/datasource/jdbc/test of the component Datasource JDBC Test Endpoint. Such manipulation of the argument driverClassName leads to code injection. The attack can be launched remotely. The exploit has been disclosed to the public and may be used. The project was informed of the problem early through an issue report but has not respoCVSS 6.9CVE-2026-138104 | A flaw has been found in ssssssss-team magic-api up to 2.2.2. Impacted is the function push of the file magic-api/src/main/java/org/ssssssss/magicapi/core/web/MagicWorkbenchController.java of the component Workbench Push Interface. This manipulation of the argument magic-push-target causes server-side request forgery. The attack can be initiated remotely. The exploit has been published and may be used. The project was informed of the problem early through anCVSS 6.9CVE-2026-138103 | A vulnerability was detected in ssssssss-team magic-api up to 2.2.2. This issue affects the function saveFile of the file MagicResourceController.java of the component magic-api-core resource save API. The manipulation results in code injection. It is possible to launch the attack remotely. The exploit is now public and may be used. The project was informed of the problem early through an issue report but has not responded yet.CVSS 9.4CVE-2026-138102 | A security vulnerability has been detected in D-Link DIR-620S 4.0.2. This vulnerability affects unknown code of the file /usr/sbin/anweb of the component Diagnostic Handler. The manipulation of the argument I leads to os command injection. It is possible to initiate the attack remotely. The exploit has been disclosed publicly and may be used.CVSS 5.3CVE-2026-138101 | A weakness has been identified in MassGen up to 0.1.97. This affects the function _generate_subagent_yaml_config of the file massgen/subagent/manager.py of the component Subagent Delegation System. Executing a manipulation can lead to improper authorization. The attack may be performed from remote. The exploit has been made available to the public and could be used for attacks. The project was informed of the problem early through an issue report but has notCVSS 6.9CVE-2026-138100 | A security flaw has been discovered in MassGen up to 0.1.97. Affected by this issue is the function __init__ of the file massgen/filesystem_manager/_filesystem_manager.py. Performing a manipulation results in protection mechanism failure. The attack is possible to be carried out remotely. The exploit has been released to the public and may be used for attacks. The project was informed of the problem early through an issue report but has not responded yet.CVSS 8.7CVE-2026-138099 | A vulnerability was identified in Tenda AC10U 1.18.6. Affected by this vulnerability is the function readUsb of the component ATE Service. Such manipulation leads to out-of-bounds write. The attack can be executed remotely. The exploit is publicly available and might be used.CVSS 6.9CVE-2026-138098 | A vulnerability was determined in weison-tech yii2-cms up to 1.0.2. Affected is an unknown function of the file protected/core/config/common.php of the component RBAC Authorization. This manipulation causes improper authorization. Remote exploitation of the attack is possible.
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: Sichere Programmierung

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:

💬 Communitydiscussie & reacties

🌐 Naar de hoofdchat

Start de discussie in de Social Chat broadcaststream of dien hierboven een vakbijdrage in via het aanvulformulier.

Community Rating & Social Proof
⭐ Lezersbeoordeling
–
Ø / 5.0
Nog geen recensies van lezers
Was dit artikel nuttig?
0
Geef uw beoordeling
Detailbeoordeling (optioneel)
Inhoud & Kwaliteit
Bron & Geloofwaardigheid
Actualiteit
Security Briefing Gratis · 1-klik uitschrijven

Intelligence Digest gratis

Dagelijks het belangrijkste beveiligingsnieuws · kan op elk moment worden opgehaald

Verwant Story Cluster & Sources (vector AI)

6 Cluster
14 Bronnen
I 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
Latest from TechRadar 18 min. geleden
13 andere bronnen
OS X Daily16 min. geledenCyber Monday Deals: $300 Off 16″ PROLED MacBook Pro, $100 Off AirPods Pro 3, $100 Off iPad Air, & More Latest from TechRadar38 min. geledenCyber 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 TechRadar36 min. geledenThe best Cyber Monday deals in the UK in 2026: top picks from Amazon, Argos, Ninja, Lego and more Latest from TechRadar46 min. geledenCyber Monday Australia laptop deals for 2026: score up to 52% off Lenovo, Apple, Dell, HP and more Latest from TechRadar1 uur geledenAmazon Australia Cyber Monday deals CNET1 uur geledenThis Pocket Battery Recharges Your Phone 4 Times, and it’s Only $38 for Cyber Monday Latest from TechRadar1 uur geledenFirebat's M1 is a cracking Ryzen AI 9 HX 470 mini PC for AI workloads — and it's packing OCuLink, 32GB of RAM, and a 1TB SSD for $1020 this Cyber Monday Latest from TechRadar1 uur geledenThe Lenovo IdeaCentre Tower Copilot+ PC with Core Ultra 7 CPU isn't discounted for Cyber Monday — and it's still the desktop computer I'd buy for work for $1049 The Verge1 uur geledenQobuz is my streaming service of choice and it’s on sale during Cyber Monday CNET12 dagen geledenThis Paramount Plus Cyber Monday Deal Gets You Ad-Free Viewing for Only $3 Per Month CNET2 uur geledenCyber Monday Meta Quest 3S Deal Knocks $53 Off and Gets You $50 Free Amazon Credit The Verge3 uur geledenThese early Cyber Monday gaming laptop deals offer the most GPU for the least money Latest from TechRadar4 uur geledenGrab a TP-Link dual-band Wi-Fi 6 router with 1.5Gbps for $44 this Cyber Monday
13 Bronnen
Linux Overhauls Documentation For Reporting Kernel Security Bugs
Phoronix 37 min. geleden
12 andere bronnen
DEV Community2 uur geledenForgeOS Booted on a Real Server: Linux Kernel Below, Only Our Own Code Above VulDB Updates2 uur geledenCVE-2026-72239 | Linux Kernel sev x86/virt/sev/sev.c wbinvd_on_all_cpus state issue (WID-SEC-2026-2852) VulDB Updates2 uur geledenCVE-2026-72240 | Linux Kernel up to 7.1.4 mfd sm501_register_device memory leak (WID-SEC-2026-2852) VulDB Updates2 uur geledenCVE-2026-72241 | Linux Kernel up to 7.1.4 uleds strchr buffer overflow (WID-SEC-2026-2852) VulDB Updates2 uur geledenCVE-2026-72244 | Linux Kernel up to 6.12.100/6.18.41/7.1.4/7.2-rc2 gpu-buddy allocation of resources (WID-SEC-2026-2852) VulDB Updates2 uur geledenCVE-2026-72243 | Linux Kernel up to 7.2-rc2 selinux socket_sendmsg permission (Nessus ID 364200 / WID-SEC-2026-2852) VulDB Updates2 uur geledenCVE-2026-72245 | Linux Kernel up to 7.1.4 host1x host1x_device_parse_dt release of resource (WID-SEC-2026-2852) VulDB Updates2 uur geledenCVE-2026-72246 | Linux Kernel flowtable input validation (WID-SEC-2026-2852) VulDB Updates2 uur geledenCVE-2026-72247 | Linux Kernel up to 7.2-rc3 nf_conncount __nf_conncount_add dir comparison (WID-SEC-2026-2852) VulDB Updates2 uur geledenCVE-2026-72248 | Linux Kernel up to 7.1.4/7.2-rc2 flowtable nft_flow_dst_release buffer overflow (WID-SEC-2026-2852) LinuxAndUbuntu3 uur geledenLinux AutoFDO Benchmark: Clang Kernel Optimization VulDB Updates4 uur geledenCVE-2022-31607 | NVIDIA GPU Display Driver on Linux Kernel Mode Layer nvidia.ko input validation (EUVD-2022-53059 / Nessus ID 339047)
13 Bronnen
CVE-2026-135533 | Mozilla Firefox up to 115.45/153.7/160 Layout Tables off-by-one (Nessus ID 388625)
VulDB Updates 1 uur geleden
12 andere bronnen
Soortgelijke bijdragen
🔍 Verwandte News

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

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

Laden...

Video's zijn geladen...

Laden...

Bijdragen zijn geladen ...

Laden...

Video's zijn geladen...

Laden...

Bijdragen zijn geladen ...

Laden...

Video's zijn geladen...

Laden...

Bijdragen zijn geladen ...

Laden...

Video's zijn geladen...

Laden...

Bijdragen zijn geladen ...

Laden...

Video's zijn geladen...

💬 Reacties worden geladen…
Trek om te vernieuwen
Widgets & onderwerpen
Widgets laden…
Volgende bericht