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

[Security Solution] [Attack discovery] Updates Gemini connector to ignore unknown properties in responses #192915

Conversation

andrew-goldstein
Copy link
Contributor

@andrew-goldstein andrew-goldstein commented Sep 13, 2024

[Security Solution] [Attack discovery] Updates Gemini connector to ignore unknown properties in responses

Summary

This PR updates the Gemini connector's RunApiResponseSchema to ignore unknown properties in responses.

It fixes an issue where the recent addition of a modelVersion in Gemini responses causes Attack discovery to fail with the following error:

Attack discovery generation failed

ActionsClientLlm: action result status is error: an error occurred while running the action - Response validation failed (Error: [modelVersion]: definition for this key is missing)

shown in the screenshot below:

error

Desk testing

To reproduce:

  1. Navigate to Security > Attack discovery

  2. Select a Gemini connector

  3. Click Generate

Expected result

  • Attack discoveries are generated

Actual result

  • The following error is displayed:
Attack discovery generation failed

ActionsClientLlm: action result status is error: an error occurred while running the action - Response validation failed (Error: [modelVersion]: definition for this key is missing)

error

… ignore unknown properties in responses

### Summary

This PR updates the Gemini connector's `RunApiResponseSchema` to ignore unknown properties in responses.

It fixes an issue where the recent addition of a `modelVersion` in Gemini responses causes Attack discovery to fail with the following error:

```
Attack discovery generation failed

ActionsClientLlm: action result status is error: an error occurred while running the action - Response validation failed (Error: [modelVersion]: definition for this key is missing)
```

shown in the screenshot below:

![error](https://github.com/user-attachments/assets/8b706290-27ca-42d9-b972-3d8613af690c)

### Desk testing

To reproduce:

1) Navigate to Security > Attack discovery

2) Select a Gemini connector

3) Click Generate

**Expected result**

- Attack discoveries are generated

**Actual result**

- The following error is displayed:

```
Attack discovery generation failed

ActionsClientLlm: action result status is error: an error occurred while running the action - Response validation failed (Error: [modelVersion]: definition for this key is missing)
```

![error](https://github.com/user-attachments/assets/8b706290-27ca-42d9-b972-3d8613af690c)
@andrew-goldstein andrew-goldstein added bug Fixes for quality problems that affect the customer experience release_note:fix Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Security Generative AI Security Generative AI v8.16.0 v8.15.2 labels Sep 13, 2024
@andrew-goldstein andrew-goldstein self-assigned this Sep 13, 2024
@elasticmachine
Copy link
Contributor

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

@andrew-goldstein
Copy link
Contributor Author

Files by Code Owner

elastic/appex-ai-infra

  • x-pack/plugins/stack_connectors/common/gemini/schema.ts
  • x-pack/plugins/stack_connectors/server/connector_types/gemini/gemini.test.ts

elastic/obs-ai-assistant

  • x-pack/plugins/stack_connectors/common/gemini/schema.ts
  • x-pack/plugins/stack_connectors/server/connector_types/gemini/gemini.test.ts

elastic/response-ops

  • x-pack/plugins/stack_connectors/common/gemini/schema.ts
  • x-pack/plugins/stack_connectors/server/connector_types/gemini/gemini.test.ts

elastic/security-generative-ai

  • x-pack/plugins/stack_connectors/common/gemini/schema.ts
  • x-pack/plugins/stack_connectors/server/connector_types/gemini/gemini.test.ts

Copy link
Contributor

@stephmilovic stephmilovic left a comment

Choose a reason for hiding this comment

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

Thanks for the fix, LGTM!

@andrew-goldstein
Copy link
Contributor Author

@elasticmachine merge upstream

@andrew-goldstein
Copy link
Contributor Author

@elasticmachine merge upstream

@stephmilovic
Copy link
Contributor

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @andrew-goldstein

@andrew-goldstein andrew-goldstein merged commit 699db81 into elastic:main Sep 17, 2024
23 checks passed
@andrew-goldstein andrew-goldstein deleted the ignore_uknowns_in_gemini_response_schema branch September 17, 2024 19:46
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Sep 17, 2024
…nore unknown properties in responses (elastic#192915)

## [Security Solution] [Attack discovery] Updates Gemini connector to ignore unknown properties in responses

### Summary

This PR updates the Gemini connector's `RunApiResponseSchema` to ignore unknown properties in responses.

It fixes an issue where the recent addition of a `modelVersion` in Gemini responses causes Attack discovery to fail with the following error:

```
Attack discovery generation failed

ActionsClientLlm: action result status is error: an error occurred while running the action - Response validation failed (Error: [modelVersion]: definition for this key is missing)
```

shown in the screenshot below:

![error](https://github.com/user-attachments/assets/8b706290-27ca-42d9-b972-3d8613af690c)

### Desk testing

To reproduce:

1) Navigate to Security > Attack discovery

2) Select a Gemini connector

3) Click Generate

