karma-runner / karma-runner/karma

The value of window.__karma__.files is not properly escaped

Open
#1,876 5 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.