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

Add validation rule to ensure security capability depending on security-rule assets #820

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

mrodm
Copy link
Contributor

@mrodm mrodm commented Oct 17, 2024

What does this PR do?

Add a new validation rule to ensure that security capability is added in the manifest if there is any security-rule asset (in Kibana folder).

Additional changes:

  • Update junit plugin up to 2.5.0, so skipped tests can be notified too.
  • Ensure each junit step reports using the required files.

Why is it important?

Currently, there are just two packages using security-rule assets. Both packages have defined the security capability.

This PR ensures that packages containing this kind of security-rule assets are not listed as available to be installed in Observability Serverless projects.

Checklist

Related issues

This validation rule checks if there is any security-rule asset in
kibana folder. If there is any, then security capability must be
defined as part of the package manifest.
@mrodm mrodm self-assigned this Oct 17, 2024
@mrodm mrodm changed the title Add security rule validation check Add validation rule to ensure security capability depending on security-rule assets Oct 17, 2024
@mrodm
Copy link
Contributor Author

mrodm commented Oct 17, 2024

test integrations

@elastic-vault-github-plugin-prod

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

@mrodm
Copy link
Contributor Author

mrodm commented Oct 17, 2024

/test

- junit-annotate#v2.4.1:
artifacts: "*.xml"
- junit-annotate#v2.5.0:
artifacts: "build/test-results/*.xml"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ensures that this step just downloads and process the XML files from the unit test steps (linux and windows).

Comment on lines +41 to +45
if !slices.Contains(capabilities, "security") {
return specerrors.ValidationErrors{
specerrors.NewStructuredErrorf("found security rule assets in package but security capability is missing in package manifest"),
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we check that none of the observability capabilities are defined too?https://github.com/elastic/kibana/blob/77102c1854bba7253da5363168e8aafb66a34579/config/serverless.oblt.yml#L145

As this validation is defined now, it just enforces to be present security capability.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Something like:

	if slices.Contains(capabilities, "observability") || slices.Contains(capabilities, "apm") || slices.Contains(capabilities, "uptime") {
		return specerrors.ValidationErrors{
			specerrors.NewStructuredErrorf("found security rule assets in package but observability capabilities are defined in package manifest"),
		}
	}

The issue here is if those capabilities are modified in Kibana or a new one is added.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or maybe ensure that just one capability is defined, and that one is "security" ?
Currently, it is just allowed "security":
https://github.com/elastic/kibana/blob/6f4346e4e6f61cf67db50fbe7ce0836c0317cc09/config/serverless.security.yml#L77

That would need to update good_v2 and good_v3 packages (manifests) to just have security capability.

@mrodm mrodm marked this pull request as ready for review October 17, 2024 15:45
@mrodm mrodm requested a review from a team as a code owner October 17, 2024 15:45
@mrodm
Copy link
Contributor Author

mrodm commented Oct 17, 2024

/test

@elasticmachine
Copy link

💚 Build Succeeded

History

cc @mrodm

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.

[Enhancement] Add a new validation rule to ensure capability security is defined
2 participants