Skip to content

Upgrade "js-yaml" from "~3.13.1" to "~4.1.0"#2

Merged
octogonz merged 6 commits intooctogonz/lfx-fixes2from
octogonz/js-yaml-upgrade
Sep 14, 2025
Merged

Upgrade "js-yaml" from "~3.13.1" to "~4.1.0"#2
octogonz merged 6 commits intooctogonz/lfx-fixes2from
octogonz/js-yaml-upgrade

Conversation

@octogonz
Copy link
Owner

Summary

This PR is based on my other branch from PR microsoft#5358

Rush Stack's js-yaml dependency is very old. Besides including unsafe deserialization (the classic incompetent security practice of evaling !!js/function scripts from a data file), the newer version fixes another nonstandard behavior where undefined values get serialized as !<tag:yaml.org,2002:js/undefined> '' rather than discarded.

Details

  • Upgrade all the projects
  • Fix the API call syntax
  • Other than somewhat cleaner YAML output, there should be no behavioral effects in this PR

How it was tested

rush test

Impacted documentation

None.

Comment on lines +51 to +52
this._snippets = yaml.load(snippetsContent, { filename: snippetsFilePath }) as ISnippetsFile;
this._snippetsAll = yaml.load(snippetsContent, { filename: snippetsFilePath }) as ISnippetsFile;

Choose a reason for hiding this comment

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

load isn't generic? What type does it return?

Copy link
Owner Author

Choose a reason for hiding this comment

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

In the new version, it returns unknown instead of any which requires an explicit type cast.

Arguably as ISnippetsFile better captures the assumption/conversion happening here, versus <ISnippetsFile>.

@octogonz octogonz merged commit ca2d785 into octogonz/lfx-fixes2 Sep 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants