File tree Expand file tree Collapse file tree
apps/sim/lib/core/security Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -198,6 +198,16 @@ describe('redactSensitiveValues', () => {
198198 expect ( result ) . not . toContain ( 'key123456' )
199199 } )
200200
201+ it . concurrent ( 'should redact dotted and parenthesized sensitive fields' , ( ) => {
202+ const result = redactSensitiveValues (
203+ `stripe.api_key: "stripe-secret" (password: 'password-value') service.SyncToken: "3"`
204+ )
205+
206+ expect ( result ) . toBe (
207+ `stripe.api_key: "${ REDACTED_MARKER } " (password: '${ REDACTED_MARKER } ') service.SyncToken: "3"`
208+ )
209+ } )
210+
201211 it . concurrent ( 'should redact equals-style sensitive fields' , ( ) => {
202212 const result = redactSensitiveValues (
203213 `password="password-value" token='token-value' api_key="api-key-value" SyncToken="3"`
Original file line number Diff line number Diff line change @@ -71,8 +71,8 @@ const SENSITIVE_VALUE_PATTERNS: Array<{
7171]
7272
7373const STRING_FIELD_PATTERNS = [
74- / ( ^ | [ { , \s ] ) ( [ " ' ] ? ) ( [ A - Z a - z 0 - 9 _ - ] + ) \2( \s * [: = ] \s * ) ( " (?: \\ .| [ ^ " \\ ] ) * " ) / gm,
75- / ( ^ | [ { , \s ] ) ( [ " ' ] ? ) ( [ A - Z a - z 0 - 9 _ - ] + ) \2( \s * [: = ] \s * ) ( ' (?: \\ .| [ ^ ' \\ ] ) * ' ) / gm,
74+ / ( ^ | [ ^ A - Z a - z 0 - 9 _ . - ] ) ( [ " ' ] ? ) ( [ A - Z a - z 0 - 9 _ . - ] + ) \2( \s * [: = ] \s * ) ( " (?: \\ .| [ ^ " \\ ] ) * " ) / gm,
75+ / ( ^ | [ ^ A - Z a - z 0 - 9 _ . - ] ) ( [ " ' ] ? ) ( [ A - Z a - z 0 - 9 _ . - ] + ) \2( \s * [: = ] \s * ) ( ' (?: \\ .| [ ^ ' \\ ] ) * ' ) / gm,
7676]
7777
7878export function isSensitiveKey ( key : string ) : boolean {
You can’t perform that action at this time.
0 commit comments