Skip to content

AWS CloudWatch: GetMetricData Period is not validated (overflow can hang or crash the server) #1701

Closed

Description

@NitinKumar004

GetMetricData never validates the Period of a MetricDataQuery or MetricStat. A huge Period overflows time.Duration(p)*time.Second, so the step becomes negative or zero. A negative step makes the fill loop never end, and the handler keeps burning CPU and memory. A zero step panics with a divide by zero. This came up while reviewing #1537, which makes it reachable through a SEARCH period too.

Goal: validate Period as AWS does (a positive multiple of 60, or 1, 5, 10, 20 or 30 for high resolution, within the API limits). Return InvalidParameterValue when it is out of range, and guard the step computation (count in seconds, reject a non-positive step), with a regression test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High priorityaws-parityAWS real-cloud parity gapbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions