You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$4000] App crashes if you send an image immediately after renaming the workspace with < #21133
Click on the Workspace name and rename it to <my workspace(there should not be gap between < and the workspace name)
Notice the workspace name is saved on the #admin room
Go to workspace settings and add any word or letter after the previous name set and click on save to rename the workspace again.
Now on #admins room, send an image and click on it to preview (ex: )
Notice that the app crashes.
App doesn't crash if workspace name is set to a normal name. Happens if you rename the workspace with '<' 2 times.
Expected Result:
Preview should work when a workspace is named with <
Actual Result:
App crashes if you send an image immediately after renaming the workspace with <
Workaround:
Can the user still use Expensify without this being fixed? Have you informed them of the workaround?
Platforms:
Which of our officially supported platforms is this issue occurring on?
Android / native
Android / Chrome
iOS / native
iOS / Safari
MacOS / Chrome / Safari
MacOS / Desktop
Version Number: 1.3.29-3 Reproducible in staging?: y Reproducible in production?: y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation
Please re-state the problem that we are trying to solve in this issue.
App crashes if you send an image immediately after renaming the workspace with <
What is the root cause of that problem?
we parse html to get images using open tag img and add into attachment
but problem is here as we are writing string to htmlParser using write() we are appending messages over and over.
so in this condition when we rename workspace we get html as updated the name of this workspace from "TEST" to "<TEST"
here we have open tag "<TEST" and we append next html that is containing image gets appending like updated the name of this workspace from "TEST" to "<TEST"<img src="https://www.expensify.com/chat-attachmen…sify-height="2532" data-expensify-width="1170" />
So we get openTag as test"<img {src: 'src' in onopentag it will get return early here
changed the title [-]App crashes if you send an image immediately after renaming the workspace with <[/-][+][$1000] App crashes if you send an image immediately after renaming the workspace with <[/+]on Jun 20, 2023
Please re-state the problem that we are trying to solve in this issue.
App crashes if you send an image immediately after renaming the workspace with <
What is the root cause of that problem?
< affects html parsing by mixing html tags. We need to escape html characters to fix this issue.
e.g. in this case,
expected attachment tag name is img but returned myworkspaces"<img
What changes do you think we should make in order to solve the problem?
To solve this problem, I think we should escape html characters.
e.g. > => >, < => <, & => &, " => ", ' => '.
And also, this can occur script attack security issue. But which code should we update?
There're several ways to avoid or fix this issue. But we can fix this easily on FE side by converting html when fetching from onyx storage
This is what I suggest to do. Because, even we do a trick for attachment html parsing, there might be another issue occurred. So, by escaping html characters from onyx storage on fetching step, we can avoid these kinda issues.
And I saw that all kinda data is fetched by onyx.getSortedReportActions().
We don't need to convert all html strings. We just need to convert Workspace updated comments
Current issue occurs another issue. After changing workspace name to <myworkspace, if we change workspace name to <myworkspace__additional_str_here__, it doesn't show correctly on chat window.
Issued screenshot
Above code will fix this issue too
Screen.Recording.2023-06-30.at.7.54.43.AM.mov
Working example
Screen.Recording.2023-06-30.at.7.58.02.AM.mov
What alternative solutions did you explore? (Optional)
@marcochavezf do you feel like you'll have time to launch a fix for this on the backend? Or should we default to doing something on the front end? Thanks!
I'm re-evaluating the issue and it looks like the crash is not happening anymore, correct @aimane-chnaif? Also, I was analyzing the possibility of escaping the name in the backend and I noticed we don't have the same mechanism for workspace names as have for comments, so it would not be an easy change and I think it won't be worth do it if the app is not crashing.
Said that and since this is not part of a wave, I think we should close it @CortneyOfstad
Activity
melvin-bot commentedon Jun 20, 2023
Triggered auto assignment to @Christinadobrzyn (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Jun 20, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)kushu7 commentedon Jun 20, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
App crashes if you send an image immediately after renaming the workspace with <
What is the root cause of that problem?
we parse html to get images using open tag
imgand add into attachmentbut problem is here as we are writing string to
htmlParserusingwrite()we are appending messages over and over.App/src/components/AttachmentCarousel/index.js
Lines 176 to 177 in 8ba2234
so in this condition when we rename workspace we get html as
updated the name of this workspace from "TEST" to "<TEST"here we have open tag
"<TEST"and we append next html that is containing image gets appending likeupdated the name of this workspace from "TEST" to "<TEST"<img src="https://www.expensify.com/chat-attachmen…sify-height="2532" data-expensify-width="1170" />So we get openTag as
test"<img {src: 'src'inonopentagit will get return early hereApp/src/components/AttachmentCarousel/index.js
Lines 158 to 161 in 8ba2234
What changes do you think we should make in order to solve the problem?
App/src/components/AttachmentCarousel/index.js
Lines 158 to 177 in 8ba2234
We are just looking for attachments. We can update this to parse only attachments and this way we can avoid unnecessary parsing.
Video
Screen.Recording.2023-06-20.at.10.56.48.PM.mov
What alternative solutions did you explore? (Optional)
None
Christinadobrzyn commentedon Jun 20, 2023
I can reproduce - adding External
[-]App crashes if you send an image immediately after renaming the workspace with <[/-][+][$1000] App crashes if you send an image immediately after renaming the workspace with <[/+]melvin-bot commentedon Jun 20, 2023
Job added to Upwork: https://www.upwork.com/jobs/~012613bc6123fc7e67
melvin-bot commentedon Jun 20, 2023
Current assignee @Christinadobrzyn is eligible for the External assigner, not assigning anyone new.
melvin-bot commentedon Jun 20, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rushatgabhane (
External)jstortoise commentedon Jun 21, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
App crashes if you send an image immediately after renaming the workspace with
<What is the root cause of that problem?
<affects html parsing by mixing html tags. We need to escape html characters to fix this issue.e.g. in this case,
expected attachment tag name is
imgbut returnedmyworkspaces"<imgWhat changes do you think we should make in order to solve the problem?
To solve this problem, I think we should escape html characters.
e.g.
>=>>,<=><,&=>&,"=>",'=>'.And also, this can occur script attack security issue.
But which code should we update?
There're several ways to avoid or fix this issue. But we can fix this easily on FE side by converting html when fetching from onyx storage
This is what I suggest to do. Because, even we do a trick for attachment html parsing, there might be another issue occurred. So, by escaping html characters from onyx storage on fetching step, we can avoid these kinda issues.
And I saw that all kinda data is fetched by
onyx.getSortedReportActions().We don't need to convert all html strings. We just need to convert Workspace updated comments
Current code:
App/src/libs/ReportActionsUtils.js
Lines 148 to 177 in 0bbf3fc
We can add the following code after sorting:
Why this needed?
Current issue occurs another issue. After changing workspace name to
<myworkspace, if we change workspace name to<myworkspace__additional_str_here__, it doesn't show correctly on chat window.Issued screenshot

