Skip to content

Navigation issues with percent sign in names #82440

@yuliacech

Description

@yuliacech

Kibana version:
Current master branch

Describe the bug:
Navigation doesn't work correctly for resources with names containing percent sign with other special characters or containing %25 sequence. The issue occurs in plugins:

  • ILM
  • Index Management

The issue occurs because history package (react-router dependency) uses decodeURI on the url and only happens when the user reloads a page or navigates from outside of Kibana via a deep link. The issue doesn't happen when navigating inside Kibana with react-router when encodeURI is used on the url.

Explanation of match params decoding in react-router
const policyName = 'test%#';
const url = encodeURI(`/policies/edit/${encodeURIComponent(policyName)}`); 
// url is '/policies/edit/test%2525%2523' (double decoding)
reactRouterNavigate(url);
  1. decodeURI is called internally in react-router/history package
  2. address bar is set to test%25%23
  3. match params coming from react-router is set to test%25%23
  4. encodeURIComponent('test%25%23') is used in components getting match params from react-router to get the correct policyName test%#.

When the user reloads the page, react-router decodes the value coming from the address bar:

  1. decodeURI('test%25%23') results in match params set to test%%23
  2. calling encodeURIComponent('test%%23') throws an URIError, so using match params directly results in the wrong policy name test%%23.

The issue might be fixed once react-router is updated to v6 (which uses history v5).

Related history packages issues: 505, 777, 786

Steps to reproduce:

  • ILM
  1. Create a policy with the name test%25 or test%# and click 'save' button.
  2. In the policies table, click on the newly created policy to navigate to the edit page.
  3. Reload the edit page, the name of the policy will be test% (not test%25) or test%%23 (not test%#).
  • Index Management (index templates tab)
  1. Create an index template with the name test%25 or test%#
  2. After saving, the app will redirect to index templates table with a detail flyout displaying the newly created index template.
  3. Reload the page, the name of the template will be test% (not test%25) or test%%23 (not test%#).
Screenshot Screenshot 2020-11-03 at 14 59 08

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature:ILMTeam:Kibana ManagementDev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t//bugFixes for quality problems that affect the customer experience

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions