-
Notifications
You must be signed in to change notification settings - Fork 72
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
Expand configuration_links to support internal/external links #844
Conversation
type: next_step | ||
content: "Check your agents in Fleet" | ||
appId: "fleet" | ||
# bad format: `internal: false` should match http or https format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how to enforce this rule. I found the pattern
field but can I enforce it conditionally (based on internal
field)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you would need to use anyOf
or oneOf
. Something like this:
internal:
description: Set to true for internal kibana links, false for external links. Defaults to false.
type: boolean
oneOf:
- const: true
pattern: "^/"
- const: false
pattern: "^https?://"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it can be used if - then
definitions here to set those conditions
I've tried to set these conditions in the manifest definition:
$ git diff
diff --git spec/integration/manifest.spec.yml spec/integration/manifest.spec.yml
index cf39a4f..bd79026 100644
--- spec/integration/manifest.spec.yml
+++ spec/integration/manifest.spec.yml
@@ -235,6 +235,30 @@ spec:
description: Set to true for internal kibana links, false for external links. Defaults to false.
type: boolean
default: false
+ allOf:
+ - if:
+ properties:
+ internal:
+ const: true
+ then:
+ required:
+ - appId
+ properties:
+ url:
+ type: string
+ pattern: '^/'
+ - if:
+ properties:
+ internal:
+ const: false
+ then:
+ not:
+ required:
+ - appId
+ properties:
+ url:
+ type: string
+ pattern: '^http(s)?://'
required:
- title
- url
Adding those definitions there are some errors, that probably are legit.
These conditions enforce:
- a pattern for
url
depending on theinternal
value appId
is set required or not depending on theinternal
value.
Is there any other condition that should be added ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'm switching to use format kbn:...
for internal links as per below discussion. Example kbn:app/integrations/browse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a suggestion to achieve conditional rules in the JSON schema.
type: next_step | ||
content: "Check your agents in Fleet" | ||
appId: "fleet" | ||
# bad format: `internal: false` should match http or https format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it can be used if - then
definitions here to set those conditions
I've tried to set these conditions in the manifest definition:
$ git diff
diff --git spec/integration/manifest.spec.yml spec/integration/manifest.spec.yml
index cf39a4f..bd79026 100644
--- spec/integration/manifest.spec.yml
+++ spec/integration/manifest.spec.yml
@@ -235,6 +235,30 @@ spec:
description: Set to true for internal kibana links, false for external links. Defaults to false.
type: boolean
default: false
+ allOf:
+ - if:
+ properties:
+ internal:
+ const: true
+ then:
+ required:
+ - appId
+ properties:
+ url:
+ type: string
+ pattern: '^/'
+ - if:
+ properties:
+ internal:
+ const: false
+ then:
+ not:
+ required:
+ - appId
+ properties:
+ url:
+ type: string
+ pattern: '^http(s)?://'
required:
- title
- url
Adding those definitions there are some errors, that probably are legit.
These conditions enforce:
- a pattern for
url
depending on theinternal
value appId
is set required or not depending on theinternal
value.
Is there any other condition that should be added ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have we considered to use urls with the kbn:
prefix as we do in other places?
test/packages/good_v3/manifest.yml
Outdated
- title: View Agents | ||
url: "/agents" | ||
type: next_step | ||
content: "View security overview" | ||
content: "Check your agents in Fleet" | ||
appId: "fleet" | ||
internal: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding the internal
setting, could we use the urls prefixed by kbn
that are used in many other places?
- title: View Agents
url: "kbn:/app/fleet/agents"
type: next_step
content: "Check your agents in Fleet"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find any examples in package-spec, but maybe you refer to the Kibana dev tools?
We could use this format, it requires to do some more manipulation in kibana as the url needs to be split (it cannot be used directly by kibana this way) and it's also less explicit. However, reading your other comments I understand your concerns that this could be a bit too specific to Kibana internal way of handling urls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the PR and the description based on this discussion.
type: next_step | ||
content: "Check your agents in Fleet" | ||
appId: "fleet" | ||
# bad format: `internal: false` should match http or https format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you would need to use anyOf
or oneOf
. Something like this:
internal:
description: Set to true for internal kibana links, false for external links. Defaults to false.
type: boolean
oneOf:
- const: true
pattern: "^/"
- const: false
pattern: "^https?://"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I prefer this approach based on the url prefixes, thanks!
Added a suggestion about how patterns are defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
💚 Build Succeeded
History
cc @criamico |
…ut (#203824) ## Summary Display next steps and actions in agentless integrations flyout. This PR is based off the following changes: **Agentless flyout** Introduced with #199567 **package-spec** The definitions for package-spec have been updated in these two PRs: - elastic/package-spec#834 - elastic/package-spec#844 Any agentless package can now define internal links with format `kbn:/app/...` and external links with format `https://...`. This PR shows a card or a button linking to these urls in the new agentless flyout **Connectors** Agentless integration now expose connectors name and id in the package policy (see code [here](https://github.com/elastic/integrations/blob/69fd5a26c4d0a8e9e999c51fb49a2cf28c078dd2/packages/elastic_connectors/manifest.yml#L45-L62) for elastic connectors integration). <img width="1003" alt="Screenshot 2024-12-16 at 16 30 22" src="https://github.com/user-attachments/assets/70b3471e-51bb-4e79-95a4-843e20128c26" /> This PR creates a dynamic link to the connector configured in the policy and shows it in the agentless flyout. ### Testing - First of all, enable agentless following the steps under `Testing` in [ this PR](#199567). Follow up to step 3 - Instead of installing CSPM, install this test package [agentless_package_links-0.0.1.zip](https://github.com/user-attachments/files/18152872/agentless_package_links-0.0.1.zip) with the upload command ``` curl -XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true' http://localhost:5601/YOURPATH/api/fleet/epm/packages -u elastic:changeme --data-binary @agentless_package_links-0.0.1.zip ``` - Once appears installed, create a package policy with this new integration. Make sure to choose `agentless` as deployment mode <img width="1278" alt="Screenshot 2024-12-16 at 16 22 09" src="https://github.com/user-attachments/assets/7104bf2a-e419-4efa-b352-278ad2057951" /> - Enroll an agent to the newly created "agentless" policy by using the token (it's available in the token page) - Go back to integrations, you should see a page like this one: <img width="1569" alt="Screenshot 2024-12-16 at 16 38 18" src="https://github.com/user-attachments/assets/de770984-985e-449e-b6e3-5c78eb5d3926" /> - Click on the state ("pending"/"healhty"/"unhealthy") and see the flyout. If the enrollment was successful, you should see some cards and buttons that link to internal and external links in kibana <img width="878" alt="Screenshot 2024-12-16 at 16 21 57" src="https://github.com/user-attachments/assets/c77b224f-882c-4d52-956a-744e94e36f1e" /> ### Testing the connector cards - First create a new connector: go to `app/elasticsearch/content/connectors` and click on "new connector". For this purpose there's no need to complete the procedure - Note down the name and id of the connector <img width="1789" alt="Screenshot 2024-12-16 at 16 42 00" src="https://github.com/user-attachments/assets/b60e491c-809a-40d5-8d01-12b225896fca" /> <img width="1789" alt="Screenshot 2024-12-16 at 16 42 00" src="https://github.com/user-attachments/assets/1adc65e4-0b3b-4e03-9e65-5cc01385b0db" /> - Go back to the integration policy previously installed. Enable the "Test Connector" input and add the name and id from above. - The agentless flyout should now have a card that will link the user to `app/elasticsearch/content/connectors/<id>` ### Checklist - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials --------- Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: kibanamachine <[email protected]>
…ut (elastic#203824) ## Summary Display next steps and actions in agentless integrations flyout. This PR is based off the following changes: **Agentless flyout** Introduced with elastic#199567 **package-spec** The definitions for package-spec have been updated in these two PRs: - elastic/package-spec#834 - elastic/package-spec#844 Any agentless package can now define internal links with format `kbn:/app/...` and external links with format `https://...`. This PR shows a card or a button linking to these urls in the new agentless flyout **Connectors** Agentless integration now expose connectors name and id in the package policy (see code [here](https://github.com/elastic/integrations/blob/69fd5a26c4d0a8e9e999c51fb49a2cf28c078dd2/packages/elastic_connectors/manifest.yml#L45-L62) for elastic connectors integration). <img width="1003" alt="Screenshot 2024-12-16 at 16 30 22" src="https://github.com/user-attachments/assets/70b3471e-51bb-4e79-95a4-843e20128c26" /> This PR creates a dynamic link to the connector configured in the policy and shows it in the agentless flyout. ### Testing - First of all, enable agentless following the steps under `Testing` in [ this PR](elastic#199567). Follow up to step 3 - Instead of installing CSPM, install this test package [agentless_package_links-0.0.1.zip](https://github.com/user-attachments/files/18152872/agentless_package_links-0.0.1.zip) with the upload command ``` curl -XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true' http://localhost:5601/YOURPATH/api/fleet/epm/packages -u elastic:changeme --data-binary @agentless_package_links-0.0.1.zip ``` - Once appears installed, create a package policy with this new integration. Make sure to choose `agentless` as deployment mode <img width="1278" alt="Screenshot 2024-12-16 at 16 22 09" src="https://github.com/user-attachments/assets/7104bf2a-e419-4efa-b352-278ad2057951" /> - Enroll an agent to the newly created "agentless" policy by using the token (it's available in the token page) - Go back to integrations, you should see a page like this one: <img width="1569" alt="Screenshot 2024-12-16 at 16 38 18" src="https://github.com/user-attachments/assets/de770984-985e-449e-b6e3-5c78eb5d3926" /> - Click on the state ("pending"/"healhty"/"unhealthy") and see the flyout. If the enrollment was successful, you should see some cards and buttons that link to internal and external links in kibana <img width="878" alt="Screenshot 2024-12-16 at 16 21 57" src="https://github.com/user-attachments/assets/c77b224f-882c-4d52-956a-744e94e36f1e" /> ### Testing the connector cards - First create a new connector: go to `app/elasticsearch/content/connectors` and click on "new connector". For this purpose there's no need to complete the procedure - Note down the name and id of the connector <img width="1789" alt="Screenshot 2024-12-16 at 16 42 00" src="https://github.com/user-attachments/assets/b60e491c-809a-40d5-8d01-12b225896fca" /> <img width="1789" alt="Screenshot 2024-12-16 at 16 42 00" src="https://github.com/user-attachments/assets/1adc65e4-0b3b-4e03-9e65-5cc01385b0db" /> - Go back to the integration policy previously installed. Enable the "Test Connector" input and add the name and id from above. - The agentless flyout should now have a card that will link the user to `app/elasticsearch/content/connectors/<id>` ### Checklist - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials --------- Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: kibanamachine <[email protected]> (cherry picked from commit 790c589)
…ut (elastic#203824) ## Summary Display next steps and actions in agentless integrations flyout. This PR is based off the following changes: **Agentless flyout** Introduced with elastic#199567 **package-spec** The definitions for package-spec have been updated in these two PRs: - elastic/package-spec#834 - elastic/package-spec#844 Any agentless package can now define internal links with format `kbn:/app/...` and external links with format `https://...`. This PR shows a card or a button linking to these urls in the new agentless flyout **Connectors** Agentless integration now expose connectors name and id in the package policy (see code [here](https://github.com/elastic/integrations/blob/69fd5a26c4d0a8e9e999c51fb49a2cf28c078dd2/packages/elastic_connectors/manifest.yml#L45-L62) for elastic connectors integration). <img width="1003" alt="Screenshot 2024-12-16 at 16 30 22" src="https://github.com/user-attachments/assets/70b3471e-51bb-4e79-95a4-843e20128c26" /> This PR creates a dynamic link to the connector configured in the policy and shows it in the agentless flyout. ### Testing - First of all, enable agentless following the steps under `Testing` in [ this PR](elastic#199567). Follow up to step 3 - Instead of installing CSPM, install this test package [agentless_package_links-0.0.1.zip](https://github.com/user-attachments/files/18152872/agentless_package_links-0.0.1.zip) with the upload command ``` curl -XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true' http://localhost:5601/YOURPATH/api/fleet/epm/packages -u elastic:changeme --data-binary @agentless_package_links-0.0.1.zip ``` - Once appears installed, create a package policy with this new integration. Make sure to choose `agentless` as deployment mode <img width="1278" alt="Screenshot 2024-12-16 at 16 22 09" src="https://github.com/user-attachments/assets/7104bf2a-e419-4efa-b352-278ad2057951" /> - Enroll an agent to the newly created "agentless" policy by using the token (it's available in the token page) - Go back to integrations, you should see a page like this one: <img width="1569" alt="Screenshot 2024-12-16 at 16 38 18" src="https://github.com/user-attachments/assets/de770984-985e-449e-b6e3-5c78eb5d3926" /> - Click on the state ("pending"/"healhty"/"unhealthy") and see the flyout. If the enrollment was successful, you should see some cards and buttons that link to internal and external links in kibana <img width="878" alt="Screenshot 2024-12-16 at 16 21 57" src="https://github.com/user-attachments/assets/c77b224f-882c-4d52-956a-744e94e36f1e" /> ### Testing the connector cards - First create a new connector: go to `app/elasticsearch/content/connectors` and click on "new connector". For this purpose there's no need to complete the procedure - Note down the name and id of the connector <img width="1789" alt="Screenshot 2024-12-16 at 16 42 00" src="https://github.com/user-attachments/assets/b60e491c-809a-40d5-8d01-12b225896fca" /> <img width="1789" alt="Screenshot 2024-12-16 at 16 42 00" src="https://github.com/user-attachments/assets/1adc65e4-0b3b-4e03-9e65-5cc01385b0db" /> - Go back to the integration policy previously installed. Enable the "Test Connector" input and add the name and id from above. - The agentless flyout should now have a card that will link the user to `app/elasticsearch/content/connectors/<id>` ### Checklist - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials --------- Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: kibanamachine <[email protected]>
What does this PR do?
Follow up to #834
Why is it important?
With #834 I added support to configuration_links to kibana manifest. This PR expands upon the previous change setting explicit formats for the urls:
External links should have
url
field of typehttp://...
orhttps://..
Internal links should use the
kbn:/
prefix (similar to what it's done in Kiban dev tools) and of course the link should be a valid Kibana link in order to work . Example corresponding to/app/integrations/browse
:NOTE Kibana doesn't currently handle
configuration_links
field at all and just ignores this field, as I'm still working to the related changes. This change should be safe to merge.Checklist
test/packages
that prove my change is effective.spec/changelog.yml
.Related issues
Related to #832