Skip to content

[Snyk] Security upgrade langchain from 0.3.31 to 1.0.1#893

Open
graymalkin77 wants to merge 1 commit into
masterfrom
snyk-fix-81cf01b26db47c80f89e741f564232d4
Open

[Snyk] Security upgrade langchain from 0.3.31 to 1.0.1#893
graymalkin77 wants to merge 1 commit into
masterfrom
snyk-fix-81cf01b26db47c80f89e741f564232d4

Conversation

@graymalkin77
Copy link
Copy Markdown

snyk-top-banner

Snyk has created this PR to fix 1 vulnerabilities in the npm dependencies of this project.

Snyk changed the following file(s):

  • extensions/chuck-norris-jokes/package.json
  • extensions/chuck-norris-jokes/package-lock.json

Vulnerabilities that will be fixed with an upgrade:

Issue Score
medium severity Insertion of Sensitive Information into Log File
SNYK-JS-LANGSMITH-16082039
  601  

Breaking Change Risk

Merge Risk: High

Notice: This assessment is enhanced by AI.


Important

  • Check the changes in this PR to ensure they won't cause issues with your project.
  • Max score is 1000. Note that the real score may have changed since the PR was raised.
  • This PR was automatically created by Snyk using the credentials of a real user.

Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open fix PRs.

For more information:
🧐 View latest project report
📜 Customise PR templates
🛠 Adjust project settings
📚 Read about Snyk's upgrade logic


Learn how to fix vulnerabilities with free interactive lessons:

🦉 Learn about vulnerability in an interactive lesson of Snyk Learn.

…rris-jokes/package-lock.json to reduce vulnerabilities

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-LANGSMITH-16082039
Copilot AI review requested due to automatic review settings April 16, 2026 18:09
@graymalkin77
Copy link
Copy Markdown
Author

Merge Risk: High

The upgrade from langchain v0.3 to v1.0 is a major release with significant and breaking API changes. This is not a drop-in replacement and will require substantial code refactoring.

Key Breaking Changes:

  • Package Restructuring: The langchain package has been streamlined. Many modules have been moved to new packages like langchain-core, langchain-community, and the legacy langchain-classic. You will need to update import statements throughout your project.
    • For example, langchain.prompts is now langchain_core.prompts, and many retrievers are in langchain_classic.retrievers.
  • Agent Creation: The initialize_agents function is deprecated. The new standard is langchain.agents.create_agent, which uses a different interface and a new middleware system for customization.
  • Method Invocations: The .run() method on agents and chains has been replaced with .invoke(). The input to .invoke() is now a dictionary (e.g., {"content": "..."}) instead of a string. Similarly, retriever.get_relevant_documents() is now retriever.invoke().
  • Deprecated Components: Core components like RetrievalQA have been deprecated and must be rebuilt using the new runnable syntax.
  • Python Version: Support for Python 3.9 has been dropped; Python 3.10 or higher is now required.

Source: LangChain v1 Migration Guide, Release Notes

Recommendation: This upgrade requires a significant refactoring effort. Developers must carefully follow the official migration guide to update package imports, agent creation logic, and method calls to align with the new v1.0 API. This should be handled in a separate, dedicated effort before merging.

Notice 🤖: This content was augmented using artificial intelligence. AI-generated content may contain errors and should be reviewed for accuracy before use.

@graymalkin77
Copy link
Copy Markdown
Author

graymalkin77 commented Apr 16, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the chuck-norris-jokes extension’s npm dependencies to address a Snyk-reported vulnerability by upgrading langchain to a newer major version.

Changes:

  • Upgrade langchain from 0.3.31 to 1.0.1.
  • Update package-lock.json to reflect the new dependency graph (including new transitive dependencies and engine constraints).
  • Bump the extension package version in the lockfile to 1.0.1 (also reflected in the current package.json).

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 5 comments.

File Description
extensions/chuck-norris-jokes/package.json Updates the langchain dependency version (and currently shows package version 1.0.1).
extensions/chuck-norris-jokes/package-lock.json Updates resolved dependency tree for langchain@1.0.1, introduces Node engine constraints, and updates lockfile metadata including package version.
Files not reviewed (1)
  • extensions/chuck-norris-jokes/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"html-to-text": "9.0.5",
"jsdom": "24.1.3",
"langchain": "0.3.31"
"langchain": "1.0.1"
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

No code in this extension appears to import or reference langchain (no matches in src/). If it is truly unused, removing langchain entirely would eliminate the vulnerable transitive dependency with less breaking-change risk than a 0.x -> 1.x major upgrade.

Copilot uses AI. Check for mistakes.
"html-to-text": "9.0.5",
"jsdom": "24.1.3",
"langchain": "0.3.31"
"langchain": "1.0.1"
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

package-lock.json indicates the root dependency spec for langchain is "^1.0.1", but package.json pins it to "1.0.1". This will make npm ci fail (lockfile out of sync) and can lead to inconsistent installs. Align the version spec between package.json and package-lock.json and regenerate the lockfile.

Suggested change
"langchain": "1.0.1"
"langchain": "^1.0.1"

Copilot uses AI. Check for mistakes.
"html-to-text": "9.0.5",
"jsdom": "24.1.3",
"langchain": "0.3.31"
"langchain": "^1.0.1"
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

The lockfile records the project dependency as "langchain": "^1.0.1" which does not match package.json (pinned to "1.0.1"). npm ci will error if package-lock.json and package.json are out of sync. Recreate the lockfile with the intended spec (caret vs exact) so these files match.

Suggested change
"langchain": "^1.0.1"
"langchain": "1.0.1"

Copilot uses AI. Check for mistakes.
Comment on lines 2 to 4
"name": "chuck-norris-jokes",
"version": "1.0.0",
"version": "1.0.1",
"lockfileVersion": 3,
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

package-lock.json bumps this package version to 1.0.1. The PR title/description indicates only a dependency security upgrade; if a release/version bump is intentional, it should be called out explicitly (or otherwise revert the version change to keep this PR scoped).

Copilot uses AI. Check for mistakes.
Comment on lines 1209 to 1211
"engines": {
"node": ">=18"
"node": ">=20"
},
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

langchain@1.0.1 declares an engine requirement of Node >=20. If this extension is expected to build/run on older Node versions, this upgrade will break installs/runtime. Consider adding an explicit "engines" field in package.json (and/or updating build tooling) to reflect the new minimum Node version, or choose a langchain version compatible with the supported runtime.

Copilot uses AI. Check for mistakes.
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.

3 participants