oppia: InvalidInputException: Unsupported tags/attributes found in the SVG

This error occurred recently in production:

 Traceback (most recent call last):
  File "/layers/google.python.pip/pip/lib/python3.9/site-packages/webapp2.py", line 604, in dispatch
    return method(*args, **kwargs)
  File "/workspace/core/controllers/acl_decorators.py", line 4542, in test_can_edit_entity
    return functions[entity_type](entity_id)
  File "/workspace/core/controllers/acl_decorators.py", line 4516, in <lambda>
    can_edit_exploration(reduced_handler)(
  File "/workspace/core/controllers/acl_decorators.py", line 1905, in test_can_edit
    return handler(self, exploration_id, *args, **kwargs)
  File "/workspace/core/controllers/acl_decorators.py", line 4505, in <lambda>
    arg_swapped_handler = lambda x, y, z: handler(y, x, z)
  File "/workspace/core/controllers/editor.py", line 1440, in post
    raise self.InvalidInputException(e)
core.controllers.base.UserFacingExceptions.InvalidInputException: Unsupported tags/attributes found in the SVG:

attributes: ['svg:xmlns:sodipodi'] 

Where did the error occur? Add the page the error occurred on. Editor page

Which release did the error occur in? Add the Oppia release version associated with the error. release-3.4.3-hotfix-3

Frequency of occurrence Add details about how many times the error occurred within a given time period (e.g. the last week, the last 30 days, etc.). This helps issue triagers establish severity. 64 times in 30 days.

Additional context Add any other context that would be useful. Make sure to anonymize user data like user IDs, exploration IDs, state names, user names, etc. Replace any personal data with appropriate placeholders.

Ideally, SVG validation should occur in the frontend and not send the file to the backend if it fails validation.

Relevant frontend validation: https://github.com/oppia/oppia/blob/6278d8087873635deca7c6375006f9c54894e716/core/templates/services/svg-sanitizer.service.ts#L186

Related issue: https://github.com/oppia/oppia/issues/9220

General instructions for contributors In general, the procedure for fixing server errors should be the following:

  • Analyze the code in the file where the error occurred and come up with a hypothesis for the reason.
  • Based on your hypothesis, determine a list of steps that reliably reproduce the issue (or confirm any repro instructions that have been provided). For example, if your hypothesis is that the issue arises due to a delay in a response from the backend server, try to change the code so that the backend server always has a delay, and see if the error then shows up 100% of the time on your local machine.
  • Explain your proposed fix, the logic behind it, and any other findings/context you have on this thread. You can also link to a debugging doc if you prefer.
  • Get your approach validated by an Oppia team member.
  • Make a PR that fixes the issue.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (15 by maintainers)

Commits related to this issue

Most upvoted comments

@mishrayush15 Follow the instructions in the PR checklist that’s part of the PR description. You can leave a comment for Oppiabot to assign based on the PR reviewers listed in the “Reviewers” section. Use that technique to make sure that those reviewers are listed under “Assignees”, otherwise they might miss your PR. Thanks.

@mishrayush15 You’re welcome, happy to help.

Yes, writing everything on the issue page (as you’ve done) is the best way to go, and is sufficient. Generally, the only times we use separate docs are for debugging docs or technical design docs. Thanks for checking!

@mishrayush15 Great job reproducing the issue. The repro steps you provided look good to me and qualify as a successful set of repro steps for this server error.

Part (1) of the fix also seems reasonable. Feel free to make a PR for it if you like. I would also recommend that you write frontend tests in the PR in which you make your fix – try to include examples which are currently failing, but would pass under the new approach.

Just to confirm though, would doing just part (1) of your proposed fix solve the problem fully? We don’t really want to add stuff that’s specific to particular attrs in the main code – that should all be controlled by the dict in constants.ts.