Skip to content

feat: initial implementation of extension malware check #4272

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shellz-n-stuff
Copy link
Contributor

Description

Goose users need to install extensions in order to get the full utility they desire. However, our stdio MCPs are quite often coming from package ecosystems that can contain malware.

Though it's not possible to completely protect users from all forms of Malware (and other Supply Chain Attacks) implementing some basic checks for known bad packages better protects all Goose users! ❤️

Implementation

When a user attempts to activate an extension we will parse out the name of the package and/or version information (where possible) and attempt to query the OSV API to understand if the package contains malware (identified by MAL in the formatting).

If the http call fails for some reason and/or we have issues parsing we opt to fail open to ensure this doesn't present a disruption to users.

Note: This implementation only supports PyPi and NPM as package manager formats

Handling of non-provided package versions

One key choice here was we @latest syntax and no version provided syntax by checking if any version of the package has malware. Broadly speaking it's going to be rare that an extension is compromised, malware finding filed and then persisted on those versions but it "could" happen and I'm open to adjusting the approach if we have major upfront concerns

OSV/Malicious Packages

The OSV project contains vulnerability information and malware information for open-source packages. The Malware information is populated via https://github.com/ossf/malicious-packages and broadly is a trustworthy datasource.

Though OSV does contain vulnerability data we're strictly only checking for Malware in this case. We could potentially inform users of CVEs in the future using this interface but we'd want to make the product interface there much easier to understand for all users!

Testing

Screenshot 2025-08-22 at 1 33 52 pm
  • Adding innocuous package that will be flagged as Malware
Screenshot 2025-08-22 at 1 34 23 pm
  • Error is thrown and available in UI
Screenshot 2025-08-22 at 1 34 40 pm
  • Clear error message

let mut headers = HeaderMap::new();
headers.insert(
USER_AGENT,
HeaderValue::from_static("goose-osv-check/1.1 (+https://osv.dev)"),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was an idea from Goose. But I actually really liked it! Just in-case the OSV team want to identify us and/or hit us up

USER_AGENT,
HeaderValue::from_static("goose-osv-check/1.1 (+https://osv.dev)"),
);
reqwest::Client::builder()
Copy link
Contributor

Choose a reason for hiding this comment

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

Thoughts on adding reasonable timeouts to prevent hanging on slow/unresponsive OSV API?

Comment on lines +260 to +261
return Err(ExtensionError::ConfigError(format!(
"Blocked malicious package: {name}@{ver} ({ecosystem}). OSV MAL advisories: {details}"
Copy link
Contributor

Choose a reason for hiding this comment

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

should we consider making the error more actionable? I was curious how to deal with false positives. Looks like the recommended way is to create a GH issue
https://github.com/ossf/malicious-packages/blob/main/README.md#false-positives

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