Skip to content

Add provider_permissions field for declaring integration permission requirements#1180

Open
jeniawhite wants to merge 6 commits into
elastic:mainfrom
jeniawhite:evgb-PermissionsRoles
Open

Add provider_permissions field for declaring integration permission requirements#1180
jeniawhite wants to merge 6 commits into
elastic:mainfrom
jeniawhite:evgb-PermissionsRoles

Conversation

@jeniawhite

@jeniawhite jeniawhite commented Jun 4, 2026

Copy link
Copy Markdown

What does this PR do?

Adds a new optional provider_permissions field to the package manifest schema for both integration and input package types. The field can be declared at four levels - package, policy_template, input, and data_stream - allowing permission requirements to be expressed at the right granularity. Each entry in the array targets a specific provider (e.g. aws, gcp, azure, kubernetes) and carries two optional sub-fields:

  • permissions: individual permission grants (e.g. s3:GetObject, storage.objects.get, Microsoft.Compute/virtualMachines/read)
  • roles: pre-defined roles or managed policies to attach alongside inline permissions (e.g. SecurityAudit, roles/logging.viewer)

The field is introduced in spec version 3.7.0 and is removed via version patches for older format_version values.

Why is it important?

Integration packages currently have no machine-readable way to declare what provider permissions they require. This means permission requirements live only in documentation, drift over time, and cannot be used by tooling. With provider_permissions in the spec, tooling can read exactly which permissions each enabled integration needs and generate appropriately scoped infrastructure-as-code (IaC) artifacts - rather than granting a static kitchen-sink policy. The permission declarations are versioned alongside the package, making them auditable and kept in sync with the data streams they support.

Checklist

Related issues

Summary by CodeRabbit

  • New Features

    • Added support for provider_permissions across package, policy template, input, and data stream levels for finer permission declarations.
  • Documentation

    • Added changelog entry documenting provider_permissions support (in-development 3.6.4-next).
  • Tests

    • Added test fixtures covering valid and invalid provider_permissions cases, including missing required fields and disallowed extra fields.

@jeniawhite jeniawhite requested a review from a team as a code owner June 4, 2026 02:38
@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 42a93671-01a4-4bf0-a71e-7df407153c26

📥 Commits

Reviewing files that changed from the base of the PR and between dc5e401 and 1645339.

📒 Files selected for processing (1)
  • spec/changelog.yml

📝 Walkthrough

Walkthrough

Adds a provider_permissions JSON schema definition, wires it into package, policy_template, input, and data_stream specs, and supplies validator tests plus good/bad package fixtures exercising acceptance and rejection of the new shape.

Changes

Provider Permissions Schema and Test Coverage

Layer / File(s) Summary
Provider Permissions Schema Definition and Integration
spec/integration/manifest.spec.yml, spec/input/manifest.spec.yml, spec/integration/data_stream/manifest.spec.yml
New provider_permissions definition (required provider, optional description, roles, permissions) and $ref added to package root, policy_templates, template inputs, input spec, and data_stream spec.
Test Harness Integration
code/go/pkg/validator/validator_test.go
Validator tests extended with two good fixtures and three bad fixtures for provider_permissions validation.
Comprehensive Valid Test Fixture: good_provider_permissions
test/packages/good_provider_permissions/manifest.yml, test/packages/good_provider_permissions/docs/README.md, test/packages/good_provider_permissions/changelog.yml, test/packages/good_provider_permissions/LICENSE.txt, test/packages/good_provider_permissions/data_stream/ec2_metrics/manifest.yml, test/packages/good_provider_permissions/data_stream/ec2_metrics/fields/fields.yml, test/packages/good_provider_permissions/data_stream/ec2_metrics/agent/stream/stream.yml.hbs
Full test package exercising provider_permissions across package, policy_template, input, and data_stream levels with multiple providers and roles.
Valid Test Fixture: good_provider_permissions_input
test/packages/good_provider_permissions_input/manifest.yml, test/packages/good_provider_permissions_input/docs/README.md, test/packages/good_provider_permissions_input/changelog.yml, test/packages/good_provider_permissions_input/LICENSE.txt, test/packages/good_provider_permissions_input/agent/input/input.yml.hbs, test/packages/good_provider_permissions_input/fields/base-fields.yml
Input-focused test package validating package- and policy_template-level provider_permissions for AWS and GCP.
Invalid Test Fixture: bad_provider_permissions
test/packages/bad_provider_permissions/manifest.yml, test/packages/bad_provider_permissions/docs/README.md, test/packages/bad_provider_permissions/changelog.yml, test/packages/bad_provider_permissions/LICENSE.txt
Fixture missing required provider field in provider_permissions.
Invalid Test Fixture: bad_provider_permissions_missing_name
test/packages/bad_provider_permissions_missing_name/manifest.yml, test/packages/bad_provider_permissions_missing_name/docs/README.md, test/packages/bad_provider_permissions_missing_name/changelog.yml, test/packages/bad_provider_permissions_missing_name/LICENSE.txt
Fixture with permissions item missing required name field.
Invalid Test Fixture: bad_provider_permissions_extra_field
test/packages/bad_provider_permissions_extra_field/manifest.yml, test/packages/bad_provider_permissions_extra_field/docs/README.md, test/packages/bad_provider_permissions_extra_field/changelog.yml, test/packages/bad_provider_permissions_extra_field/LICENSE.txt
Fixture including disallowed resources field in permissions items.
Version Changelog Entry
spec/changelog.yml
Adds 3.6.4-next entry documenting provider_permissions support at package, policy_template, input, and data_stream levels.

Estimated code review effort:
🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels:
enhancement

Suggested reviewers:

  • teresaromero
  • jsoriano

"🐰 In manifests new fields I sow,
provider names where permissions grow,
Roles and rules in tidy lines,
Tests hop through valid and bad signs,
A tiny patch, a safer flow."

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a new provider_permissions field to the manifest schema for declaring integration permission requirements.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@spec/changelog.yml`:
- Line 13: Update the placeholder link value for the changelog entry by
replacing the current "https://github.com/elastic/package-spec/pull/0000" with
the actual GitHub PR URL for this change or the literal string "TBD" if the PR
does not yet exist; locate the YAML entry using the link key in the changelog
record and ensure the value is a full GitHub PR URL format
(https://github.com/{owner}/{repo}/pull/{number}) or "TBD".

In `@spec/integration/manifest.spec.yml`:
- Around line 1082-1089: Reorder the JSON Patch ops so all removals of property
references occur before removing the definition; specifically, move the three
remove ops for "/properties/provider_permissions",
"/properties/policy_templates/items/properties/provider_permissions", and
"/properties/policy_templates/items/properties/inputs/items/properties/provider_permissions"
ahead of the remove op for "/definitions/provider_permissions" so references are
deleted before the "/definitions/provider_permissions" entry is removed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: ce53ca47-2ebc-460d-89cb-145c66c83415

📥 Commits

Reviewing files that changed from the base of the PR and between 5b54815 and ec060d5.

📒 Files selected for processing (34)
  • code/go/pkg/validator/validator_test.go
  • spec/changelog.yml
  • spec/input/manifest.spec.yml
  • spec/integration/data_stream/manifest.spec.yml
  • spec/integration/manifest.spec.yml
  • test/packages/bad_provider_permissions/LICENSE.txt
  • test/packages/bad_provider_permissions/changelog.yml
  • test/packages/bad_provider_permissions/docs/README.md
  • test/packages/bad_provider_permissions/manifest.yml
  • test/packages/bad_provider_permissions_extra_field/LICENSE.txt
  • test/packages/bad_provider_permissions_extra_field/changelog.yml
  • test/packages/bad_provider_permissions_extra_field/docs/README.md
  • test/packages/bad_provider_permissions_extra_field/manifest.yml
  • test/packages/bad_provider_permissions_missing_name/LICENSE.txt
  • test/packages/bad_provider_permissions_missing_name/changelog.yml
  • test/packages/bad_provider_permissions_missing_name/docs/README.md
  • test/packages/bad_provider_permissions_missing_name/manifest.yml
  • test/packages/bad_provider_permissions_old_version/LICENSE.txt
  • test/packages/bad_provider_permissions_old_version/changelog.yml
  • test/packages/bad_provider_permissions_old_version/docs/README.md
  • test/packages/bad_provider_permissions_old_version/manifest.yml
  • test/packages/good_provider_permissions/LICENSE.txt
  • test/packages/good_provider_permissions/changelog.yml
  • test/packages/good_provider_permissions/data_stream/ec2_metrics/agent/stream/stream.yml.hbs
  • test/packages/good_provider_permissions/data_stream/ec2_metrics/fields/fields.yml
  • test/packages/good_provider_permissions/data_stream/ec2_metrics/manifest.yml
  • test/packages/good_provider_permissions/docs/README.md
  • test/packages/good_provider_permissions/manifest.yml
  • test/packages/good_provider_permissions_input/LICENSE.txt
  • test/packages/good_provider_permissions_input/agent/input/input.yml.hbs
  • test/packages/good_provider_permissions_input/changelog.yml
  • test/packages/good_provider_permissions_input/docs/README.md
  • test/packages/good_provider_permissions_input/fields/base-fields.yml
  • test/packages/good_provider_permissions_input/manifest.yml

Comment thread spec/changelog.yml Outdated
Comment thread spec/integration/manifest.spec.yml Outdated
Comment thread spec/changelog.yml
- description: Add support for semantic_text field definition.
type: enhancement
link: https://github.com/elastic/package-spec/pull/807
- description: Add provider_permissions field to package, policy_template, input, and data_stream levels for declaring provider-specific permissions.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is there any change required on the kibana side for this to be released?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

we will use the provider_permissions from kibana to generate a list of required permissions in the onboarding flow: https://github.com/elastic/ingest-dev/issues/7927
there should be no dependency on kibana, the new fields are additive and won't be used on old kibana versions (should be smoke tested)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As this doesn't affect existing versions of Kibana we can release this in 3.6.4, and use it on any package.

Comment thread spec/integration/manifest.spec.yml Outdated
provider_permissions:
description: >
Permissions and roles this integration unit requires from the named provider.
May be declared at package, policy_template, input, and data_stream levels.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we document how different levels of declaring this permissions work? what if i declare it at package and then at an input? does it override? Are there any cases where we might need to check semantically the meaning of this permissions across levels? Is there any case we want to avoid? or validate?

Comment thread spec/integration/manifest.spec.yml Outdated
provider:
description: >
Identifier of the provider these permissions apply to
(e.g. "aws", "gcp", "azure", "kubernetes", "okta").

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
(e.g. "aws", "gcp", "azure", "kubernetes", "okta").

as we have them as example on the examples i think this might be redundant. Else, we can keep them here and perhaps add a single example (reducing the lines)

@jsoriano jsoriano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

FTR, as discussed over slack, as these new settings won't affect current versions of kibana, we can release this in next 3.6 version, and we can remove the version patches for 3.7.0.

This way this can be earlier used in packages without needing to bump their kibana or format versions.

Comment thread spec/input/manifest.spec.yml Outdated
Comment on lines +179 to +184
- before: 3.7.0
patch:
- op: remove
path: "/properties/provider_permissions"
- op: remove
path: "/properties/policy_templates/items/properties/provider_permissions"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

JSON patches would not be needed if this new setting doesn't affect existing versions of Fleet.

Suggested change
- before: 3.7.0
patch:
- op: remove
path: "/properties/provider_permissions"
- op: remove
path: "/properties/policy_templates/items/properties/provider_permissions"

Comment on lines +715 to +719
- before: 3.7.0
patch:
# provider_permissions field for provider-specific permission declarations.
- op: remove
path: "/properties/provider_permissions"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

JSON patches would not be needed if this new setting doesn't affect existing versions of Fleet.

Suggested change
- before: 3.7.0
patch:
# provider_permissions field for provider-specific permission declarations.
- op: remove
path: "/properties/provider_permissions"

Comment thread spec/integration/manifest.spec.yml Outdated
Comment on lines +1079 to +1089
- before: 3.7.0
patch:
# provider_permissions field for provider-specific permission declarations.
- op: remove
path: "/properties/provider_permissions"
- op: remove
path: "/properties/policy_templates/items/properties/provider_permissions"
- op: remove
path: "/properties/policy_templates/items/properties/inputs/items/properties/provider_permissions"
- op: remove
path: "/definitions/provider_permissions"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
- before: 3.7.0
patch:
# provider_permissions field for provider-specific permission declarations.
- op: remove
path: "/properties/provider_permissions"
- op: remove
path: "/properties/policy_templates/items/properties/provider_permissions"
- op: remove
path: "/properties/policy_templates/items/properties/inputs/items/properties/provider_permissions"
- op: remove
path: "/definitions/provider_permissions"

Comment thread spec/changelog.yml
- description: Add support for semantic_text field definition.
type: enhancement
link: https://github.com/elastic/package-spec/pull/807
- description: Add provider_permissions field to package, policy_template, input, and data_stream levels for declaring provider-specific permissions.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As this doesn't affect existing versions of Kibana we can release this in 3.6.4, and use it on any package.

@jeniawhite

Copy link
Copy Markdown
Author

@teresaromero @jsoriano
Addressed your review comments, please re-review to approve to merge if no further action needed.
Thank you.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
spec/integration/manifest.spec.yml (1)

1077-1080: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add a version-gating patch for provider_permissions to preserve spec-version contracts.

Line 1077 starts the versions list, but there is no before patch removing provider_permissions for older format_version values. As written, versions before the feature’s introduction can still accept this field.

Suggested patch shape
 versions:
+  - before: 3.6.4
+    patch:
+      - op: remove
+        path: "/properties/provider_permissions"
+      - op: remove
+        path: "/properties/policy_templates/items/properties/provider_permissions"
+      - op: remove
+        path: "/properties/policy_templates/items/properties/inputs/items/properties/provider_permissions"
+      - op: remove
+        path: "/definitions/provider_permissions"
   - before: 3.6.0
     patch:

Based on learnings: “In .spec.yml files that support multiple format versions, add versions.before remove patches for new properties and definitions when older format_version values should not include the new schema.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@spec/integration/manifest.spec.yml` around lines 1077 - 1080, Add a
version-gating "before" patch to the versions list that removes the new
provider_permissions schema for older format_version values so pre-introduction
manifests cannot accept that field; locate the versions block (the existing
"versions:" list starting at the current entry) and add a patch entry that
targets and removes the provider_permissions property/definition (referencing
"provider_permissions") under the appropriate "before" key so older versions are
stripped of that property while newer patches keep it.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@spec/changelog.yml`:
- Around line 11-15: The changelog entry was added as a new released version
block ("version: 3.6.4") but must be appended to the in-development section
("version: 3.7.0-next"); move the entire changes item (the list entry with
description about provider_permissions and link to PR `#1180`) out of the newly
created 3.6.4 block and insert it at the bottom of the changes list under the
existing "version: 3.7.0-next" section so it becomes the last item in that list.

---

Outside diff comments:
In `@spec/integration/manifest.spec.yml`:
- Around line 1077-1080: Add a version-gating "before" patch to the versions
list that removes the new provider_permissions schema for older format_version
values so pre-introduction manifests cannot accept that field; locate the
versions block (the existing "versions:" list starting at the current entry) and
add a patch entry that targets and removes the provider_permissions
property/definition (referencing "provider_permissions") under the appropriate
"before" key so older versions are stripped of that property while newer patches
keep it.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: da7a3b24-9f9e-413e-b87e-3f763c858556

📥 Commits

Reviewing files that changed from the base of the PR and between ec060d5 and dc5e401.

📒 Files selected for processing (10)
  • code/go/pkg/validator/validator_test.go
  • spec/changelog.yml
  • spec/input/manifest.spec.yml
  • spec/integration/data_stream/manifest.spec.yml
  • spec/integration/manifest.spec.yml
  • test/packages/bad_provider_permissions/manifest.yml
  • test/packages/bad_provider_permissions_extra_field/manifest.yml
  • test/packages/bad_provider_permissions_missing_name/manifest.yml
  • test/packages/good_provider_permissions/manifest.yml
  • test/packages/good_provider_permissions_input/manifest.yml
💤 Files with no reviewable changes (3)
  • code/go/pkg/validator/validator_test.go
  • spec/input/manifest.spec.yml
  • spec/integration/data_stream/manifest.spec.yml

