green-coding-solutions / green-metrics-tool

Measure energy and carbon consumption of software
https://metrics.green-coding.io
GNU Affero General Public License v3.0
143 stars 19 forks source link

HTML escaping inefficient and inconsistent #768

Open ArneTR opened 2 months ago

ArneTR commented 2 months ago

Currently GMT applies HTML escapes at different stages of the code

The two former calls are all funneled through html_escape_multi in the main.py and api_helpers.py.

The latter is done in native JS code through the function escapeString.

In JS land it often occurs that we have arguments that need to be checked on every call. For instance when we ingest URL params.

However in the API / backend side it is unneded to do the escaping on every call. It should be streamlined to only happen on ingest or at least the transformed output should be cached indefinitely if a clean DB is preferred.