Fixes elastic#265694
TLS certificate fields in Fleet settings forms (Agent binary source,
Output, Fleet Server Hosts, Fleet Proxy) accept file paths with spaces
without validation. These paths are propagated into the generated agent
policy, causing Elastic Agent to fail to resolve the certificate file
and become unhealthy.
**Shared validator — `common/services/ssl_validators.ts`**
- `validateSslCertPath(value)`: rejects whitespace in file paths; exempt
when value is PEM content (leading `-----BEGIN`). Works for Linux,
Windows (`C:\`, `C:/`), and UNC (`\\server\share`) paths without
platform-specific handling.
**Client-side adapters — `ssl_form_validators.ts`**
- `validateSslPathInput` — adapter for `useInput` (returns `string[] |
undefined`)
- `validateSslPathsCombo` — adapter for `useComboInput` (returns
`Array<{message, index}> | undefined`)
**Four form hooks wired**
- `use_download_source_flyout_form.tsx` — 3 inputs
- `use_output_form.tsx` + `output_form_validators.tsx` — 2 combo inputs
+ extended existing `validateSSLCertificate`/`validateSSLKey`
- `use_fleet_server_host_form.tsx` — 9 inputs across 3 SSL groups
(server, ES, agent)
- `use_fleet_proxy_form.tsx` — 3 inputs
**Four server-side handlers hardened**
- `download_source/handler.ts`, `fleet_server_hosts/handler.ts`,
`fleet_proxies/handler.ts`, `output/handler.ts` — each gains a
`throwIfSslPathInvalid` helper calling the shared common function,
returning `400 Bad Request` for invalid paths.
1. Navigate to Fleet → Settings → Agent binary sources → Add / Edit
source
2. In the TLS Certificate section, enter a path with spaces (e.g.
`/path/to my cert.pem`) in any certificate field
3. Confirm the form shows an error and cannot be saved
4. Confirm a valid path (e.g. `/path/to/cert.pem`) or inline PEM content
passes validation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<img width="536" height="829" alt="image"
src="https://github.com/user-attachments/assets/5489927a-b71f-4625-9812-15bfea234f06"
/>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Mason Herron <46727170+Supplementing@users.noreply.github.com>
Backport
This is a backport of PR #266365 to
9.4.Original PR description
Validates SSL certificate path fields for whitespace characters to prevent
silent failures when saving Fleet settings flyouts.
Conflict resolution
oas_docs/output/kibana.serverless.yamlandkibana.yaml: accepted 9.4 version (generated files)x-pack/platform/plugins/shared/fleet/common/services/index.ts: added only thevalidateSslCertPathexport; excludedyaml_utilsexports that don't exist on 9.4x-pack/platform/plugins/shared/fleet/server/types/models/output.ts: took incomingcompression_levelschema fix (schema.maybe(schema.oneOf([...])))