profiling.sampling flamegraph does not escape function names in HTML output
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Python
- Estrelas
- 77.2k
- Forks
- 36k
- Métricas de merge de PRs
- Métricas de PR pendentes
Descrição
Bug description
The flamegraph exporter in profiling.sampling embeds profile strings into the generated HTML without escaping:
-
_create_flamegraph_htmlwritesjson.dumps(data)into an inline<script>block. A function name containing</script>breaks out of the script element. -
flamegraph.jsinterpolates the raw function name into a tooltip via.html()(innerHTML).
The sibling heatmap exporter already escapes its embedded data (html.escape(json.dumps(...))), and flamegraph.js already defines and uses escapeHtml() for displayName and source lines -- the function name was missed.
As a bonus, <lambda>, <module>, <genexpr> currently render as empty tooltip titles because the browser drops them as unknown tags. Escaping fixes this.
CPython versions tested on
main
Operating systems tested on
macOS
Linked PRs
- gh-153841
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Start at _create_flamegraph_html in profiling.sampling and inspect how json.dumps(data) is embedded in the inline script, then review the function-name tooltip path in flamegraph.js. Compare the existing heatmap escaping and escapeHtml() uses. Done means function names cannot break the script or be interpreted as HTML, and names such as render correctly.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- javascript, python
- Domínio
- data-visualization, security
- Tipo de issue
- Bug
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Status de atividade
- Estagnada
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 25/100