Skip to content

[Bug] Firecracker MMDS API headers are parsed case-sensitive #3129

Closed
@TilBlechschmidt

Description

@TilBlechschmidt

Describe the bug

When sending MMDS requests to Firecracker, the X-metadata-token and X-metadata-token-ttl-seconds headers are parsed case-sensitive.

To Reproduce

  1. Start Firecracker VM with MMDS enabled (according to doc examples)
  2. Send an HTTP request with a lowercased header field name
    • e.g. curl -X PUT -H "x-metadata-token-ttl-seconds: 21000" http://169.254.169.254/latest/api/token
  3. Error response is returned

Expected behaviour

Header field names are parsed case-insensitive in compliance with RFC2616 Section 4.2 "Message Headers" which states that:

Each header field consists of a name followed by a colon (":") and the field value. Field names are case-insensitive.

Additional context

While most HTTP clients will use field names as-is, some proxies are rewriting them and popular HTTP libraries like hyper will consequently lower-case them without any option to change this behaviour. That being said, since the RFC states that field names are case-insensitive I see the responsibility on the side of Firecracker and not the HTTP clients.

Digging through the code, it seems that the culprit lies in the HashMap::get call which fetches fields by hash instead of case-insensitive lookup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugIndicates an unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions