Skip to content

Conversation

@tesnim5hamdouni
Copy link
Contributor

Adding Extension ecosystem support to GD.
The changes include:

  • update ECOSYSTEM struct to include extensions
  • add a new custom scanner able to query the marketplace for remote extensions
  • add a manifest (and marketplace metadata for remote extensions) parser for metadata (used in analyzer metadata heuristics)
  • add 3 heuristics dealing with extensions metadata (empty_info, suspicious_permissions and suspicious_publisher)
  • add 3 experimental yara rules for the sake of testing
  • update SourceCodeRule to support various ecosystems
  • add core tests for extensions

Copy link
Contributor

@ikretz ikretz left a comment

Choose a reason for hiding this comment

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

Looks good! I had 2-3 questions and a handful of nits but no major changes requested.

Let's make sure @sobregosodd gets a chance to look at it, as well.

Comment on lines 105 to 122
output = {
"issues": issues,
"errors": errors,
"results": results,
"path": path}
# Including extension info - pending discussion
# if info is not None:
# output["package_info"] = info

return output

def analyze_metadata(
self,
path: str,
info,
rules=None,
name: Optional[str] = None,
version: Optional[str] = None) -> dict:
Copy link
Contributor

Choose a reason for hiding this comment

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

  • this entire block changed nothing, let's keep the new analyze_metadata formated one


# Define verbose rules that should only show "file-level" triggers
verbose_rules = {
"DETECT_FILE_obfuscator_dot_io",
Copy link
Contributor

Choose a reason for hiding this comment

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

  • this should not be hardcoded, let's find another way

Comment on lines 55 to 61
'rm -rf',
'del /s',
'format',
'shutdown',
'curl',
'wget',
'powershell']
Copy link
Contributor

Choose a reason for hiding this comment

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

not a good idea to hardcode these here. let's talk alternatives


# Default to EXTENSION for general YARA rules (can be adjusted as when
# other ecosystems are supported)
rule_ecosystem = ECOSYSTEM.EXTENSION
Copy link
Contributor

Choose a reason for hiding this comment

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

  • this is not right, all ecosystems are currently supported. you might need to parse the metadata here

Copy link
Contributor

@ikretz ikretz left a comment

Choose a reason for hiding this comment

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

Looks good, just a few small things here and there.

Copy link
Contributor

@ikretz ikretz left a comment

Choose a reason for hiding this comment

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

LGTM, a couple optional suggestions.

Let's make sure to also get approval from @sobregosodd before merging.

Comment on lines 116 to 122
# Determine ecosystem based on filename prefix
rule_ecosystem: Optional[ECOSYSTEM]
if file_name.startswith("extension_"):
rule_ecosystem = ECOSYSTEM.EXTENSION
else:
# If no specific ecosystem prefix, apply to any ecosystem
rule_ecosystem = None
Copy link
Contributor

Choose a reason for hiding this comment

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

rule_ecosystem = None
if file_name.startswith("extension_"):
    rule_ecosystem = ECOSYSTEM.EXTENSION

Copy link
Contributor

Choose a reason for hiding this comment

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

You may also want to move the "extension_" piece to a constant.

Copy link
Contributor

Choose a reason for hiding this comment

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

You could even do rule_ecosystem = ECOSYSTEM.EXTENSION if file_name.startswith("extension_") else None

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll wait for Sebastian's review and apply this change

Copy link
Contributor

@sobregosodd sobregosodd Jul 21, 2025

Choose a reason for hiding this comment

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

mmh... actually, we don't use the name's prefix to do this, we use the metadata of the rule.
similar to description_regex up there.
in some ideal future world, we should remove the prefixes of the rules (there are problems if we try to do this now)

@tesnim5hamdouni tesnim5hamdouni merged commit dc899fb into main Jul 23, 2025
10 checks passed
@tesnim5hamdouni tesnim5hamdouni deleted the tham/vsc_ecosystem branch July 23, 2025 13:02
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.

4 participants