Skip to content
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

Addon Test: Escape XML when converting ANSI to HTML in test errors #29446

Merged
merged 2 commits into from
Oct 28, 2024

Conversation

ghengeveld
Copy link
Member

@ghengeveld ghengeveld commented Oct 25, 2024

This was previously fixed in #29414 for the interactions addon.

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 77.6 MB 77.6 MB 0 B -1.46 0%
initSize 146 MB 146 MB 0 B -1.46 0%
diffSize 68.5 MB 68.5 MB 0 B 1.41 0%
buildSize 6.82 MB 6.82 MB 0 B -0.5 0%
buildSbAddonsSize 1.5 MB 1.5 MB 0 B -0.64 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.85 MB 1.85 MB 0 B 1.34 0%
buildSbPreviewSize 271 kB 271 kB 0 B 1.35 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.82 MB 3.82 MB 0 B -0.51 0%
buildPreviewSize 3 MB 3 MB 0 B 1 0%
testBuildSize 0 B 0 B 0 B - -
testBuildSbAddonsSize 0 B 0 B 0 B - -
testBuildSbCommonSize 0 B 0 B 0 B - -
testBuildSbManagerSize 0 B 0 B 0 B - -
testBuildSbPreviewSize 0 B 0 B 0 B - -
testBuildStaticSize 0 B 0 B 0 B - -
testBuildPrebuildSize 0 B 0 B 0 B - -
testBuildPreviewSize 0 B 0 B 0 B - -
name before after diff z %
createTime 5.9s 21.2s 15.2s 1.19 72%
generateTime 20.6s 21.3s 753ms -0.33 3.5%
initTime 14.1s 14.1s -55ms -0.35 -0.4%
buildTime 10.4s 9.1s -1s -323ms -0.22 -14.4%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 9.3s 9.4s 124ms 3.25 1.3%
devManagerResponsive 6.2s 6.7s 461ms 4.05 🔺6.8%
devManagerHeaderVisible 803ms 573ms -230ms -0.11 -40.1%
devManagerIndexVisible 921ms 646ms -275ms 0.21 -42.6%
devStoryVisibleUncached 1.8s 1.2s -569ms 1.03 -43.8%
devStoryVisible 852ms 645ms -207ms 0.32 -32.1%
devAutodocsVisible 717ms 520ms -197ms -0.11 -37.9%
devMDXVisible 747ms 524ms -223ms 0.12 -42.6%
buildManagerHeaderVisible 814ms 558ms -256ms -0.03 -45.9%
buildManagerIndexVisible 838ms 571ms -267ms -0.16 -46.8%
buildStoryVisible 774ms 557ms -217ms -0.49 -39%
buildAutodocsVisible 689ms 470ms -219ms -0.4 -46.6%
buildMDXVisible 679ms 459ms -220ms -0.48 -47.9%

Greptile Summary

Added XML escaping to ANSI-to-HTML conversion in test error displays to prevent XSS vulnerabilities, matching a similar fix previously implemented in the interactions addon.

  • Added escapeXML: true option in code/addons/test/src/utils.ts within createAnsiToHtmlFilter function
  • Ensures special XML characters in test error messages are properly escaped during rendering

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@ghengeveld ghengeveld changed the title Escape XML when converting ANSI to HTML in test errors Addon Test: Escape XML when converting ANSI to HTML in test errors Oct 25, 2024
Copy link

nx-cloud bot commented Oct 25, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit efe13b2. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@valentinpalkovic valentinpalkovic merged commit 074d679 into next Oct 28, 2024
59 checks passed
@valentinpalkovic valentinpalkovic deleted the escape-xml-in-error branch October 28, 2024 09:12
@github-actions github-actions bot mentioned this pull request Oct 28, 2024
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants