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

SecurityRealm type in SecurityPutRoleMappingRequest results in a parsing error. #2344

Closed
kristianthorsen opened this issue May 23, 2023 · 5 comments · Fixed by #2362
Closed
Assignees
Labels

Comments

@kristianthorsen
Copy link

kristianthorsen commented May 23, 2023

🐛 Bug Report

The SecurityPutRoleMappingRequest type expects to specify a SecurityRealm in a SecurityFieldRule of a SecurityRule as:

  {
  field: {
    realm: {
      name: "RealmName"
    }
  }
}

However doing this results in the following parsing error:

Error: parsing_exception
Caused by:
x_content_parse_exception: [1:77] [role-mapping] failed to parse field [rules]
Root causes:
parsing_exception: [1:77] [role-mapping] failed to parse field [rules]

I have played a bit around with it and got the desired behaviour by changing the input to:

  {
  field: {
    "realm.name": "RealmName"
  }
}

It seems that the type SecurityRealm type should either be changed to use "realm.name" or handle the behaviour before forwarding the body to the api.

To Reproduce

Attempt to call the elasticsearch client with .security.putRoleMapping() containing the input described above

Expected behavior

I expected the elasticsearch client to map the specified type to an accepted api request before forwarding the apicall.

Your Environment

  • node version: ">=18.0.0"
  • @elastic/elasticsearch version: "^8.7.0"
  • os: Linux
@JoshMock JoshMock added the bug label May 25, 2023
@JoshMock JoshMock self-assigned this May 25, 2023
Copy link
Contributor

This issue is stale because it has been open 90 days with no activity. Remove the stale label, or leave a comment, or this will be closed in 14 days.

@JoshMock JoshMock transferred this issue from elastic/elasticsearch-js Nov 13, 2023
@JoshMock
Copy link
Member

@kristianthorsen I've moved this issue to the specification repo, where we manage the spec used to generate API functions for all Elasticsearch clients.

Started taking a look, but this one is a bit hard to trace back for me. Hope to get to it more seriously soon.

@kristianthorsen
Copy link
Author

@kristianthorsen I've moved this issue to the specification repo, where we manage the spec used to generate API functions for all Elasticsearch clients.

Started taking a look, but this one is a bit hard to trace back for me. Hope to get to it more seriously soon.

Hi @JoshMock

Thank you very much.

Let me know if you want me to have a look at it.

@JoshMock
Copy link
Member

JoshMock commented Dec 7, 2023

@pquentin since you just merged #2357 and are familiar with SecurityPutRoleMappingRequest, I'm curious if anything about this issue jumps out at you? If not I'll take a look when I have time.

@pquentin pquentin mentioned this issue Dec 8, 2023
@pquentin
Copy link
Member

pquentin commented Dec 8, 2023

Thanks @JoshMock, I confirmed the issue and opened #2362 to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants