elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.62k stars 8.22k forks source link

Security App does not load if space name is very long #129521

Open sophiec20 opened 2 years ago

sophiec20 commented 2 years ago

Kibana version: 8.2.0-SNAPSHOT

Describe the bug: Cannot use Security App with very long space names or .. Space names can be unusably long

Steps to reproduce:

  1. Create a Space with a long name
  2. Go to this Space
  3. Open the Security app

Expected behavior:

I do not actually think we should support very long Space names because I suspect other things break (which is how I found this), but there is a mismatch here between what Kibana allows and what the Security App supports, therefore raising.

We could trap and provide a nicer error.

I also expected the .list and .item indices to be hidden because of their naming convention.

Screenshots (if relevant):

image

Errors in browser console (if relevant):

{
  "name": "Error",
  "body": {
    "message": "illegal_argument_exception: invalid policy name [.lists-iit-duis-ut-diam-quam-nulla-porttitor-massa-id-neque-aliquam-vestibulum-morbi-blandit-cursus-risus-at-ultrices-mi-tempus-imperdiet-nulla-malesuada-pellentesque-elit-eget-gravida-cum-sociis-natoque-penatibus-et-magnis-dis-parturient-montes-nascetur-ridiculus-mus-mauris-vitae-ultricies-leo-integer-malesuada-nunc-vel-risus-commodo-viverra-maecenas-accumsan-lacus-vel-facilisis-volutpat-est-velit-egestas-dui-id-ornare-arcu-odio-ut-sem-nulla-pharetra-diam-sit-amet-nisl-]: name is too long, (475 > 255)",
    "status_code": 400
  },
  "message": "Bad Request",
  "stack": "Error: Bad Request\n    at fetch_Fetch.fetchResponse (http://showcase.ml-qa.com:5601/51721/bundles/core/core.entry.js:10:74667)\n    at async http://showcase.ml-qa.com:5601/51721/bundles/core/core.entry.js:10:72771\n    at async http://showcase.ml-qa.com:5601/51721/bundles/core/core.entry.js:10:72728"
}

Provide logs and/or server output (if relevant):

Any additional context:

elasticmachine commented 2 years ago

Pinging @elastic/security-solution (Team: SecuritySolution)

yctercero commented 2 years ago

Thanks @sophiec20 ! We'll take a look in 8.4 as we prepare some updates to the lists plugin.

yctercero commented 2 years ago

@sophiec20 so the error shown is being thrown by ES when trying to set the policy. It does not seem that Kibana supports this either (not just a security solution thing).

When I try to create the policy via stack management, I am prevented and prompted with an error about the name being too long. Are you seeing other areas in Kibana that do allow it?

Screen Shot 2022-05-26 at 7 14 29 PM
sophiec20 commented 2 years ago

The policy name limit probably existed long before Spaces did. The disconnect stems from the fact that Elasticsearch is not aware of Spaces, as this is a Kibana construct.

I did not do an exhaustive review of areas which allow, disallow or error with long Space names. It was a while ago; from recollection I think that dashboards and visualisations etc still worked fine. I just saw the error in the Security app initial load which I found by accident.

Personally, I'd like to see some sensible limits set on the Kibana space name length. Having a friendly, human-readable, short and succinct space name is fairly useful when namespacing elasticsearch objects. Plus, there is already a Space description which could be used for verbose text.

yctercero commented 2 years ago

@rylnd I think that my PR does fix this for the lists indices. I tried it out by creating a space with the following name:

puppy-kitty-ipsum-dolor-sit-good-dog-foot-stick-canary--teeth-mittens-grooming-vaccine-walk-swimming-nest-good-boy-furry-tongue-heel-furry-treats-fish--cage-run-fast-kitten-dinnertime-ball-run-foot-park-fleas-throw-house-train-licks-stick-dinnertime-window--yawn-litter-fish-yawn-toy-pet-gate-throw-buddy-kitty-wag-tail-ball-groom-crate-ferret-heel-wet-nose-rover-toys-pet-supplies--bird-food-treats-tongue-lick-teeth-ferret-litter-box

Didn't get the error @sophiec20 saw, but not sure if I just didn't hit the same limit.

UPDATE: Nevermind, still got the policy error.

elasticmachine commented 2 years ago

Pinging @elastic/security-detections-response (Team:Detections and Resp)

pborgonovi commented 3 months ago

Validated this scenario with latest 8.15 BC.

Currently there is a 512 bytes limit for the space name:

Screenshot 2024-07-23 at 10 26 01 AM