**Expected result**

- Attack discoveries are generated

**Actual result**

- The following error is displayed:

```
Attack discovery generation failed

ActionsClientLlm: action result status is error: an error occurred while running the action - Response validation failed (Error: [modelVersion]: definition for this key is missing)
```

![error](https://github.com/user-attachments/assets/8b706290-27ca-42d9-b972-3d8613af690c)

(cherry picked from commit 699db81)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Sep 17, 2024
…nore unknown properties in responses (elastic#192915)

## [Security Solution] [Attack discovery] Updates Gemini connector to ignore unknown properties in responses

### Summary

This PR updates the Gemini connector's `RunApiResponseSchema` to ignore unknown properties in responses.

It fixes an issue where the recent addition of a `modelVersion` in Gemini responses causes Attack discovery to fail with the following error:

```
Attack discovery generation failed

ActionsClientLlm: action result status is error: an error occurred while running the action - Response validation failed (Error: [modelVersion]: definition for this key is missing)
```

shown in the screenshot below:

![error](https://github.com/user-attachments/assets/8b706290-27ca-42d9-b972-3d8613af690c)

### Desk testing

To reproduce:

1) Navigate to Security > Attack discovery

2) Select a Gemini connector

3) Click Generate

**Expected result**

- Attack discoveries are generated

**Actual result**

- The following error is displayed:

```
Attack discovery generation failed

ActionsClientLlm: action result status is error: an error occurred while running the action - Response validation failed (Error: [modelVersion]: definition for this key is missing)
```

