(
componentCredentialName: string,
decryptedCredentialObj: ICredentialDataDecrypted,
componentCredentials: IComponentCredentials
)
| 1782 | } |
| 1783 | |
| 1784 | export const redactCredentialWithPasswordType = ( |
| 1785 | componentCredentialName: string, |
| 1786 | decryptedCredentialObj: ICredentialDataDecrypted, |
| 1787 | componentCredentials: IComponentCredentials |
| 1788 | ): ICredentialDataDecrypted => { |
| 1789 | const plainDataObj = cloneDeep(decryptedCredentialObj) |
| 1790 | for (const cred in plainDataObj) { |
| 1791 | const inputs = componentCredentials[componentCredentialName].inputs |
| 1792 | const inputParam = inputs?.find((inp) => inp.name === cred && (inp.type === 'password' || inp.type === 'url')) |
| 1793 | if (!inputParam) continue |
| 1794 | if (inputParam.type === 'url') { |
| 1795 | const maskedUrl = typeof plainDataObj[cred] === 'string' ? maskUrlPassword(plainDataObj[cred]) : null |
| 1796 | // Only redact if there was actually a password to mask; otherwise keep URL as-is |
| 1797 | if (maskedUrl !== null) { |
| 1798 | plainDataObj[cred] = maskedUrl |
| 1799 | } |
| 1800 | } else { |
| 1801 | plainDataObj[cred] = REDACTED_CREDENTIAL_VALUE |
| 1802 | } |
| 1803 | } |
| 1804 | return plainDataObj |
| 1805 | } |
| 1806 | |
| 1807 | /** |
| 1808 | * Get sessionId |
no test coverage detected