Following the limit, a new space created with a long text as space name:

Screenshot 2024-07-23 at 10 27 01 AM

While launching the Security app we can observe an error is displayed:

https://github.com/user-attachments/assets/9f1402cd-3877-4824-b9b7-d6f4c3dd35b0

Same doesn't occur with custom spaces with medium size text as space names:

https://github.com/user-attachments/assets/22d0983c-bdb7-443e-b920-d01eedb159c9

Same doesn't occur with any other app within Kibana:

https://github.com/user-attachments/assets/41d86a04-73e9-4426-bd22-6948aa827b5e

Error logs: -- As per the error logs we observe that even not meeting the limit size, the space name could be saved.

{
    "statusCode": 400,
    "error": "Bad Request",
    "message": "[Validation Failed: 1: id [index-pattern:security-solution-in-the-heart-of-a-bustling-city--there-was-an-old--forgotten-library--hidden-among-towering-skyscrapers--it-remained-a-sanctuary-for-those-seeking-solace-in-the-pages-of-books--the-library-s-vast-collection--accumulated-over-centuries--held-stories-of-distant-lands--ancient-myths--and-knowledge-long-lost-to-the-world--one-rainy-afternoon--a-young-woman-named-clara-stumbled-upon-the-library-while-seeking-shelter-from-the-storm--drawn-by-its-mysterious-aura--she-wandered-inside-] is too long, must be no longer than 512 bytes but was: 513;: action_request_validation_exception\n\tRoot causes:\n\t\taction_request_validation_exception: Validation Failed: 1: id [index-pattern:security-solution-in-the-heart-of-a-bustling-city--there-was-an-old--forgotten-library--hidden-among-towering-skyscrapers--it-remained-a-sanctuary-for-those-seeking-solace-in-the-pages-of-books--the-library-s-vast-collection--accumulated-over-centuries--held-stories-of-distant-lands--ancient-myths--and-knowledge-long-lost-to-the-world--one-rainy-afternoon--a-young-woman-named-clara-stumbled-upon-the-library-while-seeking-shelter-from-the-storm--drawn-by-its-mysterious-aura--she-wandered-inside-] is too long, must be no longer than 512 bytes but was: 513;]: Validation Failed: 1: id [index-pattern:security-solution-in-the-heart-of-a-bustling-city--there-was-an-old--forgotten-library--hidden-among-towering-skyscrapers--it-remained-a-sanctuary-for-those-seeking-solace-in-the-pages-of-books--the-library-s-vast-collection--accumulated-over-centuries--held-stories-of-distant-lands--ancient-myths--and-knowledge-long-lost-to-the-world--one-rainy-afternoon--a-young-woman-named-clara-stumbled-upon-the-library-while-seeking-shelter-from-the-storm--drawn-by-its-mysterious-aura--she-wandered-inside-] is too long, must be no longer than 512 bytes but was: 513;",
    "attributes": {
        "body": {
            "error": {
                "root_cause": [
                    {
                        "type": "action_request_validation_exception",
                        "reason": "Validation Failed: 1: id [index-pattern:security-solution-in-the-heart-of-a-bustling-city--there-was-an-old--forgotten-library--hidden-among-towering-skyscrapers--it-remained-a-sanctuary-for-those-seeking-solace-in-the-pages-of-books--the-library-s-vast-collection--accumulated-over-centuries--held-stories-of-distant-lands--ancient-myths--and-knowledge-long-lost-to-the-world--one-rainy-afternoon--a-young-woman-named-clara-stumbled-upon-the-library-while-seeking-shelter-from-the-storm--drawn-by-its-mysterious-aura--she-wandered-inside-] is too long, must be no longer than 512 bytes but was: 513;"
                    }
                ],
                "type": "action_request_validation_exception",
                "reason": "Validation Failed: 1: id [index-pattern:security-solution-in-the-heart-of-a-bustling-city--there-was-an-old--forgotten-library--hidden-among-towering-skyscrapers--it-remained-a-sanctuary-for-those-seeking-solace-in-the-pages-of-books--the-library-s-vast-collection--accumulated-over-centuries--held-stories-of-distant-lands--ancient-myths--and-knowledge-long-lost-to-the-world--one-rainy-afternoon--a-young-woman-named-clara-stumbled-upon-the-library-while-seeking-shelter-from-the-storm--drawn-by-its-mysterious-aura--she-wandered-inside-] is too long, must be no longer than 512 bytes but was: 513;"
            },
            "status": 400
        }
    }
}