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

Legacy import API requires "version" field #79705

Closed
jportner opened this issue Oct 6, 2020 · 1 comment · Fixed by #79706
Closed

Legacy import API requires "version" field #79705

jportner opened this issue Oct 6, 2020 · 1 comment · Fixed by #79706
Assignees
Labels
blocker bug Fixes for quality problems that affect the customer experience Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@jportner
Copy link
Contributor

jportner commented Oct 6, 2020

Kibana version: 7.9 and 7.10

Describe the bug: Prior to Kibana 7.9, the legacy import API (/api/kibana/dashboards/import) could be used without a "version" field in the body. When #69474 was released it appeared to have unintentionally marked the "version" field as required in the API route (due to changing from the Joi package to @kbn/config-schema). Joi defaults to optional but @kbn/config-schema defaults to required.

Steps to reproduce:

  1. Start Kibana and Elasticsearch
  2. Run the following curl command:
curl -XPOST -u elastic:changeme -H 'kbn-xsrf: true' -H "Content-type: application/json" -d '{
"objects": [
     {
        "attributes": {
            "timeFieldName": "@timestamp",
            "title": "some-title"
        },
        "id": "some-id",
        "type": "index-pattern"
     }
 ]
}' 'http://localhost:5601/api/kibana/dashboards/import'

and observe the error:

{"statusCode":400,"error":"Bad Request","message":"[request body.version]: expected value of type [string] but got [undefined]"
  1. Run the following curl command with any version string added:
curl -XPOST -u elastic:changeme -H 'kbn-xsrf: true' -H "Content-type: application/json" -d '{
"version": "1",
"objects": [
     {
        "attributes": {
            "timeFieldName": "@timestamp",
            "title": "some-title"
        },
        "id": "some-id",
        "type": "index-pattern"
     }
 ]
}' 'http://localhost:5601/api/kibana/dashboards/import'

and observe that the command completed successfully.

Expected behavior: This API should not have added a required field in a minor release.

Any additional context: Viewing the code, it appears that this "version" field isn't even used anymore. It should be marked as optional.

@jportner jportner added bug Fixes for quality problems that affect the customer experience Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc labels Oct 6, 2020
@jportner jportner self-assigned this Oct 6, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform (Team:Platform)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker bug Fixes for quality problems that affect the customer experience Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants