Skip to content

Commit 61544b6

Browse files
Potential fix for code scanning alert no. 5: Log Injection
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 4a31b53 commit 61544b6

File tree

1 file changed

+4
-1
lines changed
  • netbox-event-driven-automation-flask-app

1 file changed

+4
-1
lines changed

netbox-event-driven-automation-flask-app/app.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ def get(self):
7676
_session['version_lastrun'] = VERSION
7777
_session['status']['requests'] += 1
7878
_session['status']['last_called'] = datetime.now()
79-
logger.info(f"{request.full_path}, {request.remote_addr}, Status request with data {request.get_data()}")
79+
sanitized_full_path = request.full_path.replace('\r\n', '').replace('\n', '')
80+
sanitized_remote_addr = request.remote_addr.replace('\r\n', '').replace('\n', '') if request.remote_addr else 'Unknown'
81+
sanitized_data = request.get_data(as_text=True).replace('\r\n', '').replace('\n', '') if request.get_data() else ''
82+
logger.info(f"{sanitized_full_path}, {sanitized_remote_addr}, Status request with data {sanitized_data}")
8083
return jsonify(_session)
8184

8285

0 commit comments

Comments
 (0)