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] Add support for required conditional groups of variables #855

Merged
merged 10 commits into from
Jan 22, 2025

Conversation

seanrathier
Copy link
Contributor

@seanrathier seanrathier commented Jan 14, 2025

What does this PR do?

Add support for conditionally required groups of variables.

Why is it important?

In some cases, policy templates like CloudFlare and CSPM will have mutually exclusive input variables that are required.

For example, access_key and secret_key or the session_token is required

required_vars:
    - [access_key,secret_key]
    - [session_token]

Checklist

Related issues

@seanrathier seanrathier marked this pull request as ready for review January 14, 2025 22:08
@seanrathier seanrathier requested a review from a team as a code owner January 14, 2025 22:08
test/packages/bad_required_vars/manifest.yml Show resolved Hide resolved
spec/changelog.yml Outdated Show resolved Hide resolved
spec/integration/manifest.spec.yml Outdated Show resolved Hide resolved
test/packages/good_v3/manifest.yml Outdated Show resolved Hide resolved
@seanrathier seanrathier requested a review from jsoriano January 16, 2025 16:27
jsoriano
jsoriano previously approved these changes Jan 16, 2025
@@ -515,6 +515,8 @@ spec:
description: Can input be defined multiple times
type: boolean
default: false
required_vars:
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be added also into input packages ? @jsoriano @seanrathier

Copy link
Member

Choose a reason for hiding this comment

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

We could add there later if needed. @seanrathier do you need this for your current use case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I only need it in stream/inputs

@elasticmachine
Copy link

💚 Build Succeeded

History

@jsoriano jsoriano merged commit a581c17 into main Jan 22, 2025
3 checks passed
@jsoriano jsoriano deleted the required-fields branch January 22, 2025 19:26
jsoriano added a commit that referenced this pull request Jan 23, 2025
Add semantic validation and some additional tests for required variable
groups added in #855.
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.

[Change Proposal] Add support for required conditional groups of variables
4 participants