karma-runner / karma-runner/karma
The value of window.__karma__.files is not properly escaped
Open
- Dominant language
- JavaScript
- Stars
- 12k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
One of the files being served in my project has a single quote in its name. Karma is unable to run any tests because of this.
This is the culprit: https://github.com/karma-runner/karma/blob/19dd8249c6ce692004f4d52f8c0b2bb863e1f3fb/lib/middleware/karma.js#L148
Why not use `JSON.stringify()`?
Contributor guide
Research direction
Start at lib/middleware/karma.js around line 148, where window.__karma__.files is generated, and reproduce the failure with a served filename containing a single quote. Verify that the generated value remains valid JavaScript and that Karma can run tests when such a filename is present.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100