-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Connectors] Checking for undefined config and secrets during connect…
…or validation (#122696) * Checking for undefined config and secrets during connector validation * Adding functional tests Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
d1eb0df
commit d19a2f3
Showing
5 changed files
with
132 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,5 +82,35 @@ export default function createGetTests({ getService }: FtrProviderContext) { | |
expect(connectorWithoutService.body.config).key('service'); | ||
expect(connectorWithoutService.body.config.service).to.eql('other'); | ||
}); | ||
|
||
it('decryption error during migration', async () => { | ||
const badEmailConnector = await supertest.get( | ||
`${getUrlPrefix(``)}/api/actions/connector/0f8f2810-0a59-11ec-9a7c-fd0c2b83ff7d` | ||
); | ||
|
||
expect(badEmailConnector.status).to.eql(200); | ||
expect(badEmailConnector.body.secrets).to.eql(undefined); | ||
|
||
const response = await supertest | ||
.post( | ||
`${getUrlPrefix(``)}/api/actions/connector/0f8f2810-0a59-11ec-9a7c-fd0c2b83ff7d/_execute` | ||
) | ||
.set('kbn-xsrf', 'foo') | ||
.send({ | ||
params: { | ||
message: 'am i working?', | ||
to: ['[email protected]'], | ||
subject: 'test', | ||
}, | ||
}); | ||
|
||
expect(response.status).to.eql(200); | ||
expect(response.body).to.eql({ | ||
connector_id: '0f8f2810-0a59-11ec-9a7c-fd0c2b83ff7d', | ||
status: 'error', | ||
message: `error validating action type connector: secrets must be defined`, | ||
retry: false, | ||
}); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -174,3 +174,35 @@ | |
} | ||
} | ||
} | ||
|
||
{ | ||
"type": "doc", | ||
"value": { | ||
"id": "action:0f8f2810-0a59-11ec-9a7c-fd0c2b83ff7d", | ||
"index": ".kibana_1", | ||
"source": { | ||
"action": { | ||
"actionTypeId" : ".email", | ||
"name" : "test email connector cant decrypt", | ||
"isMissingSecrets" : false, | ||
"config" : { | ||
"hasAuth" : true, | ||
"from" : "[email protected]", | ||
"host" : "some.non.existent.com", | ||
"port" : 465, | ||
"service" : "other", | ||
"secure" : true | ||
}, | ||
"secrets" : "V2EJEtTv3yTFi1kdglhNahasdfnKYWCS+J7aWCJQU+eEqGPZEz6n7G1NsBWoh7IY0FteLTilTteQXyY/Eg3k/7bb0G8Mz+WBZ1mRvUggGTFqgoOptyUsvHoBhv0R/1bCTCabN3Pe88AfnC+VDXqwuMifpmgKEEsKF3H8VONv7TYO02FW" | ||
}, | ||
"migrationVersion": { | ||
"action": "7.14.0" | ||
}, | ||
"coreMigrationVersion" : "7.15.0", | ||
"references": [ | ||
], | ||
"type": "action", | ||
"updated_at": "2021-08-31T12:43:37.117Z" | ||
} | ||
} | ||
} |