Skip to content

Security ai prompts #871

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

Merged
merged 11 commits into from
Apr 2, 2025
Merged

Conversation

patrykkopycinski
Copy link
Contributor

@patrykkopycinski patrykkopycinski commented Feb 11, 2025

Adds kibana/security_ai_prompt to support security AI prompt assets.

Why is it important?

In order to have the flexibility to tweak AI prompts outside of our regular ESS release schedule, kibana/security_ai_prompt assets introduce the ability to ship prompt updates for the security AI Assistant and Attack Discovery.

Checklist

Related issues

andrew-goldstein and others added 2 commits February 10, 2025 09:47
Adds `kibana/security_ai_prompt` to support security AI prompt assets.

## Why is it important?

In order to have the flexibility to tweak AI prompts outside of our regular ESS release schedule, `kibana/security_ai_prompt` assets introduce the ability to ship prompt updates for the security AI Assistant and Attack Discovery.

## Checklist

- [x] I have added test packages to [`test/packages`](https://github.com/elastic/package-spec/tree/main/test/packages) that prove my change is effective.
- [x] I have added an entry in [`spec/changelog.yml`](https://github.com/elastic/package-spec/blob/main/spec/changelog.yml).

## Related issues

- <elastic/security-team#11196>
@patrykkopycinski
Copy link
Contributor Author

test integrations

@elastic-vault-github-plugin-prod

Created or updated PR in integrations repository to test this version. Check elastic/integrations#12719

@jsoriano
Copy link
Member

Duplicate of #870? I was commenting on the other one 😅

@patrykkopycinski
Copy link
Contributor Author

yeah, I just want to test it before @andrew-goldstein wakes up :)

@stephmilovic stephmilovic mentioned this pull request Mar 25, 2025
4 tasks
@stephmilovic stephmilovic marked this pull request as ready for review March 26, 2025 17:30
@stephmilovic stephmilovic requested a review from a team as a code owner March 26, 2025 17:30
Comment on lines 139 to 147
- description: Folder containing security AI prompt assets
type: folder
name: "security_ai_prompt"
required: false
contents:
- description: A security AI prompt asset file
type: file
contentMediaType: "application/json"
pattern: '^{PACKAGE_NAME}-.+\.json$'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to add this Kibana asset to content packages? Or is it intended just for integration packages ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not sure what "content packages" is?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading through the the Package specification section of the Integrations Developer Guide, I don't believe this package should be a "content package" since the assets do not include any dashboards, visualizations, or ingest pipelines to enhance the user experience. The assets are JSON saved objects to deliver text at certain points in AI workflows. The user does not see the additional prompting, it is sent to the LLM.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the integrations PR elastic/integrations#13323 you linked, this looks like a candidate to be also available in content packages (under Kibana folder too with the JSON path to remove it in previous versions). Integration packages allow to define data streams, mappings, ingest pipelines and it looks like that all those resources would not be needed for these security AI prompt assets to work (is that right?).

I think it could also be kept as part of integration packages, in case it also needed to add/provide Security AI prompts in integration packages.

WDYT @jsoriano ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have branches of integrations or elastic-package using this change you will need to update the references, yes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs say that elastic-package supports only the "integration" package type. Is that right? How do I update the references?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs say that elastic-package supports only the "integration" package type. Is that right?

This is probably outdated, elastic-package supports integration, input and content packages. Where have you seen this?

How do I update the references?

These lines should do the trick in the integrations or elastic-package repos:

go mod edit -replace github.com/elastic/package-spec/v3=github.com/patrykkopycinski/package-spec/v3@security_ai_prompts
go mod tidy

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

elastic-package supports integration, input and content packages. Where have you seen this?

Thank you. Here is the outdated doc reference https://www.elastic.co/guide/en/integrations-developer/current/elastic-package.html#_elastic_package_build

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stephmilovic
Copy link
Contributor

question for @mrodm / @jsoriano
Once this is merged, how do I update the elastic-package repo? Does this happen through a bot or is there something I need to do? Then once elastic-package is updated, I think I'll need to update the go.mod and go.sum in the integrations repo. Is there a script I can run to do this, or is it a manual step? Thanks

@mrodm
Copy link
Contributor

mrodm commented Mar 27, 2025

question for @mrodm / @jsoriano Once this is merged, how do I update the elastic-package repo? Does this happen through a bot or is there something I need to do? Then once elastic-package is updated, I think I'll need to update the go.mod and go.sum in the integrations repo. Is there a script I can run to do this, or is it a manual step? Thanks

To release these changes and make them available up to the integrations repository, there are a few steps that needs to be performed:

  • release a new package-spec version.
  • update the package-spec dependency into elastic-package and release a new version of elastic-package.
  • update the elastic-package dependency into integrations repo.

However, the version of the spec where these new assets are available would depend on when the support in Fleet/Kibana is added too.

@stephmilovic
Copy link
Contributor

stephmilovic commented Mar 27, 2025

support in Fleet/Kibana is added too

Support is already in Kibana/Fleet. However, it would be a manual installation. This PR is to automatically install the integration and registers the package version, and it will target 8.19.0/9.1.0 elastic/kibana#216106

@jsoriano
Copy link
Member

support in Fleet/Kibana is added too

Support is already in Kibana/Fleet. However, it would be a manual installation. This PR is to automatically install the integration and registers the package version, and it will target 8.19.0/9.1.0 elastic/kibana#216106

When talking about support in Fleet we refer to Fleet being able to install these assets when found in a package.

If we are targeting unreleased versions of Kibana we should use a new minor, 3.4.0 sounds good.

@stephmilovic
Copy link
Contributor

anything else I need on this PR for approval @jsoriano ? Thanks!

jsoriano
jsoriano previously approved these changes Apr 1, 2025
Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In principle the change LGTM. I would still like to see a test package with a more complete use case.

},
"id": "good_content-security-ai-prompt-1",
"type": "security-ai-prompt"
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still missing a sample with a real use case. Is the idea to distribute a package with a collection of prompts? Or to associate prompts to specific data?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I'm confused what else you need here? All the package does is distribute prompts as saved objects. The prompts are looked up with the saved object API within security solution. If no saved object prompt exists, a fallback prompt value exists. https://github.com/elastic/kibana/blob/0d415a6d3a09200dad48a58851d89d81ef897b81/x-pack/solutions/security/packages/security-ai-prompts/src/get_prompt.ts#L109-L113

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about the package that is planned after this new asset is supported. Will it be a package that will contain only a collection of prompts? Or will prompts be added to other packages?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There will be one new package that contains only a collection of prompts as saved objects, see here: https://github.com/elastic/integrations/pull/13323/files

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, then the model proposed here based on content package will fit great.

@jsoriano jsoriano enabled auto-merge (squash) April 2, 2025 09:01
@elasticmachine
Copy link

💚 Build Succeeded

History

@jsoriano jsoriano merged commit ed8dc58 into elastic:main Apr 2, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants