Commit graph

201 commits

Author SHA1 Message Date
Maxim Palenov
101fcfe436
[Security Solution] Omit Solution from tags and titles in Security Solution's OpenAPI bundles (#193669)
**Relates to:** https://github.com/elastic/kibana/issues/184428

## Summary

This PR omit `Solution` from from tag names and titles in Security Solution's OpenAPI bundles based on Security Docs team recommendation.
2024-09-24 14:23:00 -05:00
Mark Hopkin
0b4f8774dd
[Entity Analytics] [Entity Store] Add basic e2e tests and + tidy API route names (#193161)
## Summary

Adds basic end to end tests for the engine CRUD routes.

I also noticed there was some inconsistency in the naming of the API
routes which I have fixed.

---------

Co-authored-by: machadoum <pablo.nevesmachado@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Tiago Vila Verde <tiago.vilaverde@elastic.co>
2024-09-24 03:31:32 -05:00
Jan Monschke
caad89426c
[Threat Hunting Investigations] Use OpenAPI types in more timeline routes (#189977)
## Summary

Fixes: https://github.com/elastic/security-team/issues/10133

Migrates some timeline routes to use the newly generated OpenAPI types.
The changes mostly affect pinned event and note routes to keep the
changes small. Routes that actually accept and return timeline objects
will come in a next step.


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-09-24 08:49:44 +02:00
Ido Cohen
2a428b4e06
[Cloud Security] Populate Missing Vulnerability Scores in Vulnerabilities Flyout 2024-09-22 17:31:13 +03:00
Maxim Palenov
a378064006
[HTTP/OAS] Auto bundle staging OpenAPI specs (#193402)
**Relates to:** https://github.com/elastic/kibana/pull/189262

## Summary

This PR adds scripts to automatically bundle staging Kibana OpenAPI specs in CI. It's done in a similar way as in https://github.com/elastic/kibana/pull/189262.
2024-09-22 09:15:57 +02:00
Zacqary Adam Xeper
18afcae609
[ResponseOps][Rules] Add OAS schema for handled 4xx errors on rule apis (#192616)
## Summary

Closes #188514 

Adds OAS schemas for the `403 Forbidden` errors that public rule apis
can return if a license is invalid, `400 Bad Request` for unregistered
rule types, and `404 Not Found` for missing saved objects.

### Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials

### Testing

1. Start ES
2. Add `server.oas.enabled: true` to `kibana.dev.yml`
3. Start Kibana `yarn start --no-base-path`
4. `curl -s -uelastic:changeme
http://localhost:5601/api/oas\?pathStartsWith\=/api/alerting/rule/ | jq`
(If you have `jq` installed, otherwise pipe to `pbcopy` and paste the
result into a JSON prettifier)
5. Search the output for the word `Forbidden` to ensure this schema has
been added to `create`, `update`, `enable`, `disable`, `mute`, `unmute`,
and `update_rule_api_key`

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-09-19 11:52:17 -05:00
Alexi Doak
3c01b13f90
[ResponseOps] Connector OAS for framework fields (#192767)
Resolves https://github.com/elastic/kibana/issues/192778

## Summary

This PR updates the following `response` schemas as well as the legacy
route schemas for connector APIs to generate OAS documentation:
- `POST /api/actions/connector/{id?}`
- `GET /api/actions/connector/{id}`
- `POST /api/actions/connector/{id}/_execute`
- `PUT /api/actions/connector/{id}`

The `request` schemas were updated in this
[PR](https://github.com/elastic/kibana/pull/191678).


### To verify

1. Start ES
2. Add `server.oas.enabled: true` to `kibana.dev.yml`
3. Start Kibana `yarn start --no-base-path`
4. `curl -s -uelastic:changeme
http://localhost:5601/api/oas\?pathStartsWith\=/api/actions/ | jq`

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Lisa Cawley <lcawley@elastic.co>
2024-09-18 13:53:36 -05:00
Lisa Cawley
94aac7ad09
[DOCS][API] Add /api/fleet to Fleet API paths (#192652) 2024-09-12 07:03:40 -07:00
Lisa Cawley
b0683988e4
[DOCS][API] Add TheHive connector config and secrets (#192424) 2024-09-11 16:39:55 -07:00
Lisa Cawley
0ce33f842d
[DOCS][API] Adds Crowdstrike connector config and secrets; edits UI text (#192526) 2024-09-11 15:02:26 -07:00
Lisa Cawley
9833f0f598
[OAS][DOCS] Add example for import saved objects API (#192291) 2024-09-09 12:17:31 -07:00
Luke Elmers
b6287708f6
Adds AGPL 3.0 license (#192025)
Updates files outside of x-pack to be triple-licensed under Elastic
License 2.0, AGPL 3.0, or SSPL 1.0.
2024-09-06 19:02:41 -06:00
Lisa Cawley
86f9af8243
[OAS][DOCS] Add overlays for connector config and examples (#191791) 2024-09-05 11:19:52 -05:00
Lisa Cawley
52172e20f6
[OAS][DOCS] Clarify license, version, and source URL (#192145) 2024-09-05 07:06:44 -07:00
Christiane (Tina) Heiligers
37d6545699
[docs] Document internal API restriction in 9.0 (#191943)
fix: https://github.com/elastic/kibana/issues/191941

Adds note that access to internal APIs will be restricted as of 9.0:


![document-restricted-internal-API-access](https://github.com/user-attachments/assets/56b5c43d-ff6f-4b5b-8c18-2cbe1a1de7c3)

- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: lcawl <lcawley@elastic.co>
2024-09-03 17:59:50 -05:00
Lisa Cawley
19dd65c244
[ResponseOps][DOCS] SSL for Cases Webhook connector (#191690) 2024-09-03 11:52:48 -05:00
Lisa Cawley
4a3fa7ea22
[OAS] Include connector APIs (#191679) 2024-08-29 17:44:29 -05:00
Christiane (Tina) Heiligers
dd221a7be1
[Docs] Add details to SO APIs landing page (#191693)
Fix https://github.com/elastic/kibana/issues/191534
The deprecation warning in the Kibana Saved Objects API main page was
removed in https://github.com/elastic/kibana/pull/190654.

This PR adds a section about when the APIs will be removed and what to
use instead.

The PR also includes updates to other API main pages that mention the SO
APIs.

- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials

VIew the [html
diff](https://kibana_bk_191693.docs-preview.app.elstc.co/diff) for these
changes:

![Short URLs API landing
page](https://github.com/user-attachments/assets/3716f33e-0d00-4ff7-b29d-7a5ba0a0f1f2)

![Data views API landing
page](https://github.com/user-attachments/assets/81c8a843-27ca-4510-a181-7ec9b20f86d6)

The updated OpenAPI document looks like this in a Bump.sh preview:


![image](https://github.com/user-attachments/assets/a8b58142-5082-4b75-8b3f-339b8a6b57e4)

---------

Co-authored-by: lcawl <lcawley@elastic.co>
2024-08-29 15:04:00 -05:00
natasha-moore-elastic
9babac00ee
[OAS][DOCS] Adds linting rule for missing property descriptions (#191594)
## Summary

Resolves https://github.com/elastic/docs-projects/issues/237 by adding a
custom linting rule for missing property descriptions.

---------

Co-authored-by: lcawl <lcawley@elastic.co>
2024-08-29 09:44:29 +01:00
Lisa Cawley
bc084f91c2
[DOCS][OAS] Update API documentation license (#191563) 2024-08-28 12:10:00 -05:00
Lisa Cawley
0770e947e2
[OAS][DOCS] Add feedback links for Kibana APIs (#191145) 2024-08-23 13:46:12 -07:00
Ying Mao
a6c4120b35
[Response Ops][Alerting] Adding new value to warning reasons enum schema in rule saved object (#190743)
## Summary

We want to allow rule executors to report warnings back to the framework
and have them show up in the stack management UI. We currently have a
mechanism for this that is used by detection rules but they handle how
to show the warning in their custom UI so the warning does not appear in
the stack management UI. This PR adds a new value to the allow list of
"warning reasons". This should not warrant a schema version bump because
it is a new value for an existing enum but we need to do an intermediate
release so the new schema is recognized before we start setting it
anywhere. This PR is just for schema changes. PR that uses these schema
changes can be found here: https://github.com/elastic/kibana/pull/189312

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-08-21 10:17:29 -04:00
Lisa Cawley
e429b73e5a
[OAS][DOCS] Use automated alerting rule API documentation (#190205)
Co-authored-by: Jean-Louis Leysens <jeanlouis.leysens@elastic.co>
2024-08-15 17:07:56 -05:00
Lisa Cawley
444b8d010e
[DOCS][OAS] Add Fleet APIs (#190571) 2024-08-15 12:49:58 -05:00
Lisa Cawley
4ceb3e4f31
[DOCS][OAS] Re-add case APIs (#190573) 2024-08-15 09:15:49 -07:00
Lisa Cawley
1144c0cea7
[OAS][DOCS] Temporarily omit security APIs from docs (#190467) 2024-08-14 11:52:18 -05:00
Lisa Cawley
286e0e0a9f
[OAS][DOCS] Edit linting rule severity (#190470) 2024-08-14 10:15:29 -05:00
Jonathan Budzenski
a9c4d2fa34 Revert "[OAS] Include alerting rule APIs (#189962)"
This reverts commit b85b1cb506.
2024-08-13 12:25:03 -05:00
Jean-Louis Leysens
b85b1cb506
[OAS] Include alerting rule APIs (#189962)
## Summary

Includes alerting rule APIs in our OAS snapshots.

## How to test

Using bump CLI you can preview the output:

```sh
bump preview ./oas_docs/bundle.json
# or
bump preview ./oas_docs/bundle.serverless.json
```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-08-13 17:21:10 +02:00
Maxim Palenov
7a2e7bef96
[HTTP/OAS] Merge OpenAPI specs by using kbn-openapi-bundler (#189262)
**Addresses:** https://github.com/elastic/kibana/issues/186356
**Relates to:** https://github.com/elastic/kibana/issues/184428

## Summary

This PR adds a merging JS script based on the utility implemented in https://github.com/elastic/kibana/issues/186356. Resulted OpenAPI bundle as committed in `oas_docs/output/kibana.serverless.bundled.yaml`.

## Details

https://github.com/elastic/kibana/pull/188110 implements and exposes `merge` utility design to merge source OpenAPI specs without processing. It's has only a programmatic API. To merge OpenAPI specs it's required to add a JS script like below

```js
const { merge } = require('@kbn/openapi-bundler');

(async () => {
  await merge({
   sourceGlobs: [/* a list of source globs goes here */],
   outputFilePath: 'path/to/the/output/file.yaml',
  });
})();
```

The JS script added in this PR includes source OpenAPI specs presented in `oas_docs/makefile` plus Security Solution OpenAPI specs based on https://github.com/elastic/kibana/issues/184428.

**To run** the script use the following command from Kibana root folder

```bash
node ./oas_docs/scripts/merge_serverless_oas.js 
```

## Known linting issues with Security Solution OpenAPI specs

Running Spectral OpenAPI linter on the result bundle shows a number of errors caused by `no-$ref-siblings` rule. This caused by the current code generator implementation which requires `default` property to be set next to `$ref` though it's not correct for OpenAPI `3.0.3` while it's allowed in `3.1`. It seems that Bump.sh handles such cases properly though by properly showing a default value.

We need to analyze the problem and decide if/when we should fix it.

The rest of warnings look fixable and will be addressed in the next stage after setting up linter rules.

## Next steps

Since `@kbn/openapi-bundler` package is tailored specifically for Kibana it should replace Redocly currently used to merge OpenAPI specs. It also means `oas_docs/makefile` should be superseded by JS script(s) using `merge` utility form `@kbn/openapi-bundler` package.

`@kbn/openapi-bundler` SHOULD NOT replace OpenAPI linters since it doesn't perform thorough linting. It's good if we continue adopting `spectral-cli` for linting purposes.
2024-08-13 12:45:35 +02:00
Lisa Cawley
d323898483
[OAS][DOCS] Add tag x-displayName in overlays (#189842) 2024-08-06 11:13:31 -07:00
Lisa Cawley
176a2210d7
[OAS][DOCS] Add temporary overlays for Kibana API documents (#189322) 2024-08-01 09:38:01 -07:00
Lisa Cawley
e4a0658225
[OAS][DOCS] Deprecate saved object APIs (#189223) 2024-07-30 21:38:04 -05:00
Lisa Cawley
8a26557491
[DOCS][OAS] Add alerting to Kibana API bundle (#188885) 2024-07-30 17:59:47 -05:00
Lisa Cawley
d86e139343
[DOCS][OAS] Add cases to Kibana API bundle (#189020) 2024-07-30 07:48:04 -07:00
Lisa Cawley
102a42ca4e
[OAS][DOCS] Remove some SLO APIs from OpenAPI documents (#189323) 2024-07-29 13:50:16 -05:00
Lisa Cawley
841e95c64b
[OAS][ML] Add sync API tags and description, minor OpenAPI fixes (#189230) 2024-07-26 15:28:43 -05:00
Lisa Cawley
e6795e5b0a
[DOCS][OAS] Add descriptions, tags, deprecation to connector APIs (#184956) 2024-07-25 16:46:30 -05:00
Lisa Cawley
42c5d918d3
[OAS][DOCS] Add x-topics info about running APIs in spaces (#189144) 2024-07-25 13:23:52 -05:00
Lisa Cawley
8dc286067b
[DOCS][OAS] Add data view swap saved object references and preview APIs (#187927) 2024-07-24 17:31:06 -05:00
Lisa Cawley
17181e6ba5
[OAS] Combine manual and automated OpenAPI documents (#188702) 2024-07-22 16:20:03 -05:00
Jean-Louis Leysens
a8091ab0ac
[OAS/HTTP] Empty response bodies (status only) and descriptions for responses (#188632)
## Summary

* Adds the ability to exclude a response schema when declaring route
schemas
* Adds the ability to provide a description of a the response

See code comments for more info.

## Example

You can declare a response with no validation to imply an empty object
in OAS

```
router.versioned.post({ version: '2023-10-31', access: 'public', path: '...' })
  .addVersion({
    validation: {
      responses: {
        201: { description: 'Resource created!' }
      }
    }
  }, () => {})
```

Will result in

```jsonc
{
 //...
  201: { description: 'Resource created!' }
 //...
}
```

## Risks

No notable risks
2024-07-22 15:29:15 +02:00
Lisa Cawley
15401de051
[OAS] Generate OpenAPI document for Kibana APIs (#188613) 2024-07-19 07:26:40 +10:00
Lisa Cawley
f4f936fe4a
[OAS] Refresh Kibana serverless APIs (#186853) 2024-07-19 02:20:48 +10:00
Jean-Louis Leysens
46a457e0cc
[OAS] Better support for enums (#188198)
Close https://github.com/elastic/kibana/issues/182658
2024-07-16 10:49:48 +01:00
Lisa Cawley
cd96a10529
[DOCS] Add SLO APIs to bundled OpenAPI document (#186575) 2024-06-20 19:49:05 -07:00
Lisa Cawley
bdef3aed2b
[HTTP/OAS] Add makefile to oas_docs (#185911) 2024-06-19 08:57:00 -07:00
Jean-Louis Leysens
cf7196fa1f
[OAS] Capture and commit serverless bundle (#184915)
## Summary

Close https://github.com/elastic/kibana/issues/184719

Adds the ability to capture OAS for `serverless` build flavor in
addition to `traditional`. By default the CLI will run for both, but
this can be controlled by passing in one of two new flags:
`--no-serverless` or `--no-traditional`.

See `oas_docs/bundle.serverless.json` for output.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-06-10 03:48:10 -07:00
Jean-Louis Leysens
dd1864b876
[OAS] Refactor description -> summary (#184651)
## Summary

Per [the OAS docs](https://swagger.io/specification/), they have an info
object with a `summary` and `description` field. This PR refactors the
existing router `description` field to to OAS `summary` (that is how it
has been used) and introduces a "new" `description` field that will be
used for the longer form descriptions.

## Resources
* https://swagger.io/specification/

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: lcawl <lcawley@elastic.co>
2024-06-06 06:49:41 -07:00
Jean-Louis Leysens
5fd4795b77
[OAS] Support tags (#184320) 2024-06-04 17:45:12 +02:00