-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regex backtracking issues #1312
Comments
For those unfamiliar with catastrophic backtracking, here is a short explanation. Consider the following regex: So if you have an input string of But the But what if the second
You see there are 10 attempts to match the given string, which is really just a series of a's. The regex In the TTML parser we use the regex |
Issue #1312 Change-Id: I0aed14068776a800eee35f03d2f878db0dd565b6
Issue #1312 Change-Id: I0aed14068776a800eee35f03d2f878db0dd565b6
TTML parser fix cherry-picked for v2.3.3. The remaining issues are in the documentation template, not Shaka Player. |
The vulnerable expressions in jsdoc are all from the "prettify" module, which enables syntax highlighting for CSS. https://github.com/jsdoc3/jsdoc/tree/master/templates/default/static/scripts/prettify That code seems to have been forked in 2012 and never updated. The original code has been updated a few times since then: https://github.com/google/code-prettify/commits/master/src/lang-css.js I will put together a bug report against jsdoc for this, and a pull request to update, if I can. |
Sounds good. Link to the bug report and I can also take a peek at a fix. |
@joeyparrish I have contacted the code-prettify devs by email. I CCd you in case you want to weigh in or point out the prettify fork. |
@joeyparrish Is there something else we should with regards to this issue or are we good to close it? |
We have fixed the regex issues that affect our library, but there are others in our jsdoc template. We're leaving it open until we fix those, too. Our template is forked from the jsdoc default template, and the relevant code in jsdoc was forked from prettify (and never updated). If we do fix these issues in the template ourselves before jsdoc and prettify do, we can upstream the fix. |
@davisjam reported some potential regex backtracking vulnerabilities to us via email. In such a vulnerability, extremely long inputs could cause a regex to block for a very long time while parsing.
We believe there is no significant risk to these particular issues. Four of six of them are in the jsdoc template, and therefore do not affect Shaka Player itself. The other two are in the TTML text parser.
Application developers generally have some control or trust in their content catalogs and are not subject to malicious TTML content. Such content, if encountered, would only cause individual browser tabs to lock up. Shaka Player does not run in nodejs or other such environments, and we do not expect this could be used for any kind of DOS attack.
The affected regex should be refactored to avoid this. @davisjam recommends these tools to assess progress:
Here are the details of the reported vulnerabilities:
Vuln 1:
Vuln 2:
Vuln 3:
Vuln 4:
Vuln 5:
Vuln 6:
The text was updated successfully, but these errors were encountered: