fix(HTTP Request Node): Do not modify request object when sanitizing message for UI (#10923)

This commit is contained in:
Michael Kret
2024-09-23 11:10:31 +03:00
committed by GitHub
parent 60ee0d4ce7
commit 8cc10cc2c1
2 changed files with 26 additions and 10 deletions

View File

@@ -93,7 +93,7 @@ describe('HTTP Node Utils', () => {
);
});
it('should remove keys that contain sensitive data', async () => {
it('should remove keys that contain sensitive data and do not modify requestOptions', async () => {
const requestOptions: IRequestOptions = {
method: 'POST',
uri: 'https://example.com',
@@ -115,6 +115,14 @@ describe('HTTP Node Utils', () => {
method: 'POST',
uri: 'https://example.com',
});
expect(requestOptions).toEqual({
method: 'POST',
uri: 'https://example.com',
body: { sessionToken: 'secret', other: 'foo' },
headers: { authorization: 'secret', other: 'foo' },
auth: { user: 'user', password: 'secret' },
});
});
it('should remove secrets', async () => {
@@ -125,7 +133,9 @@ describe('HTTP Node Utils', () => {
headers: { authorization: 'secretAccessToken', other: 'foo' },
};
expect(sanitizeUiMessage(requestOptions, {}, ['secretAccessToken'])).toEqual({
const sanitizedRequest = sanitizeUiMessage(requestOptions, {}, ['secretAccessToken']);
expect(sanitizedRequest).toEqual({
body: {
nested: {
secret: REDACTED,