Above code will fix this issue too
Screen.Recording.2023-06-30.at.7.54.43.AM.mov
Screen.Recording.2023-06-30.at.7.58.02.AM.mov
What alternative solutions did you explore? (Optional)
None
225 remaining items
CortneyOfstad commentedon Dec 12, 2023
@marcochavezf Per this post it looks like we're supposed to close anything that is not part of Waves.
To confirm, this doesn't fit any waves and can be closed, correct?
aimane-chnaif commentedon Dec 12, 2023
This is "crash" so I think it should be fixed. If engineers have no time to fix in backend, we can just do frontend fix to avoid crash.
CortneyOfstad commentedon Dec 21, 2023
@marcochavezf do you feel like you'll have time to launch a fix for this on the backend? Or should we default to doing something on the front end? Thanks!
marcochavezf commentedon Dec 22, 2023
Oh sorry, I'm still focused on wave7, I think it still requires a backend fix. I can take a look quickly tomorrow
CortneyOfstad commentedon Dec 22, 2023
No worries and thank you @marcochavezf!
marcochavezf commentedon Dec 22, 2023
I'm re-evaluating the issue and it looks like the crash is not happening anymore, correct @aimane-chnaif? Also, I was analyzing the possibility of escaping the name in the backend and I noticed we don't have the same mechanism for workspace names as have for comments, so it would not be an easy change and I think it won't be worth do it if the app is not crashing.
Said that and since this is not part of a wave, I think we should close it @CortneyOfstad
aimane-chnaif commentedon Dec 22, 2023
Crash now changed to Not found page. The root cause still remains
crash.mov
As it's not crash, let's close for now.
I will bump here to re-open when wave projects are finished and ready to focus these bugs again.
CortneyOfstad commentedon Jan 2, 2024
Sorry for the delay here — was OoO for the holidays.
Sounds good and thanks @aimane-chnaif!