MCPcopy Index your code
hub / github.com/FlowiseAI/Flowise / redactCredentialWithPasswordType

Function redactCredentialWithPasswordType

packages/server/src/utils/index.ts:1784–1805  ·  view source on GitHub ↗
(
    componentCredentialName: string,
    decryptedCredentialObj: ICredentialDataDecrypted,
    componentCredentials: IComponentCredentials
)

Source from the content-addressed store, hash-verified

1782}
1783
1784export 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

Callers 1

decryptCredentialDataFunction · 0.85

Calls 1

maskUrlPasswordFunction · 0.85

Tested by

no test coverage detected