![error](https://github.com/user-attachments/assets/8b706290-27ca-42d9-b972-3d8613af690c)

(cherry picked from commit 699db81)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.15
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Sep 17, 2024
…r to ignore unknown properties in responses (#192915) (#193221)

# Backport

This will backport the following commits from `main` to `8.15`:
- [[Security Solution] [Attack discovery] Updates Gemini connector to
ignore unknown properties in responses
(#192915)](#192915)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Andrew
Macri","email":"andrew.macri@elastic.co"},"sourceCommit":{"committedDate":"2024-09-17T19:46:48Z","message":"[Security
Solution] [Attack discovery] Updates Gemini connector to ignore unknown
properties in responses (#192915)\n\n## [Security Solution] [Attack
discovery] Updates Gemini connector to ignore unknown properties in
responses\r\n\r\n### Summary\r\n\r\nThis PR updates the Gemini
connector's `RunApiResponseSchema` to ignore unknown properties in
responses.\r\n\r\nIt fixes an issue where the recent addition of a
`modelVersion` in Gemini responses causes Attack discovery to fail with
the following error:\r\n\r\n```\r\nAttack discovery generation
failed\r\n\r\nActionsClientLlm: action result status is error: an error
occurred while running the action - Response validation failed (Error:
[modelVersion]: definition for this key is missing)\r\n```\r\n\r\nshown
in the screenshot
below:\r\n\r\n![error](https://github.com/user-attachments/assets/8b706290-27ca-42d9-b972-3d8613af690c)\r\n\r\n###
Desk testing\r\n\r\nTo reproduce:\r\n\r\n1) Navigate to Security >
Attack discovery\r\n\r\n2) Select a Gemini connector\r\n\r\n3) Click
Generate\r\n\r\n**Expected result**\r\n\r\n- Attack discoveries are
generated\r\n\r\n**Actual result**\r\n\r\n- The following error is
displayed:\r\n\r\n```\r\nAttack discovery generation
failed\r\n\r\nActionsClientLlm: action result status is error: an error
occurred while running the action - Response validation failed (Error:
[modelVersion]: definition for this key is
missing)\r\n```\r\n\r\n![error](https://github.com/user-attachments/assets/8b706290-27ca-42d9-b972-3d8613af690c)","sha":"699db81856eaf9a3666f4f46fa58ee4619b3b17c","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","v9.0.0","Team:
SecuritySolution","Team:Security Generative
AI","v8.16.0","v8.15.2"],"title":"[Security Solution] [Attack discovery]
Updates Gemini connector to ignore unknown properties in
responses","number":192915,"url":"#192915
Solution] [Attack discovery] Updates Gemini connector to ignore unknown
properties in responses (#192915)\n\n## [Security Solution] [Attack
discovery] Updates Gemini connector to ignore unknown properties in
responses\r\n\r\n### Summary\r\n\r\nThis PR updates the Gemini
connector's `RunApiResponseSchema` to ignore unknown properties in
responses.\r\n\r\nIt fixes an issue where the recent addition of a
`modelVersion` in Gemini responses causes Attack discovery to fail with
the following error:\r\n\r\n```\r\nAttack discovery generation
failed\r\n\r\nActionsClientLlm: action result status is error: an error
occurred while running the action - Response validation failed (Error:
[modelVersion]: definition for this key is missing)\r\n```\r\n\r\nshown
in the screenshot
below:\r\n\r\n![error](https://github.com/user-attachments/assets/8b706290-27ca-42d9-b972-3d8613af690c)\r\n\r\n###
Desk testing\r\n\r\nTo reproduce:\r\n\r\n1) Navigate to Security >
Attack discovery\r\n\r\n2) Select a Gemini connector\r\n\r\n3) Click
Generate\r\n\r\n**Expected result**\r\n\r\n- Attack discoveries are
generated\r\n\r\n**Actual result**\r\n\r\n- The following error is
displayed:\r\n\r\n```\r\nAttack discovery generation
failed\r\n\r\nActionsClientLlm: action result status is error: an error
occurred while running the action - Response validation failed (Error:
[modelVersion]: definition for this key is
missing)\r\n```\r\n\r\n![error](#192915
Solution] [Attack discovery] Updates Gemini connector to ignore unknown
properties in responses (#192915)\n\n## [Security Solution] [Attack
discovery] Updates Gemini connector to ignore unknown properties in
responses\r\n\r\n### Summary\r\n\r\nThis PR updates the Gemini
connector's `RunApiResponseSchema` to ignore unknown properties in
responses.\r\n\r\nIt fixes an issue where the recent addition of a
`modelVersion` in Gemini responses causes Attack discovery to fail with
the following error:\r\n\r\n```\r\nAttack discovery generation
failed\r\n\r\nActionsClientLlm: action result status is error: an error
occurred while running the action - Response validation failed (Error:
[modelVersion]: definition for this key is missing)\r\n```\r\n\r\nshown
in the screenshot
below:\r\n\r\n![error](https://github.com/user-attachments/assets/8b706290-27ca-42d9-b972-3d8613af690c)\r\n\r\n###
Desk testing\r\n\r\nTo reproduce:\r\n\r\n1) Navigate to Security >
Attack discovery\r\n\r\n2) Select a Gemini connector\r\n\r\n3) Click
Generate\r\n\r\n**Expected result**\r\n\r\n- Attack discoveries are
generated\r\n\r\n**Actual result**\r\n\r\n- The following error is
displayed:\r\n\r\n```\r\nAttack discovery generation
failed\r\n\r\nActionsClientLlm: action result status is error: an error
occurred while running the action - Response validation failed (Error:
[modelVersion]: definition for this key is
missing)\r\n```\r\n\r\n![error](https://github.com/user-attachments/assets/8b706290-27ca-42d9-b972-3d8613af690c)","sha":"699db81856eaf9a3666f4f46fa58ee4619b3b17c"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.15","label":"v8.15.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Andrew Macri <andrew.macri@elastic.co>
kibanamachine added a commit that referenced this pull request Sep 17, 2024
… to ignore unknown properties in responses (#192915) (#193222)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Security Solution] [Attack discovery] Updates Gemini connector to
ignore unknown properties in responses
(#192915)](#192915)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Andrew
Macri","email":"andrew.macri@elastic.co"},"sourceCommit":{"committedDate":"2024-09-17T19:46:48Z","message":"[Security
Solution] [Attack discovery] Updates Gemini connector to ignore unknown
properties in responses (#192915)\n\n## [Security Solution] [Attack
discovery] Updates Gemini connector to ignore unknown properties in
responses\r\n\r\n### Summary\r\n\r\nThis PR updates the Gemini
connector's `RunApiResponseSchema` to ignore unknown properties in
responses.\r\n\r\nIt fixes an issue where the recent addition of a
`modelVersion` in Gemini responses causes Attack discovery to fail with
the following error:\r\n\r\n```\r\nAttack discovery generation
failed\r\n\r\nActionsClientLlm: action result status is error: an error
occurred while running the action - Response validation failed (Error:
[modelVersion]: definition for this key is missing)\r\n```\r\n\r\nshown
in the screenshot
below:\r\n\r\n![error](https://github.com/user-attachments/assets/8b706290-27ca-42d9-b972-3d8613af690c)\r\n\r\n###
Desk testing\r\n\r\nTo reproduce:\r\n\r\n1) Navigate to Security >
Attack discovery\r\n\r\n2) Select a Gemini connector\r\n\r\n3) Click
Generate\r\n\r\n**Expected result**\r\n\r\n- Attack discoveries are
generated\r\n\r\n**Actual result**\r\n\r\n- The following error is
displayed:\r\n\r\n```\r\nAttack discovery generation
failed\r\n\r\nActionsClientLlm: action result status is error: an error
occurred while running the action - Response validation failed (Error:
[modelVersion]: definition for this key is
missing)\r\n```\r\n\r\n![error](https://github.com/user-attachments/assets/8b706290-27ca-42d9-b972-3d8613af690c)","sha":"699db81856eaf9a3666f4f46fa58ee4619b3b17c","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","v9.0.0","Team:
SecuritySolution","Team:Security Generative
AI","v8.16.0","v8.15.2"],"title":"[Security Solution] [Attack discovery]
Updates Gemini connector to ignore unknown properties in
responses","number":192915,"url":"#192915
Solution] [Attack discovery] Updates Gemini connector to ignore unknown
properties in responses (#192915)\n\n## [Security Solution] [Attack
discovery] Updates Gemini connector to ignore unknown properties in
responses\r\n\r\n### Summary\r\n\r\nThis PR updates the Gemini
connector's `RunApiResponseSchema` to ignore unknown properties in
responses.\r\n\r\nIt fixes an issue where the recent addition of a
`modelVersion` in Gemini responses causes Attack discovery to fail with
the following error:\r\n\r\n```\r\nAttack discovery generation
failed\r\n\r\nActionsClientLlm: action result status is error: an error
occurred while running the action - Response validation failed (Error:
[modelVersion]: definition for this key is missing)\r\n```\r\n\r\nshown
in the screenshot
below:\r\n\r\n![error](https://github.com/user-attachments/assets/8b706290-27ca-42d9-b972-3d8613af690c)\r\n\r\n###
Desk testing\r\n\r\nTo reproduce:\r\n\r\n1) Navigate to Security >
Attack discovery\r\n\r\n2) Select a Gemini connector\r\n\r\n3) Click
Generate\r\n\r\n**Expected result**\r\n\r\n- Attack discoveries are
generated\r\n\r\n**Actual result**\r\n\r\n- The following error is
displayed:\r\n\r\n```\r\nAttack discovery generation
failed\r\n\r\nActionsClientLlm: action result status is error: an error
occurred while running the action - Response validation failed (Error:
[modelVersion]: definition for this key is
missing)\r\n```\r\n\r\n![error](#192915
Solution] [Attack discovery] Updates Gemini connector to ignore unknown
properties in responses (#192915)\n\n## [Security Solution] [Attack
discovery] Updates Gemini connector to ignore unknown properties in
responses\r\n\r\n### Summary\r\n\r\nThis PR updates the Gemini
connector's `RunApiResponseSchema` to ignore unknown properties in
responses.\r\n\r\nIt fixes an issue where the recent addition of a
`modelVersion` in Gemini responses causes Attack discovery to fail with
the following error:\r\n\r\n```\r\nAttack discovery generation
failed\r\n\r\nActionsClientLlm: action result status is error: an error
occurred while running the action - Response validation failed (Error:
[modelVersion]: definition for this key is missing)\r\n```\r\n\r\nshown
in the screenshot
below:\r\n\r\n![error](https://github.com/user-attachments/assets/8b706290-27ca-42d9-b972-3d8613af690c)\r\n\r\n###
Desk testing\r\n\r\nTo reproduce:\r\n\r\n1) Navigate to Security >
Attack discovery\r\n\r\n2) Select a Gemini connector\r\n\r\n3) Click
Generate\r\n\r\n**Expected result**\r\n\r\n- Attack discoveries are
generated\r\n\r\n**Actual result**\r\n\r\n- The following error is
displayed:\r\n\r\n```\r\nAttack discovery generation
failed\r\n\r\nActionsClientLlm: action result status is error: an error
occurred while running the action - Response validation failed (Error:
[modelVersion]: definition for this key is
missing)\r\n```\r\n\r\n![error](https://github.com/user-attachments/assets/8b706290-27ca-42d9-b972-3d8613af690c)","sha":"699db81856eaf9a3666f4f46fa58ee4619b3b17c"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.15","label":"v8.15.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Andrew Macri <andrew.macri@elastic.co>
markov00 pushed a commit to markov00/kibana that referenced this pull request Sep 18, 2024
…nore unknown properties in responses (elastic#192915)

## [Security Solution] [Attack discovery] Updates Gemini connector to ignore unknown properties in responses

### Summary

This PR updates the Gemini connector's `RunApiResponseSchema` to ignore unknown properties in responses.

It fixes an issue where the recent addition of a `modelVersion` in Gemini responses causes Attack discovery to fail with the following error:

```
Attack discovery generation failed

ActionsClientLlm: action result status is error: an error occurred while running the action - Response validation failed (Error: [modelVersion]: definition for this key is missing)
```

shown in the screenshot below:

![error](https://github.com/user-attachments/assets/8b706290-27ca-42d9-b972-3d8613af690c)

### Desk testing

To reproduce:

1) Navigate to Security > Attack discovery

2) Select a Gemini connector

3) Click Generate

**Expected result**

- Attack discoveries are generated

**Actual result**

- The following error is displayed:

```
Attack discovery generation failed

ActionsClientLlm: action result status is error: an error occurred while running the action - Response validation failed (Error: [modelVersion]: definition for this key is missing)
```

![error](https://github.com/user-attachments/assets/8b706290-27ca-42d9-b972-3d8613af690c)
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 release_note:fix Team:Security Generative AI Security Generative AI Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.15.2 v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants