-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(grpc): skip TLS when verification disabled + mTLS capability [IN…
…S-4536] (#8235) * fix cert passing * feat: mtls for ssl-enabled grpc requests * add user-friendly tls-related error messages to a modal --------- Co-authored-by: jackkav <[email protected]>
- Loading branch information
1 parent
10f1486
commit d6a6bcb
Showing
14 changed files
with
386 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,4 @@ packages/insomnia-smoke-test/traces | |
dist | ||
.history | ||
*.node | ||
rootCA2.* |
27 changes: 27 additions & 0 deletions
27
packages/insomnia-smoke-test/fixtures/certificates/client.crt
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIEmzCCAwOgAwIBAgIUYaCYPYGdDPU5uHxEyNgDBFGvkPAwDQYJKoZIhvcNAQEL | ||
BQAwgbUxHjAcBgNVBAoTFW1rY2VydCBkZXZlbG9wbWVudCBDQTFFMEMGA1UECww8 | ||
amFjay5rYXZhbmFnaEBKYWNrcy1NYWNCb29rLVByby0xNi1pbmNoLTIwMTkgKEph | ||
Y2sgS2F2YW5hZ2gpMUwwSgYDVQQDDENta2NlcnQgamFjay5rYXZhbmFnaEBKYWNr | ||
cy1NYWNCb29rLVByby0xNi1pbmNoLTIwMTkgKEphY2sgS2F2YW5hZ2gpMB4XDTI0 | ||
MTIwNTIwMTMyM1oXDTM0MTIwMzIwMTMyM1owgZQxCzAJBgNVBAYTAlVTMRMwEQYD | ||
VQQIDApTb21lLVdoZXJlMQ0wCwYDVQQHDARFbHN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x6am1Qhfw0ag0jkQ2KB54Lzhi6TJUhwFJr | ||
lTK3t4I0TGpL+OIp9MrDVYaGLMOVyFky7WMAZJ+QHbWaPBZC0wFdY7FZXGBWbY/I | ||
cMCTDebmifkHZSVD8c+KU3rtdUMsG2NtTLi7ZFJolw== | ||
-----END CERTIFICATE----- |
18 changes: 18 additions & 0 deletions
18
packages/insomnia-smoke-test/fixtures/certificates/client.csr
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
-----BEGIN CERTIFICATE REQUEST----- | ||
MIIC9DCCAdwCAQAwgZQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApTb21lLVdoZXJl | ||
MQ0wCwYDVQQHDARFbHNlMREwDwYDVQQKDAhJbnNvbW5pYTENMAsGA1UECwwEVGVh | ||
bTEWMBQGA1UEAwwNSW5zb21uaWEgVGVhbTEnMCUGCSqGSIb3DQEJARYYdGVhbS1p | ||
bnNvbW5pYUBrb25naHEuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC | ||
AQEAkdevG8sMbwflVGtkW8mUHYI5Vdl6g7dlV2XVYW5SWYRAlof7oEn62k5+9Dim | ||
ykZZwiYz2uNyuZRcNTwFvbnkNoAza3t1oEFnieFDWBXwTa7gEh2BF9PTtON3S7+Z | ||
XLleSXVs/vbY2dXSChe2kPWKukOA0SZO047wYV+NZc/ApyURQFLNa2RrrpdCutpm | ||
j5vvdhNTTHCCdIaDdVkUcw6+o7G3KGYggH/8ODuSiKpVsPVdlwqEcEHHYGHpHBRr | ||
2CLtZmmjvqL85Qv8iT+mJwaucVM3u6Lh5cPxtTgezUtrgqEW5waAb6QyFGlhInGH | ||
y1wkdA+KQusN5sy/5J1dMYs/YwIDAQABoBowGAYJKoZIhvcNAQkCMQsMCUtvbmcs | ||
IEluYzANBgkqhkiG9w0BAQsFAAOCAQEAiXALDfLmzi7qj4K837dZeP961G90a7Nk | ||
m7VeBb8RpphM7hQ/2ZhnRfGU5TOo/QskN0Bddhnc6EYrzpo5iH+upmdz/jCpUaOR | ||
k7i/RhC3NOemxCJJ64KR8bNfYJ1q4C9NEBTRfZns73nIE9wuu0Ue/j5KebnkfWz/ | ||
anY4bFJfJNZVdpWDRV0dRlgJBlsIHyDlSZ0v/K+3/gh+K3X5z/jOsF7uwFvyzd+j | ||
3DXhgtJESsdqHMeD17wtUX9UytqHX8H0f0JNiZr/BURDUoH9z4zJxeCBHPBQ7Wd2 | ||
lvY04vVHKMlI2C52yNUyYtZsXlRCwK5MO9oBt3j8XAga1VHypPdpHA== | ||
-----END CERTIFICATE REQUEST----- |
28 changes: 28 additions & 0 deletions
28
packages/insomnia-smoke-test/fixtures/certificates/client.key
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-----BEGIN PRIVATE KEY----- | ||
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCR168bywxvB+VU | ||
a2RbyZQdgjlV2XqDt2VXZdVhblJZhECWh/ugSfraTn70OKbKRlnCJjPa43K5lFw1 | ||
PAW9ueQ2gDNre3WgQWeJ4UNYFfBNruASHYEX09O043dLv5lcuV5JdWz+9tjZ1dIK | ||
F7aQ9Yq6Q4DRJk7TjvBhX41lz8CnJRFAUs1rZGuul0K62maPm+92E1NMcIJ0hoN1 | ||
WRRzDr6jsbcoZiCAf/w4O5KIqlWw9V2XCoRwQcdgYekcFGvYIu1maaO+ovzlC/yJ | ||
P6YnBq5xUze7ouHlw/G1OB7NS2uCoRbnBoBvpDIUaWEicYfLXCR0D4pC6w3mzL/k | ||
nV0xiz9jAgMBAAECggEACv6pH13GSrD1y4PEtZzAebcH21G0oeBxSrT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KBgQCTy+yC7PcCSO3+pSW2 | ||
uIFizSh8MK4fSAi/A9/qMQObuD64lLkgKAamBRrwj7kgrMY750F60xrHz6hMnFOY | ||
NcKDzR6KSAcZiqFp/s/RL4ZLIRNl+axiNfymIxzFEl3bolpEvkIkKOmbSaq3ZH2P | ||
6Vq+ac3PcUGaZx3Pcml2o8vX3w== | ||
-----END PRIVATE KEY----- |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
61A0983D819D0CF539B87C44C8D8030451AF90F0 |
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
_type: export | ||
__export_format: 4 | ||
__export_date: 2024-12-05T20:16:41.919Z | ||
__export_source: insomnia.desktop.app:v10.2.0 | ||
resources: | ||
- _id: greq_7ef089deea314ab88dd86aa434838efd | ||
parentId: wrk_5dac47ec0e6144c694f21b29740e9267 | ||
modified: 1733429659428 | ||
created: 1732118004917 | ||
url: grpcs://localhost:50052 | ||
name: grpcs | ||
description: "" | ||
protoFileId: "" | ||
protoMethodName: /routeguide.RouteGuide/GetFeature | ||
metadata: [] | ||
body: | ||
text: |- | ||
{ | ||
"lo": { | ||
"latitude": "400000000", | ||
"longitude": "-750000000" | ||
}, | ||
"hi": { | ||
"latitude": "420000000", | ||
"longitude": "-730000000" | ||
}, | ||
"latitude": "409146138", | ||
"longitude": "-746188906" | ||
} | ||
metaSortKey: -1732118004917 | ||
isPrivate: false | ||
reflectionApi: | ||
enabled: false | ||
url: https://buf.build | ||
apiKey: "" | ||
module: buf.build/connectrpc/eliza | ||
_type: grpc_request | ||
- _id: wrk_5dac47ec0e6144c694f21b29740e9267 | ||
parentId: null | ||
modified: 1732118001110 | ||
created: 1732118001110 | ||
name: grpc | ||
description: "" | ||
scope: collection | ||
_type: workspace | ||
- _id: env_d8277fde45580529bdde2cee008f33ba3e3a8873 | ||
parentId: wrk_5dac47ec0e6144c694f21b29740e9267 | ||
modified: 1732118001112 | ||
created: 1732118001112 | ||
name: Base Environment | ||
data: {} | ||
dataPropertyOrder: null | ||
color: null | ||
isPrivate: false | ||
metaSortKey: 1732118001112 | ||
environmentType: kv | ||
_type: environment | ||
- _id: jar_d8277fde45580529bdde2cee008f33ba3e3a8873 | ||
parentId: wrk_5dac47ec0e6144c694f21b29740e9267 | ||
modified: 1732118001113 | ||
created: 1732118001113 | ||
name: Default Jar | ||
cookies: [] | ||
_type: cookie_jar |
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
62 changes: 62 additions & 0 deletions
62
packages/insomnia-smoke-test/tests/smoke/grpc-mtls.test.ts
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import path from 'node:path'; | ||
|
||
import { expect } from '@playwright/test'; | ||
|
||
import { getFixturePath, loadFixture } from '../../playwright/paths'; | ||
import { test } from '../../playwright/test'; | ||
|
||
test('can send gRPC requests using mTLS requests (with reflection)', async ({ app, page }) => { | ||
test.slow(process.platform === 'darwin' || process.platform === 'win32', 'Slow app start on these platforms'); | ||
const statusTag = page.locator('[data-testid="response-status-tag"]:visible'); | ||
const responseBody = page.locator('[data-testid="response-pane"] >> [data-testid="CodeEditor"]:visible', { | ||
has: page.locator('.CodeMirror-activeline'), | ||
}); | ||
|
||
const text = await loadFixture('grpc-mtls.yaml'); | ||
await app.evaluate(async ({ clipboard }, text) => clipboard.writeText(text), text); | ||
|
||
await page.getByLabel('Import').click(); | ||
await page.locator('[data-test-id="import-from-clipboard"]').click(); | ||
await page.getByRole('button', { name: 'Scan' }).click(); | ||
await page.getByRole('dialog').getByRole('button', { name: 'Import' }).click(); | ||
await page.getByLabel('grpc').click(); | ||
|
||
await page.getByLabel('Request Collection').getByTestId('grpcs').press('Enter'); | ||
await expect(page.getByRole('button', { name: 'Select Method' })).toBeDisabled(); | ||
|
||
// add root CA and client certificate | ||
const fixturePath = getFixturePath('certificates'); | ||
|
||
await page.getByRole('button', { name: 'Add Certificates' }).click(); | ||
let fileChooserPromise = page.waitForEvent('filechooser'); | ||
await page.getByRole('button', { name: 'Add CA Certificate' }).click(); | ||
await (await fileChooserPromise).setFiles(path.join(fixturePath, 'rootCA.pem')); | ||
|
||
await page.getByRole('button', { name: 'Add client certificate' }).click(); | ||
await page.locator('[name="host"]').fill('localhost'); | ||
|
||
fileChooserPromise = page.waitForEvent('filechooser'); | ||
await page.locator('[data-test-id="add-client-certificate-file-chooser"]').click(); | ||
await (await fileChooserPromise).setFiles(path.join(fixturePath, 'client.crt')); | ||
|
||
fileChooserPromise = page.waitForEvent('filechooser'); | ||
await page.locator('[data-test-id="add-client-certificate-key-file-chooser"]').click(); | ||
await (await fileChooserPromise).setFiles(path.join(fixturePath, 'client.key')); | ||
|
||
await page.getByRole('button', { name: 'Add certificate' }).click(); | ||
await page.getByRole('button', { name: 'Done' }).click(); | ||
|
||
// initiates an mtls connection with the given certificates | ||
await page.getByTestId('button-server-reflection').click(); | ||
|
||
await page.getByRole('button', { name: 'Select Method' }).click(); | ||
await page.getByRole('option', { name: 'RouteGuide/GetFeature' }).click(); | ||
|
||
await page.getByRole('tab', { name: 'Unary' }).click(); | ||
await page.getByRole('button', { name: 'Send' }).click(); | ||
|
||
// Check for the single Unary response | ||
await page.getByRole('tab', { name: 'Response 1' }).click(); | ||
await expect(statusTag).toContainText('0 OK'); | ||
await expect(responseBody).toContainText('Berkshire Valley Management Area Trail'); | ||
}); |
Oops, something went wrong.