Skip to content

Potential fix for code scanning alert no. 14: Log injection#89

Merged
KrisPowers merged 1 commit into
mainfrom
alert-autofix-14
May 13, 2026
Merged

Potential fix for code scanning alert no. 14: Log injection#89
KrisPowers merged 1 commit into
mainfrom
alert-autofix-14

Conversation

@KrisPowers

Copy link
Copy Markdown
Member

Potential fix for https://github.com/TrivaJS/triva/security/code-scanning/14

To fix log injection, sanitize any user-influenced values before writing them to logs by removing carriage returns and newlines (\r, \n).
The best minimal fix here is to sanitize entry.request.method and entry.request.url at the logging point (line ~203), preserving existing behavior while neutralizing log-forging characters.

In lib/middleware/error-tracker.js, update the development logging block:

  • Before console.error(\ Request: ...`)`, create sanitized local variables:
    • Convert to string safely (fallback '' for nullish values).
    • Strip \r and \n using .replace(/[\r\n]/g, '').
  • Log the sanitized values instead of raw entry.request.method and entry.request.url.

No new imports or dependencies are required.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@KrisPowers KrisPowers self-assigned this May 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Submodule Sync Check

All submodules are up to date!


Automated check · Runs on PR updates

@github-actions

Copy link
Copy Markdown
Contributor

Version Potential fix for code scanning alert no. 14: Log injection Release

Notable Changes

  • [0d5e8d0] - Potential fix for code scanning alert no. 14: Log injection (2026-05-12)

All Commits

  • [0d5e8d0] - Potential fix for code scanning alert no. 14: Log injection (2026-05-12)

📥 Download Changelog

Last updated: 2026-05-12T23:54:21Z

@github-actions github-actions Bot deployed to preview-0d5e8d0 May 12, 2026 23:59 Active
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Release Integrity Verification

Test Suite Status
Unit Tests
⏭️ Success
Integration Tests
⏭️ Success
Database Adapters
⏭️ Success
Preview Deploy
⏭️ Success

⚠️ Failures Detected

❌ Unit Test Failures

   ❌ Failed: 0

❌ Integration Test Failures

   ❌ Failed: 0

Commit: a00d532View full run

@KrisPowers KrisPowers marked this pull request as ready for review May 13, 2026 00:54
@KrisPowers KrisPowers merged commit b24b168 into main May 13, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant