Skip to content

[Osquery] Integration-centric pack targeting for shared Osquery Manager integrations (secu - #306005

Open
tomsonpl wants to merge 22 commits into
elastic:mainfrom
tomsonpl:autopilot/20261117-osquery-integration-centric-pack-targeting-for-3
Open

tomsonpl wants to merge 22 commits into
elastic:mainfrom
tomsonpl:autopilot/20261117-osquery-integration-centric-pack-targeting-for-3

Conversation

@tomsonpl

@tomsonpl tomsonpl commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When one Osquery Manager integration is shared by several agent policies (Fleet reusable integration policies), a pack set to run on a subset of those policies actually runs on all of them. Fleet compiles the pack into the shared integration, and the pack UI never says so. Kibana can't split a shared integration (osquery_manager is multiple: false) and blocking sharing would break customers who share on purpose, so pack targeting now shows the unit Fleet really delivers to: the integration.

Closes #285994. Follows the direction agreed in elastic/security-team#19203. Not breaking: request schemas are unchanged, no saved-object migration, no osquerybeat change, and every response field is additive.

Changes

  • Policy picker: agent policies that share an integration show as one row, following Fleet's shared-integration summary: the first agent policy's name, a +N badge that opens a popover listing every agent policy of the integration (link, agents, marker), and a "Shared" label whose tooltip names the integration. The row toggles all of them together, the Agents column shows the total, and the selected count stays in agent-policy units.
  • Editing a pack saved with a partial selection: the row shows as checked, the other agent policies are marked "Included via shared integration" in the popover, and a callout names them and says saving adds them to the pack. Shards are configured once per integration; the value loads as the shard Fleet actually runs (a selected agent policy without its own shard counts as 100%).
  • Activation confirmation: counts every agent policy and agent of the shared integration.
  • Packs list: "Scheduled policies" counts the policies the pack really reaches, with a tooltip when that is more than what was saved.
  • Warning toast: creating, updating or activating a pack whose selection is partial shows a warning naming the integration and the extra agent policies.
  • API (additive only):
    • GET /internal/osquery/fleet_wrapper/agent_policies returns the owning package policy per agent policy, and no longer caps at 1000 package policies.
    • POST/PUT /api/osquery/packs keep policy_ids as is and add warnings: [{ code: 'shared_integration_overdelivery', ... }].
    • GET /api/osquery/packs and /{id} add effective_policy_ids, computed live so later Fleet changes show up. If the Fleet read fails the field is omitted, the request still succeeds.
    • The create response now returns data.policy_ids like read and update do.
  • OpenAPI schemas and bundles are regenerated, and there is a new Scout API spec (packs_shared_integration.spec.ts).

Verification

Scoped to the osquery plugin, Node 24.22.3:

  • node scripts/jest --config x-pack/platform/plugins/shared/osquery/jest.config.js: 233 suites, 3488 tests passed
  • node scripts/type_check --project x-pack/platform/plugins/shared/osquery/tsconfig.json: clean
  • node scripts/eslint x-pack/platform/plugins/shared/osquery: clean

On a loaded machine a couple of 5 s test timeouts showed up in public/packs/form/index.test.tsx and query_flyout.test.tsx, a different test each time. They pass in isolation and an identical rerun was green; no timeouts were changed.

Manually against a local stack (one integration shared by e2e-shared-a and e2e-shared-b, plus one dedicated integration, fake agents):

Scenario Result
POST pack with only a → data.policy_ids = [a], warning names the shared integration and b ✅
Dedicated pack, and PUT with [a, b] → no warning ✅
effective_policy_ids on read/find; a policy attached to the integration later shows up there but not in policy_ids ✅
Internal agent-policies route: a and b share package_policy_id, dedicated has its own ✅
UI: group selected as a unit ("2 selected") ✅
UI: legacy partial pack shows the group checked, the "Included via shared integration" marker, the callout and the tooltip in the packs list ✅
UI: activating a partial pack shows the warning toast ✅

Review follow-up (f18717882beb), found while testing the UI on a local stack and fixed:

  • Saving an untouched pack whose shared integration had a shard on only one selected agent policy lowered the live shard from 100% to 10% (the form loaded 10 for the whole integration). It now loads 100 and the integration stays at 100. Note: such packs now save every agent policy of the integration at 100, which is what Fleet was already running.
  • An agent policy with a shard was wrongly marked "Included via shared integration" and named in the callout.
  • The activation modal said "0 agent policies" for a disabled pack on a shared integration.
  • The picker's stacked member layout was replaced by the Fleet-style row described above.

Re-verified on a local stack after the fix: untouched save keeps the shard at 100; the modal shows 2 agent policies; creating a pack by ticking the shared row sends both agent policies with no warning; a shard-only integration shows its checkbox disabled with the shard explanation; the +N popover opens with Enter, closes with Escape and doesn't toggle the row. Jest: 33 pack suites, 662 tests passed; eslint and type_check clean.

Bot review follow-up (3f9e3d844023), from the Libra and CodeQL comments:

  • The pack form's "Save and deploy changes" confirmation counted only the selected agent policies, while the save also writes to the rest of the shared integration. A legacy partial pack whose only agents sat on the added agent policy deployed without asking. Both now use the same set.
  • effective_policy_ids no longer counts integrations or Osquery inputs that are disabled, since Fleet doesn't deliver them.
  • Packs list: a disabled pack that Fleet still delivers (failed detach) shows its live targets.
  • Response schemas bound the new arrays like policy_ids (CodeQL).
  • Scout: the list test now tells saved ([A]) from effective ([A, B]), and cleanup attempts every step.

Verified live: editing a pack saved on A (0 agents) with the agent on B shows "This action will update 2 agent policies affecting 1 agent"; a disabled pack left in Fleet shows 2 with the tooltip while a normally disabled one shows its saved 1; with the shared integration's input turned off, its packs report no effective agent policies and the dedicated pack is unchanged. Jest: 233 suites, 3509 tests passed; Scout spec 8/8; eslint and type_check clean.

Screenshots

The screenshots below show the picker before the review follow-up; the shared integration is now a single Fleet-style row with a +N popover.

E 5-group-selected E 5-grouped-selector E 6-partial E 6-runs-on E D6-warning-toast

Not verified

  • Scout API spec packs_shared_integration.spec.ts: now run against a local stateful stack, 8 of 8 passed (port 5620 was taken, so it ran against the local dev server).
  • Serverless: not tested; the spec is tagged @local-stateful-classic.
  • Real agents: not used, so delivery is verified at the package-policy level only.
Run details

Not verified

  • the follow-up diff was reviewed by codex (no blockers; its drift-marker finding was fixed)

Left as follow-ups

  • Find drains every osquery package policy per list request; a short in-memory memo would help.
  • The per-agent-policy agent-status fan-out is now the scaling limit for very large tenants.

How this PR was produced
Autopilot run 20261117-osquery-integration-centric-pack-targeting-for-3. Plan and challenge on Claude, build on codex/gpt-6.1-sol, review on cursor/gpt-5.3-codex, fix on claude-opus-5-5. Tokens: uncached 745072, cache read 15573170, 8 agents.

🤖 Generated with Claude Code

tomsonpl and others added 14 commits November 17, 2026 21:01
Implemented task 1.1 only. All five tests failed before implementation and pass in the final full-file run. Touched-file eslint passed; full verification deferred as requested. Preserved >=0.6.0 filtering and added ignoreMissing for scoped lookups. Assumption: singular ownership fields identify the first supported integration; an additional metadata array preserves overlapping ownership per reviewer guidance. Corrected an outdated test query constant. Changes remain uncommitted.

Autopilot-Task: 1.1
Co-Authored-By: Codex <noreply@openai.com>
Implemented task 1.2 only. All 11 new tests failed before implementation, then passed; full utils.test.ts passed all 215 tests. Touched-file eslint and diff checks passed. Assumptions: warnings follow actual write targets per reviewer guidance; effective-target lookup requires an explicit fourth dependency argument. Full verification, type_check and E2E deferred as instructed. Changes remain uncommitted.

Autopilot-Task: 1.2
Co-Authored-By: Codex <noreply@openai.com>
Implemented task 2.1 only. New tests first failed on missing warnings; both files now pass in full (88 tests). Touched-file eslint and diff checks pass. Write paths remain unchanged. Regenerated schemas and both OpenAPI bundles. Assumption: persisted targets come from saved-object references. Full verification and type_check deferred as instructed.

Autopilot-Task: 2.1
Co-Authored-By: Codex <noreply@openai.com>
Implemented only task 2.2. Tests first confirmed missing fields and warnings; final full runs passed both touched files (32 tests). Scoped ESLint and diff checks passed. Regenerated API types and ESS/serverless bundles. Assumption: owner-lookup failures follow the drain-failure rule—warn and omit effective_policy_ids. Full verification and type_check deferred as instructed. Changes remain uncommitted.

Autopilot-Task: 2.2
Co-Authored-By: Codex <noreply@openai.com>
Recorded findings in x-pack/platform/plugins/shared/osquery/decisions.md. Scoped Fleet reads, unchanged authz, additive ESS/Serverless OAS, and ESLint on all 14 server files passed. Type check failed twice: first on stale project metadata, then with six Osquery type errors after bootstrap refreshed metadata. Stopped as required; errors remain documented and unfixed. Bootstrap downloads hit DNS failures. No Jest tests changed for this audit. Assumed task-specific type-check requirement overrides deferred full verification.

Autopilot-Task: 2.3
Co-Authored-By: Codex <noreply@openai.com>
Seeds a shared and a dedicated Osquery Manager integration through Fleet and
asserts the overdelivery warning, effective_policy_ids and the agent policies
route ownership. Also fixes type_check errors left by earlier tasks (undefined
agent policy service in read/find routes, test mock casts).

Autopilot-Task: 2.4
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Implemented task 3.1 only. All six tests failed before implementation and passed in the final full-file run. Touched-file eslint and diff checks passed. Assumptions: ownership arrays are authoritative, singular fields provide fallback; merged groups use the smallest integration ID, names joined in ID order, and sorted member IDs; missing names fall back to integration IDs. Full verification deferred as requested. Changes remain uncommitted.

Autopilot-Task: 3.1
Co-Authored-By: Codex <noreply@openai.com>
Implemented task 3.2 only. Seven new cases failed before implementation; all 54 tests pass in the final full-file run. Touched-file eslint and diff checks pass; two existing callout warnings remain. Assumptions: checked groups count every member; an unselected group containing a shard target stays disabled. Task 3.3 markers and submission expansion remain deferred. Changes left uncommitted.

Autopilot-Task: 3.2
Co-Authored-By: Codex <noreply@openai.com>
Implemented task 3.3 only. Partial groups show missing-member markers and a callout naming them; submit expands selected groups. Assumption: selection counts include every checked group member; regression tested with Un-select all and read-only display. New behavior failed before implementation; unshared control passed. Both touched test files pass in full (119 tests). Touched-file eslint passes with existing callout warnings; diff check passes. Full verification deferred as requested. Changes remain uncommitted.

Autopilot-Task: 3.3
Co-Authored-By: Codex <noreply@openai.com>
Implemented task 3.4 only. New tests failed before implementation; both touched test files now pass in full (81 tests). Scoped eslint passed with two existing warnings; diff check passed. Assumption: drift markers compare the loaded effective and saved targets without adopting drift owners. Full verification and type_check deferred as instructed. Changes remain uncommitted.

Autopilot-Task: 3.4
Co-Authored-By: Codex <noreply@openai.com>
Stopped after two implementation check attempts as required. Tests failed before implementation. Final run: converter tests pass; form tests have 26 failures from undefined shards and transient undefined shardsArray during reset. Type-check fails at pack_shards_field.tsx:156 because option.key may be undefined. Eslint passed across public files touched in 3.x–4.x, with existing warnings. Changes remain uncommitted and incomplete. Assumptions: reuse connected-component groups and their canonical integration IDs; preserve agent-policy keys in root/wire shards; show the integration note for all grouped shard rows. Existing picker already treats any shard-assigned member as assigning the group.

Autopilot-Task: 4.1
Co-Authored-By: Codex <noreply@openai.com>
Pack create/update (and the activate toggle) now show a warning toast
for each `warnings` entry in the response, naming the shared
integration and the additional agent policies that also receive the pack.

Autopilot-Task: R1.1
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
convertShardsToArray no longer throws on undefined shards (create mode),
the shard row hint tolerates an unset shardsArray on first render, and
combo options without a key are kept (fixes the type_check error).

Autopilot-Task: R1.2
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The pack saved object stores agent policy attachments as references, so
`attributes.policy_ids` was always undefined in the POST response. Derive
it from the agent-policy references, matching read and update.

Autopilot-Task: R1.3
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown
Contributor
🤖 Jobs for this PR can be triggered through checkboxes. 🚧

ℹ️ To trigger the CI, please tick the checkbox below 👇

  • Click to trigger kibana-pull-request for this PR!
  • Click to trigger kibana-deploy-project-from-pr for this PR!
  • Click to trigger kibana-deploy-cloud-from-pr for this PR!
  • Click to trigger kibana-entity-store-performance-from-pr for this PR!
  • Click to trigger kibana-storybooks-from-pr for this PR!
  • Click to trigger kibana-static-checks for this PR!

@tomsonpl

Copy link
Copy Markdown
Contributor Author

/ci

kibanamachine and others added 3 commits November 18, 2026 11:19
- Keep the pack form pristine when shared-integration shards are
  normalized on load (the server already writes the max shard).
- Build create-route overdelivery warnings from the filtered agent
  policy ids instead of every reference id.
- Match legacy bare wire pack keys only in the default space when
  computing effective policy ids.
- Extract the duplicated read/find effective-policy lookup into
  getEffectivePolicyIdsForPacks.
- Emit singular package_policy_id/name on agent policies only when a
  policy has exactly one osquery integration.
- Fall back to the policy key for an empty shard selector label.
- Remove the committed autopilot run log (decisions.md).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tomsonpl

Copy link
Copy Markdown
Contributor Author

/ci

@tomsonpl

Copy link
Copy Markdown
Contributor Author

/ci

@tomsonpl tomsonpl self-assigned this Nov 18, 2026
@tomsonpl tomsonpl added v9.7.0 v9.6.1 release_note:enhancement Team:Defend Workflows “EDR Workflows” sub-team of Security Solution Osquery backport:version Backport to applied version labels labels Nov 18, 2026
The shared-integration spec sent the public elastic-api-version (2023-10-31)
to the internal fleet_wrapper/agent_policies route, which is only versioned
as '1', so it returned 400.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tomsonpl

Copy link
Copy Markdown
Contributor Author

/ci

tomsonpl and others added 2 commits November 19, 2026 15:07
…ntegration tests

Disabled packs are not compiled into any integration, so the server returns
an empty effective_policy_ids for them and the packs list showed 0 scheduled
policies. Fall back to the saved policy_ids for disabled packs.

Scout coverage added for enabling a disabled partial pack (warning on enable),
effective_policy_ids on the find route, and an agent policy attached to the
shared integration later showing up as effective only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Shards: a shared integration's group row starts from the server's
  effective value. A targeted member without a shard counts as 100%, so
  saving an untouched pack no longer lowers the live shard (was 100 -> 10).
- Policies keyed in shards are explicit targets, so they are no longer
  marked "Included via shared integration" or named in the callout.
- Activation modal counts every agent policy and agent of the shared
  integration (a disabled pack reported "0 agent policies").
- Policy picker renders a shared integration like Fleet's shared
  integration summary: one row with the first agent policy, a "+N" badge
  that opens a popover listing every member (link, agents, marker), and a
  "Shared" label with a tooltip naming the integration. Agents column shows
  the group total.
- Callout says saving adds the listed policies to the pack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tomsonpl

Copy link
Copy Markdown
Contributor Author

/ci

@tomsonpl
tomsonpl marked this pull request as ready for review November 20, 2026 13:26
@tomsonpl
tomsonpl requested review from a team as code owners November 20, 2026 13:26
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown
Contributor

Pinging @elastic/security-defend-workflows (Team:Defend Workflows)

const root = findRoot(policyId);
const ownerRoot = findRoot(existing.ownerId);
if (root !== ownerRoot) {
parents.set(root, ownerRoot);

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.

Severity: P3 (Low)

Overlapping integrations are not a single delivery target. If one integration owns A/B and another owns B/C, a legacy pack saved for A can be delivered only to the first integration. Merging the two into one row makes an untouched save add C and deploy the pack to the second integration. Keep the groups tied to Fleet’s actual write targets rather than their transitive overlap.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not changing this one. Osquery Manager is multiple: false, and Fleet rejects a second Osquery integration on an agent policy when the integration is created. Overlap needs an agent policy that's already misconfigured with two Osquery inputs, so we're not special-casing it.

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.

That may rule out creating the overlap through the normal UI, but it doesn’t show that an already-existing overlap cannot be returned or handled. The Fleet wrapper explicitly retains multiple osquery integrations for one policy, and its test covers pp1 on A/B plus pp2 on A/C (route, test). The selector then merges connected overlapping integrations into one group (implementation), and pack saves expand selected policies to every policy in that group (expansion). So the finding concerns exactly the pre-existing/misconfigured state your reply describes; the multiple: false constraint alone doesn’t make its delivery consequence irrelevant.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

Comment on lines +493 to +496
? resolveSharedIntegrationOverdelivery(
data.policy_ids ?? [],
packagePolicies,
effectiveShards

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.

Severity: P3 (Low)

Edit-only PUTs can update a shared integration that has no saved target references, but the warning is computed only from those references. As a result, a drifted integration can receive the updated queries without any warning. Compute warnings from the integrations the update actually writes, then compare their owners with the saved targets.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not changing this one. Warnings come from the integrations of the saved agent policies, so an agent policy attached later still triggers one. The case described needs an integration that holds the pack while none of its agent policies are saved on the pack, which normal flows don't produce.

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.

The later-attachment case is different from the wire-only drift case in the finding. This route scans for package policies that already carry the pack on the wire, and the edit-only branch explicitly unions those policies into its write targets to repair blocks whose saved-object references drifted (scan, edit-only targets). But the response warning is computed from data.policy_ids—the saved references—not from those write targets (warning call); the resolver then groups package policies from those IDs (resolver). So if a wire-attached package policy has no saved target reference, this PUT can rewrite it without including it in the warning calculation. A later attachment may trigger a warning on a subsequent request, but that does not warn about the update already delivered. The route’s explicit drift-repair path is evidence that this divergence is handled, even if its frequency in normal flows is unclear.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

Comment on lines +33 to +34
apiTest.beforeAll(async ({ samlAuth, kbnClient }) => {
adminCredentials = await samlAuth.asInteractiveUser('admin');

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.

Severity: P3 (Low)

All requests under test use an admin session, so this suite can pass even if users with Osquery permissions but no Fleet privileges cannot use shared targeting. Keep Fleet setup privileged, but use a pack-writer API key for the public pack calls and an Osquery-read session for the internal policy picker.

Generated by Libra. Specialist: scout. React with 👍 or 👎 to give feedback on this comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point. Tracking least-privilege sessions for this suite as a follow-up rather than in this PR.

Comment on lines +109 to +111
expect(response).toHaveStatusCode(200);
partialPackId = response.body.data.saved_object_id;
createdPackIds.push(partialPackId);

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.

Severity: P3 (Low)

Teardown only knows the ID returned by a successful create, but the pack is saved before Fleet is updated. If the Fleet write fails, the status assertion fails and the saved pack is never cleaned up. Record the unique pack name before sending the request and use it to recover the ID during teardown when necessary.

Generated by Libra. Specialist: scout. React with 👍 or 👎 to give feedback on this comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not changing this one. A leaked pack only happens when the test is already failing for another reason, and the run uses unique, suffixed names.

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.

The unique suffix avoids collisions, but it does not clean up a pack left behind by a partial failure. In this test, the pack ID is added to createdPackIds only after the request returns and the 200-status assertion passes (test); teardown deletes only IDs in that array (cleanup). So if the partial-save/Fleet-write failure described in the finding occurs, the test is already failing and teardown still has no pack ID to delete. I can’t verify from this test file alone how often that partial-save failure occurs, but the suffix does not address the cleanup gap.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

Comment on lines +122 to +123
apiTest('reads effective agent policies from live package policies', async ({ apiClient }) => {
const response = await apiClient.get(`${testData.API_PATHS.OSQUERY_PACKS}/${partialPackId}`, {

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.

Severity: P3 (Low)

The read, retarget, list, and drift tests depend on partialPackId from the first test and, in some cases, on the retarget test having run too. Running one of those tests by title leaves the pack ID unset, and a failure in an earlier test can cascade into unrelated failures. Seed each case in setup or put the dependent requests in one test with apiTest.step().

Generated by Libra. Specialist: scout. React with 👍 or 👎 to give feedback on this comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Keeping the order on purpose. The tests walk one pack through create, read, retarget and drift, and the spec notes which test must run last.

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.

The ordered flow is clear, and the “Runs last” comment explains why the final test must follow the others. The remaining concern is that ordering alone doesn’t initialize partialPackId when a later test is selected by title: it is declared in the suite and assigned only by the first test (lines 25–27, 122–128, lines 122–128); the read and retarget tests consume it (lines 140–164). So the intentional sequence handles the full-suite scenario, but not isolated execution or failures in the setup test. The stateful flow could be kept while grouping those dependent operations into one test with steps, or by creating the required pack in setup.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

updated_at: schema.maybe(schema.string()),
updated_by: schema.maybe(schema.nullable(schema.string())),
updated_by_profile_uid: schema.maybe(schema.nullable(schema.string())),
effective_policy_ids: schema.maybe(schema.arrayOf(schema.string())),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 3f9e3d8: bounded with { maxSize: 10000 }, matching policy_ids.

Comment on lines +98 to +105
schema.arrayOf(
schema.object({
code: schema.literal('shared_integration_overdelivery'),
package_policy_id: schema.string(),
package_policy_name: schema.string(),
additional_policy_ids: schema.arrayOf(schema.string()),
})
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 3f9e3d8: bounded with { maxSize: 10000 }, matching policy_ids.

code: schema.literal('shared_integration_overdelivery'),
package_policy_id: schema.string(),
package_policy_name: schema.string(),
additional_policy_ids: schema.arrayOf(schema.string()),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 3f9e3d8: bounded with { maxSize: 10000 }, matching policy_ids.

updated_at: schema.maybe(schema.string()),
updated_by: schema.maybe(schema.nullable(schema.string())),
updated_by_profile_uid: schema.maybe(schema.nullable(schema.string())),
effective_policy_ids: schema.maybe(schema.arrayOf(schema.string())),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 3f9e3d8: bounded with { maxSize: 10000 }, matching policy_ids.

@infra-vault-gh-plugin-prod

Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
osquery 679.6KB 689.9KB +10.3KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
kbnUiSharedDeps-srcJs 5.5MB 5.5MB +1.0B
vendors-heavy 2.0MB 2.0MB +2.0B
total +3.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
osquery 66 68 +2

Total ESLint disabled count

id before after diff
osquery 66 68 +2

total optimizer output size

id before after diff
all 68.9MB 68.9MB +10.3KB

warm start memory

id before after diff
post forced gc heap baseline - 657102016 +657102016
post forced gc heap delta - -3020274 -3020274
post forced gc heap delta standard deviation - 5813845 +5813845
post forced gc heap target - 654081742 +654081742
tail heap delta - -38771073 -38771073
total +1275206256

History

cc @tomsonpl

@tomsonpl

Copy link
Copy Markdown
Contributor Author

@brianmoon-elastic hey, would you find a few minutes to take a look at the policy picker changes? It's needed there to be clear with the user about what policies are used with the shared integration. Thanks in advance!

- Pack form: the "Save and deploy changes" confirmation now counts the
  same agent policies the save writes to (selected, sharded and every
  member of a selected shared integration). A legacy partial pack whose
  only agents sit on the added member no longer deploys without asking.
- effective_policy_ids skips integrations and Osquery inputs that are
  disabled, because Fleet does not deliver them.
- Packs list: a disabled pack that Fleet still delivers (failed detach)
  shows its live targets instead of the saved ones.
- Response schemas: bound effective_policy_ids, warnings and
  additional_policy_ids like policy_ids (CodeQL).
- Scout: the list test checks a pack saved only on A (saved [A],
  effective [A, B]) and a dedicated pack; cleanup attempts every step
  and reports failures together.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
updated_by: schema.maybe(schema.nullable(schema.string())),
updated_by_profile_uid: schema.maybe(schema.nullable(schema.string())),
effective_policy_ids: schema.maybe(
schema.arrayOf(schema.string({ maxLength: 1024 }), { maxSize: 10000 })

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.

Severity: P3 (Low)

The new 10,000-item response limit can make pack reads and lists fail response validation even when Fleet reads succeed. Effective targets are a live union across integrations, so a pack with a valid saved selection can exceed the limit as owners are added. Omit oversized enrichment before validation rather than letting it invalidate the pack response.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels Osquery release_note:enhancement Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v9.6.1 v9.7.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Osquery] Pack Type=Policy targeting is ignored when Osquery Manager is shared across agent policies

4 participants