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

[Cloud Security] Fleet validation using the RequiredVars and CSPM showing validation errors #207130

Merged
merged 23 commits into from
Jan 28, 2025

Conversation

seanrathier
Copy link
Contributor

@seanrathier seanrathier commented Jan 17, 2025

Summary

This change introduces the ability for integrations to validate dependent fields using the required_vars object in the package-spec, for example, a username and password are both required fields. Additionally, we can check for a predetermined value in the required_vars.

The validatePackageRequiredVars validatePackagePolicy function integrates with validatePackagePolicy functions and adds the invalid required_vars to the validationResults object. Validating the required_vars is all dependent on the inputs.stream being enable

{
    "name": null,
    "description": null,
    "namespace": null,
    "inputs": {
        "cspm-cloudbeat/cis_aws": {
            "streams": {
                "cloud_security_posture.findings": {
                    "vars": {
                        ...
                    },
                    "required_vars": {
                        "assume_role": [
                            {
                                "name": "role_arn",
                                "invalid": true
                            }
                        ],
                        "direct_access_keys": [
                            {
                                "name": "aws.credentials.type",
                                "invalid": true
                            },
                            {
                                "name": "access_key_id",
                                "invalid": true
                            },
                            {
                                "name": "secret_access_key",
                                "invalid": true
                            }
                        ],
               
                    }
                }
            }
        },
    },
    "vars": {
        "posture": null,
        "deployment": null
    }
}

We have enhanced the CSPM integration to support required_vars, as such, since the CSPM integration is a custom Fleet extension and the behaviour is only one package policy stream can be enabled, the CSPM UI only needs to know if there are required_vars that are invalid to show the error state.

Screen.Recording.2025-01-20.at.5.47.16.PM.mov

Follow Up

This solution primarily addresses the concerns for the CSPM integration and reads the streams/input/vars, a follow-up issue has been created to include any vars to validate required_vars and introduce Fleet native integration UI to show invalid fields

Depends On

Related Issues

Checklist

@seanrathier seanrathier changed the title [Cloud Security] Dirty working CSPM validation [Cloud Security] Fleet validation using the RequiredVars and CSPM showing validation errors Jan 21, 2025
@seanrathier seanrathier added release_note:skip Skip the PR/issue when compiling release notes Team:Cloud Security Cloud Security team related backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) labels Jan 23, 2025
@seanrathier seanrathier self-assigned this Jan 23, 2025
@seanrathier seanrathier marked this pull request as ready for review January 23, 2025 23:46
@seanrathier seanrathier requested review from a team as code owners January 23, 2025 23:46
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-cloud-security-posture (Team:Cloud Security)

@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Jan 24, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

Copy link
Contributor

@Omolola-Akinleye Omolola-Akinleye left a comment

Choose a reason for hiding this comment

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

🚀

Copy link
Contributor

@jen-huang jen-huang left a comment

Choose a reason for hiding this comment

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

Fleet changes LGTM

@seanrathier seanrathier enabled auto-merge (squash) January 28, 2025 00:05
@elasticmachine
Copy link
Contributor

elasticmachine commented Jan 28, 2025

💔 Build Failed

Failed CI Steps

History

cc @seanrathier

@seanrathier seanrathier merged commit bec72f0 into elastic:main Jan 28, 2025
8 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/13004762294

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.x Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 207130

Questions ?

Please refer to the Backport tool documentation

@seanrathier
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.x

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

Questions ?

Please refer to the Backport tool documentation

seanrathier added a commit to seanrathier/kibana that referenced this pull request Jan 28, 2025
…wing validation errors (elastic#207130)

(cherry picked from commit bec72f0)

# Conflicts:
#	x-pack/test/cloud_security_posture_functional/agentless/create_agent.ts
seanrathier added a commit that referenced this pull request Jan 28, 2025
…PM showing validation errors (#207130) (#208545)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Cloud Security] Fleet validation using the RequiredVars and CSPM
showing validation errors
(#207130)](#207130)

<!--- Backport version: 9.6.4 -->

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

<!--BACKPORT
[{"author":{"name":"seanrathier","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-28T06:18:50Z","message":"[Cloud
Security] Fleet validation using the RequiredVars and CSPM showing
validation errors
(#207130)","sha":"bec72f00ac2ccb3ee72661cdebbcc180b07f78f8","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v9.0.0","Team:Cloud
Security","backport:prev-minor"],"title":"[Cloud Security] Fleet
validation using the RequiredVars and CSPM showing validation
errors","number":207130,"url":"https://github.com/elastic/kibana/pull/207130","mergeCommit":{"message":"[Cloud
Security] Fleet validation using the RequiredVars and CSPM showing
validation errors
(#207130)","sha":"bec72f00ac2ccb3ee72661cdebbcc180b07f78f8"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/207130","number":207130,"mergeCommit":{"message":"[Cloud
Security] Fleet validation using the RequiredVars and CSPM showing
validation errors
(#207130)","sha":"bec72f00ac2ccb3ee72661cdebbcc180b07f78f8"}}]}]
BACKPORT-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) release_note:skip Skip the PR/issue when compiling release notes Team:Cloud Security Cloud Security team related Team:Fleet Team label for Observability Data Collection Fleet team v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants