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

Email alerts link do not contain space id #99300

Closed
CruzMarcio opened this issue May 5, 2021 · 5 comments · Fixed by #100734
Closed

Email alerts link do not contain space id #99300

CruzMarcio opened this issue May 5, 2021 · 5 comments · Fixed by #100734
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)

Comments

@CruzMarcio
Copy link

Kibana version: 7.12.1

Elasticsearch version: 7.12.1

Describe the bug:

Email alerts sent by Kibana do not include the space URL on the "View alert in Kibana." link, causing the link not to work when the alert is not created on the default space.

Steps to reproduce:

  1. Set the publicBaseUrl property on the kibana.yml file to the mail Kibana Url like "https://elk.company.com"
  2. Setup an alert outside the Default space with an Email action.
  3. When the email triggers, the URL will be: "https://elk.company.com/app/management/insightsAndAlerting/triggersActions/alert/..."
  4. The link won't work as the alert is not on the Default space.

Expected behavior:

The link should contain the space ID on the URL like "https://elk.company.com/s/space1/app/management/insightsAndAlerting/triggersActions/alert/..."

@CruzMarcio CruzMarcio added the bug Fixes for quality problems that affect the customer experience label May 5, 2021
@botelastic botelastic bot added the needs-team Issues missing a team label label May 5, 2021
@legrego legrego added the Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) label May 10, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-alerting-services (Team:Alerting Services)

@botelastic botelastic bot removed the needs-team Issues missing a team label label May 10, 2021
@pmuellr
Copy link
Member

pmuellr commented May 26, 2021

Not directly related, but happened to remember that I think we'll have an issue for customers who want to use our kibanaBaseUrl global context variable in actions, they'll want the space available as well. Which gets complicated since the default space has no "url prefix", where every other space has a /s/{space-name} prefix. And that may need to get URL encoded. So it seems like we will need a new context variable for "kibana space prefix", which you'd paste after the kibanaBaseUrl context variable, kind of thing. {{kibanaBaseUrl}}{{kibanaSpacePrefix}}/stuff-provided-by-user. I don't >think< we just always want to add the space prefix to the {{kibanaBaseUrl}} anyway, but there are other options like a variable kibanaBaseUrlWithSpacePrefix.

Not sure if this is mentioned in some other issue, I have a feeling it is, but couldn't find it ATM. Probably should be in a separate issue, if it really is an issue (I think it is).

And kinda brought it up to note that when we DO add the space to the link provided in the email, we probably want to url encode it with encodeURIComponent().

@mikecote
Copy link
Contributor

mikecote commented May 26, 2021

@pmuellr ++ to what you said

I don't >think< we just always want to add the space prefix to the {{kibanaBaseUrl}} anyway, but there are other options like a variable kibanaBaseUrlWithSpacePrefix.

I was thinking about this. If we add the space id to kibanaBaseUrl, in theory, customers who already append the space id {{kibanaBaseUrl}}/s/space1/... would then get it appended twice now (breaking change) http://localhost/s/space1/s/space1.... So I guess I'm +1 on something like kibanaBaseUrlWithSpacePrefix and keep kibanaBaseUrl unchanged.

@ymao1 ymao1 self-assigned this May 26, 2021
@ymao1
Copy link
Contributor

ymao1 commented May 26, 2021

And kinda brought it up to note that when we DO add the space to the link provided in the email, we probably want to url encode it with encodeURIComponent().

It looks like space ids can only contain alphanumberic characters plus - and _ so even if your space name is My\//&Space, the non-allowed characters get converted into dashes (my----space) so I don't think we need to use encodeURIComponent?

@pmuellr
Copy link
Member

pmuellr commented Jun 3, 2021

It looks like space ids can only contain alphanumeric characters plus - and _ so even if your space name is My//&Space, the non-allowed characters get converted into dashes (my----space) so I don't think we need to use encodeURIComponent?

Sorry for the late reply, but this came up in conversation yesterday as well. I believe that's correct, as long as the spaceid ends up with characters that don't need to be URL encoded, we wouldn't need to do an explicit URL encode on them. And alphanumerics and - do not need to be URL encoded, so I think we're fine with not doing URL encoding on them.

@kobelb kobelb added the needs-team Issues missing a team label label Jan 31, 2022
@botelastic botelastic bot removed the needs-team Issues missing a team label label Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants