-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Turn on internal API restriction for serverless tests #162636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6b8403b
6fc50c1
301afab
e58a38e
d30a346
f74cab2
c4310cc
783482d
ad006af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,7 @@ export default function ({ getService }: FtrProviderContext) { | |
| it('rejects request to create a new fleet server hosts', async () => { | ||
| const { body, status } = await supertest | ||
| .post('/api/fleet/fleet_server_hosts') | ||
| .set(svlCommonApi.getCommonRequestHeader()) | ||
| .set(svlCommonApi.getInternalRequestHeader()) | ||
| .send({ | ||
| name: 'test', | ||
| host_urls: ['https://localhost:8220'], | ||
|
|
@@ -34,7 +34,7 @@ export default function ({ getService }: FtrProviderContext) { | |
| it('rejects request to create a new proxy', async () => { | ||
| const { body, status } = await supertest | ||
| .post('/api/fleet/proxies') | ||
| .set(svlCommonApi.getCommonRequestHeader()) | ||
| .set(svlCommonApi.getInternalRequestHeader()) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. public |
||
| .send({ | ||
| name: 'test', | ||
| url: 'https://localhost:8220', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ export async function createIndexConnector({ | |
| const { body } = await supertest | ||
| .post(`/api/actions/connector`) | ||
| .set('kbn-xsrf', 'foo') | ||
| .set('x-elastic-internal-origin', 'foo') | ||
| .send({ | ||
| name, | ||
| config: { | ||
|
|
@@ -54,6 +55,7 @@ export async function createRule({ | |
| const { body } = await supertest | ||
| .post(`/api/alerting/rule`) | ||
| .set('kbn-xsrf', 'foo') | ||
| .set('x-elastic-internal-origin', 'foo') | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 . confirmed with @elastic/actionable-observability, their APIs are 'internal' |
||
| .send({ | ||
| params, | ||
| consumer, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,10 @@ export async function waitForRuleStatus({ | |
| }): Promise<Record<string, any>> { | ||
| return pRetry( | ||
| async () => { | ||
| const response = await supertest.get(`/api/alerting/rule/${id}`); | ||
| const response = await supertest | ||
| .get(`/api/alerting/rule/${id}`) | ||
| .set('kbn-xsrf', 'foo') | ||
| .set('x-elastic-internal-origin', 'foo'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| const { execution_status: executionStatus } = response.body || {}; | ||
| const { status } = executionStatus || {}; | ||
| if (status !== expectedStatus) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ export const createDataView = async ({ | |
| const { body } = await supertest | ||
| .post(`/api/content_management/rpc/create`) | ||
| .set('kbn-xsrf', 'foo') | ||
| .set('x-elastic-internal-origin', 'foo') | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| .send({ | ||
| contentTypeId: 'index-pattern', | ||
| data: { | ||
|
|
@@ -49,6 +50,7 @@ export const deleteDataView = async ({ | |
| const { body } = await supertest | ||
| .post(`/api/content_management/rpc/delete`) | ||
| .set('kbn-xsrf', 'foo') | ||
| .set('x-elastic-internal-origin', 'foo') | ||
| .send({ | ||
| contentTypeId: 'index-pattern', | ||
| id, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,8 +40,14 @@ export default function ({ getService }: FtrProviderContext) { | |
| }); | ||
|
|
||
| after(async () => { | ||
| await supertest.delete(`/api/alerting/rule/${ruleId}`).set('kbn-xsrf', 'foo'); | ||
| await supertest.delete(`/api/actions/connector/${actionId}`).set('kbn-xsrf', 'foo'); | ||
| await supertest | ||
| .delete(`/api/alerting/rule/${ruleId}`) | ||
| .set('kbn-xsrf', 'foo') | ||
| .set('x-elastic-internal-origin', 'foo'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| await supertest | ||
| .delete(`/api/actions/connector/${actionId}`) | ||
| .set('kbn-xsrf', 'foo') | ||
| .set('x-elastic-internal-origin', 'foo'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| await esClient.deleteByQuery({ | ||
| index: THRESHOLD_RULE_ALERT_INDEX, | ||
| query: { term: { 'kibana.alert.rule.uuid': ruleId } }, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ export default async () => { | |
| }, | ||
| sourceArgs: ['--no-base-path', '--env.name=development'], | ||
| serverArgs: [ | ||
| `--server.restrictInternalApis=true`, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The most important change of the PR |
||
| `--server.port=${kbnTestConfig.getPort()}`, | ||
| '--status.allowAnonymous=true', | ||
| // We shouldn't embed credentials into the URL since Kibana requests to Elasticsearch should | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the API's public, not internal. Fleet has an open issue to change to 'public' again: https://github.com/elastic/ingest-dev/issues/1921
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means until the linked issue is resolved, this API would be treated as internal ?