Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request payload is not validated before processing a POST request #23

Open
christian-pinto opened this issue Sep 15, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@christian-pinto
Copy link

christian-pinto commented Sep 15, 2023

When processing a POST the code would accept any payload as long as it is a properly formatted RedFish object.
As an example let's take the below RedFish event object.

{
    "@odata.type": "#Event.v1_7_0.Event",
    "Id": "1",
    "Name": "Manager Created",
    "Context": "",
    "Events": [{
      "EventType": "Other",
      "EventId": "4594",
      "Severity": "Ok",
      "Message": "New Manager Available at FQDN http://foo.bar.org and Port 1234 ",
      "MessageId": "Manager.1.0.AggregationSourceDiscovered",
      "MessageArgs": [ "http://foo.bar.org", "1234" ],
      "OriginOfCondition": {
        "@odata.id": "/redfish/v1/Managers/Manager1"
      }}
    ]
}

if this is posted to /redfish/v1/Chassis the API replies with a 200 and the below Frankenstein Chassis object is created:

{
    "@Redfish.Copyright": "Copyright 2YNTSJ14-2YNTSJ21 SNIA. All rights reserved.",
    "@odata.id": "/redfish/v1Chassis/YNTSJ",
    "@odata.type": "#Event.v1_7_0.Event",
    "ChassisType": "IP based Chassis",
    "Context": "",
    "Events": [
        {
            "EventId": "4594",
            "EventType": "Other",
            "Message": "New Manager Available at FQDN http://foo.bar.org and Port 1234 ",
            "MessageArgs": [
                "http://foo.bar.org",
                "1234"
            ],
            "MessageId": "Manager.1.0.AggregationSourceDiscovered",
            "OriginOfCondition": {
                "@odata.id": "/redfish/v1/Managers/Manager1"
            },
            "Severity": "Ok"
        }
    ],
    "Id": "1",
    "Name": "Manager Created"
}

This request should instead fail because of a malformed payload. Each API endpoint should validate the payload before processing the request.

@christian-pinto christian-pinto added the bug Something isn't working label Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant