Repository navigation
Conversation
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>
|
🤖 Jobs for this PR can be triggered through checkboxes. 🚧
ℹ️ To trigger the CI, please tick the checkbox below 👇
|
|
/ci |
- 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>
|
/ci |
|
/ci |
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>
|
/ci |
…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>
|
/ci |
|
Pinging @elastic/security-defend-workflows (Team:Defend Workflows) |
| const root = findRoot(policyId); | ||
| const ownerRoot = findRoot(existing.ownerId); | ||
| if (root !== ownerRoot) { | ||
| parents.set(root, ownerRoot); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| ? resolveSharedIntegrationOverdelivery( | ||
| data.policy_ids ?? [], | ||
| packagePolicies, | ||
| effectiveShards |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| apiTest.beforeAll(async ({ samlAuth, kbnClient }) => { | ||
| adminCredentials = await samlAuth.asInteractiveUser('admin'); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Good point. Tracking least-privilege sessions for this suite as a follow-up rather than in this PR.
| expect(response).toHaveStatusCode(200); | ||
| partialPackId = response.body.data.saved_object_id; | ||
| createdPackIds.push(partialPackId); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| apiTest('reads effective agent policies from live package policies', async ({ apiClient }) => { | ||
| const response = await apiClient.get(`${testData.API_PATHS.OSQUERY_PACKS}/${partialPackId}`, { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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())), |
There was a problem hiding this comment.
Fixed in 3f9e3d8: bounded with { maxSize: 10000 }, matching policy_ids.
| 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()), | ||
| }) | ||
| ) |
There was a problem hiding this comment.
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()), |
There was a problem hiding this comment.
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())), |
There was a problem hiding this comment.
Fixed in 3f9e3d8: bounded with { maxSize: 10000 }, matching policy_ids.
💚 Build Succeeded
Metrics [docs]Async chunks
Page load bundle
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
total optimizer output size
warm start memory
History
cc @tomsonpl |
|
@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 }) |
There was a problem hiding this comment.
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.
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_managerismultiple: 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
+Nbadge 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.GET /internal/osquery/fleet_wrapper/agent_policiesreturns the owning package policy per agent policy, and no longer caps at 1000 package policies.POST/PUT /api/osquery/packskeeppolicy_idsas is and addwarnings: [{ code: 'shared_integration_overdelivery', ... }].GET /api/osquery/packsand/{id}addeffective_policy_ids, computed live so later Fleet changes show up. If the Fleet read fails the field is omitted, the request still succeeds.data.policy_idslike read and update do.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 passednode scripts/type_check --project x-pack/platform/plugins/shared/osquery/tsconfig.json: cleannode scripts/eslint x-pack/platform/plugins/shared/osquery: cleanOn a loaded machine a couple of 5 s test timeouts showed up in
public/packs/form/index.test.tsxandquery_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-aande2e-shared-b, plus one dedicated integration, fake agents):POSTpack with onlya→data.policy_ids = [a], warning names the shared integration andbPUTwith[a, b]→ no warningeffective_policy_idson read/find; a policy attached to the integration later shows up there but not inpolicy_idspackage_policy_id, dedicated has its ownReview follow-up (
f18717882beb), found while testing the UI on a local stack and fixed: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
+Npopover 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:effective_policy_idsno longer counts integrations or Osquery inputs that are disabled, since Fleet doesn't deliver them.policy_ids(CodeQL).[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
+Npopover.Not verified
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).@local-stateful-classic.Run details
Not verified
Left as follow-ups
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