Skip to content

Conversation

@petruki
Copy link
Member

@petruki petruki commented Jan 8, 2026

This pull request improves the handling and validation of query parameters for metric-related API endpoints and enhances input sanitization before querying the database. The main changes include stricter validation of request parameters, improved type handling, and the introduction of input formatting to prevent inconsistent or unsafe values.

API request validation improvements:

  • Added stricter validation for query parameters in /metric/data/ and /metric/statistics/ endpoints, including type checks and length constraints for key, environment, component, and group, as well as ISO8601 validation for date filters. [1] [2]
  • Improved the type handling for the page parameter by converting it to a Number and checking for NaN using Number.isNaN.

Input sanitization and consistency:

  • Introduced the formatInput helper in buildMetricsFilter to sanitize and normalize the environment, component, and group query parameters before using them in database queries, reducing the risk of inconsistent or unsafe values. [1] [2]
  • Ensured that the result query parameter is explicitly converted to a boolean value before use.

@petruki petruki added this to the v1.4.1 milestone Jan 8, 2026
@petruki petruki self-assigned this Jan 8, 2026
@petruki petruki added the patch Updating dependencies label Jan 8, 2026
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 8, 2026

@petruki petruki merged commit 13ced1c into master Jan 8, 2026
5 checks passed
@petruki petruki deleted the staging branch January 8, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Updating dependencies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants