Skip to content

Improve PowerDistribution security with prepared statements and HTML escaping - #1674

Open
Emavero wants to merge 19 commits into
opendcim:masterfrom
Emavero:master
Open

Emavero wants to merge 19 commits into
opendcim:masterfrom
Emavero:master

Conversation

@Emavero

@Emavero Emavero commented Sep 2, 2026

Copy link
Copy Markdown

Summary

This pull request improves the security of the PowerDistribution component and the power alert email generation.

Changes

  • Replaced string-concatenated SQL queries with PDO prepared statements to reduce the risk of SQL injection vulnerabilities.
  • Updated the following methods:
    • CreatePDU
    • UpdatePDU
    • GetPDU
    • GetPDUbyPanel
    • GetPDUbyCabinet
    • SearchByPDUName
    • GetLastReading
    • GetWattageByDC
    • GetWattageByCabinet
    • LogManualWattage
    • UpdateStats
    • DeletePDU
  • Escaped Name, Location, and Label using htmlspecialchars() in HTML power alert emails to prevent stored and reflected XSS issues.

Benefits

  • Improved protection against SQL injection attacks.
  • Reduced risk of XSS vulnerabilities in alert emails.
  • Better alignment with secure coding practices and OWASP recommendations.

Testing

  • Verified that existing PowerDistribution operations continue to function as expected.
  • Verified that alert emails render correctly with escaped user-controlled values.

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