Skip to content

quote entire custom claims object and escape inner quotes - #5630

Merged
thomasmburke merged 2 commits into
masterfrom
tb-fix-custom-claims-csv-export
Mar 28, 2023
Merged

thomasmburke merged 2 commits into
masterfrom
tb-fix-custom-claims-csv-export

Conversation

@thomasmburke

@thomasmburke thomasmburke commented Mar 24, 2023 •

Copy link
Copy Markdown
Contributor

Description

fixes 3319

Scenarios Tested

  • Export of a user with a single custom claim
  • Export of a user with multiple custom claims
  • Export of a user with a custom claim that contains a " in the claim value
  • Export of a user with a custom claim that's value is not quota, e.g. true or 99`
  • Export of a user with no custom claims
  • Export of users with a mix of the above

@thomasmburke

Copy link
Copy Markdown
Contributor Author

Note about tests

New test may be valid, but was a bit tricky. I was sort of suspecting spyWrite.getCall(0).args[0] to have a custom claim of "{ ""customBoolean"": true, ""customString"": ""test"", ""customInt"": 99 }", but that wasn't the case so I ended up just comparing it to userList which escapes quotes with \n instead of ""

Solutions considered

Elected to stick with the default csv-parse escape character which is " so that we could properly parse claims that have quotes in the value if a user did that for some reason.

Considered csv-parse ignore_last_delimiters but since we know the possible forms that a claims object will come in quoting felt like the cleanest approach to avoid picking up delimiters in the claims object

@thomasmburke
thomasmburke requested a review from joehan March 24, 2023 20:03
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

Patch coverage: 50.00% and project coverage change: -0.01 ⚠️

Comparison is base (b14b5f3) 56.00% compared to head (5ca3db1) 55.99%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5630      +/-   ##
==========================================
- Coverage   56.00%   55.99%   -0.01%     
==========================================
  Files         321      321              
  Lines       21657    21658       +1     
  Branches     4413     4414       +1     
==========================================
  Hits        12128    12128              
  Misses       8465     8465              
- Partials     1064     1065       +1     
Impacted Files Coverage Δ
src/accountExporter.ts 63.71% <50.00%> (-0.57%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@joehan joehan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 suggestion for the changelog, but lgtm otherwise

Comment thread CHANGELOG.md Resolved
Co-authored-by: joehan <[email protected]>
@thomasmburke
thomasmburke merged commit bff5da7 into master Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

customAttributes is not completely preserved when exporting and importing

3 participants