Skip to content

Commit 0d3c640

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
fix(quickbooks): preserve read-write compatibility
1 parent 2979a0a commit 0d3c640

4 files changed

Lines changed: 28 additions & 2 deletions

File tree

apps/sim/lib/core/security/redaction.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,16 @@ describe('redactSensitiveValues', () => {
198198
expect(result).not.toContain('key123456')
199199
})
200200

201+
it.concurrent('should redact equals-style sensitive fields', () => {
202+
const result = redactSensitiveValues(
203+
`password="password-value" token='token-value' api_key="api-key-value" SyncToken="3"`
204+
)
205+
206+
expect(result).toBe(
207+
`password="${REDACTED_MARKER}" token='${REDACTED_MARKER}' api_key="${REDACTED_MARKER}" SyncToken="3"`
208+
)
209+
})
210+
201211
it.concurrent('should preserve workflow-state tokens in serialized JSON', () => {
202212
const result = redactSensitiveValues(
203213
'{"SyncToken":"3","nextPageToken":"page-2","accessToken":"secret","password":"don\'t leak"}'

apps/sim/lib/core/security/redaction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ const SENSITIVE_VALUE_PATTERNS: Array<{
7171
]
7272

7373
const STRING_FIELD_PATTERNS = [
74-
/(^|[{,\s])(["']?)([A-Za-z0-9_-]+)\2(\s*:\s*)("(?:\\.|[^"\\])*")/gm,
75-
/(^|[{,\s])(["']?)([A-Za-z0-9_-]+)\2(\s*:\s*)('(?:\\.|[^'\\])*')/gm,
74+
/(^|[{,\s])(["']?)([A-Za-z0-9_-]+)\2(\s*[:=]\s*)("(?:\\.|[^"\\])*")/gm,
75+
/(^|[{,\s])(["']?)([A-Za-z0-9_-]+)\2(\s*[:=]\s*)('(?:\\.|[^'\\])*')/gm,
7676
]
7777

7878
export function isSensitiveKey(key: string): boolean {

apps/sim/tools/quickbooks/quickbooks.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,16 @@ describe('QuickBooks customer and vendor mutations', () => {
555555
City: 'San Francisco',
556556
PostalCode: '94105',
557557
})
558+
expect(
559+
parseQuickBooksAddress(
560+
{ Line1: '123 Main St', City: 'San Francisco', PostalCode: '94105' },
561+
'billingAddress'
562+
)
563+
).toEqual({
564+
Line1: '123 Main St',
565+
City: 'San Francisco',
566+
PostalCode: '94105',
567+
})
558568
expect(() => parseQuickBooksAddress('[]', 'billingAddress')).toThrow('JSON object')
559569
expect(() => parseQuickBooksAddress('{"unknown":"value"}', 'billingAddress')).toThrow(
560570
'unsupported field'

apps/sim/tools/quickbooks/utils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,17 @@ export function validateQuickBooksOptionalNumber(
259259

260260
const QUICKBOOKS_ADDRESS_FIELDS = {
261261
line1: 'Line1',
262+
Line1: 'Line1',
262263
line2: 'Line2',
264+
Line2: 'Line2',
263265
city: 'City',
266+
City: 'City',
264267
countrySubDivisionCode: 'CountrySubDivisionCode',
268+
CountrySubDivisionCode: 'CountrySubDivisionCode',
265269
postalCode: 'PostalCode',
270+
PostalCode: 'PostalCode',
266271
country: 'Country',
272+
Country: 'Country',
267273
} as const
268274

269275
export function parseQuickBooksAddress(

0 commit comments

Comments
 (0)