Comment thread spec/changelog.yml Outdated
Comment on lines +11 to +15
- version: 3.6.4
changes:
- description: Add provider_permissions field to package, policy_template, input, and data_stream levels for declaring provider-specific permissions.
type: enhancement
link: https://github.com/elastic/package-spec/pull/1180

@coderabbitai coderabbitai Bot Jun 4, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Move this changelog item under 3.7.0-next instead of creating a new 3.6.4 block.

Line 11 introduces a new released-version section, but changelog policy here requires adding new PR entries to the bottom of the in-development -next version’s changes list.

Suggested edit
 - version: 3.7.0-next
   changes:
     # Pending on https://github.com/elastic/kibana/issues/220294
     - description: Add support for semantic_text field definition.
       type: enhancement
       link: https://github.com/elastic/package-spec/pull/807
+    - description: Add provider_permissions field to package, policy_template, input, and data_stream levels for declaring provider-specific permissions.
+      type: enhancement
+      link: https://github.com/elastic/package-spec/pull/1180
-- version: 3.6.4
-  changes:
-    - description: Add provider_permissions field to package, policy_template, input, and data_stream levels for declaring provider-specific permissions.
-      type: enhancement
-      link: https://github.com/elastic/package-spec/pull/1180

As per coding guidelines: “Changelog entries must be added at the bottom of the changes list of the in-development version (the one with -next suffix).”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@spec/changelog.yml` around lines 11 - 15, The changelog entry was added as a
new released version block ("version: 3.6.4") but must be appended to the
in-development section ("version: 3.7.0-next"); move the entire changes item
(the list entry with description about provider_permissions and link to PR
`#1180`) out of the newly created 3.6.4 block and insert it at the bottom of the
changes list under the existing "version: 3.7.0-next" section so it becomes the
last item in that list.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@jsoriano
Since we want to release as part of 3.6.4, I assume that pushing this to 3.7.0-next is not the intended change. Please correct me if I'm wrong.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Comment thread spec/changelog.yml Outdated
Co-authored-by: Tere <romero.teresa@protonmail.com>
@elasticmachine

Copy link
Copy Markdown

💚 Build Succeeded

History

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.

5 participants