Skip to content

Commit c4ff290

Browse files
committed
feat: add support for scanning ESP-IDF v6.x releases and branches
The scanner was only searching for v5.x patterns, ignoring branches like release/v6.0 even when configured in ESP_IDF_RELEASE_BRANCHES. - Update scan_all_v5_releases to search for v6.x patterns - Include release/v6.x branches in the branch filter - Merge configured branches from environment variable - Add release/v6.0 to default fallback values - Update help text to reflect v6.x support
1 parent b94ee68 commit c4ff290

File tree

2 files changed

+28
-17
lines changed

2 files changed

+28
-17
lines changed

.github/workflows/security-scan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ env:
5656
OUTPUT_DIR: 'data'
5757
# GitHub variables for configurable scan targets
5858
DEFAULT_RELEASES: ${{ vars.DEFAULT_RELEASES || 'v5.4.2,v5.4.1,v5.3.3,v5.3.2,v5.2.5,v5.2.4,v5.1.6,v5.1.5,v5.0.9,v5.0.8' }}
59-
ESP_IDF_RELEASE_BRANCHES: ${{ vars.ESP_IDF_RELEASE_BRANCHES || 'master,release/v5.5,release/v5.4,release/v5.3,release/v5.2,release/v5.1,release/v5.0' }}
59+
ESP_IDF_RELEASE_BRANCHES: ${{ vars.ESP_IDF_RELEASE_BRANCHES || 'master,release/v6.0,release/v5.5,release/v5.4,release/v5.3,release/v5.2,release/v5.1,release/v5.0' }}
6060
ESP_IDF_DEV_BRANCHES: ${{ vars.ESP_IDF_DEV_BRANCHES || 'master,develop' }}
6161

6262
jobs:

scan_releases.py

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def get_esp_idf_release_branches():
7575
return [b.strip() for b in env_branches.split(',')]
7676
return [
7777
'master',
78+
'release/v6.0',
7879
'release/v5.5',
7980
'release/v5.4',
8081
'release/v5.3',
@@ -790,31 +791,41 @@ def scan_unified_targets(self, targets, prefer_git_over_docker=False):
790791
return results
791792

792793
def scan_all_v5_releases(self, use_unified_mode=True, prefer_git_over_docker=False):
793-
"""Scan all available v5.x tags and release branches efficiently"""
794-
logger.info("Scanning ESP-IDF v5.x releases and branches...")
795-
796-
# Get available v5.x tags and release branches, plus master branch
797-
tags, branches = self.get_available_targets(target_patterns=["v5.", "master"])
798-
release_branches = [b for b in branches if b.startswith("release/v5.")]
799-
794+
"""Scan all available v5.x+ tags and release branches efficiently"""
795+
logger.info("Scanning ESP-IDF v5.x+ releases and branches...")
796+
797+
# Get available v5.x and v6.x tags and release branches, plus master branch
798+
tags, branches = self.get_available_targets(target_patterns=["v5.", "v6.", "master"])
799+
release_branches = [b for b in branches if b.startswith("release/v5.") or b.startswith("release/v6.")]
800+
800801
# Add master branch if available
801802
if "master" in branches:
802803
release_branches.append("master")
803-
804-
# Filter to v5.x tags only, excluding rc, dev, beta versions
804+
805+
# Merge in any additional branches from environment variable configuration
806+
# This ensures branches like release/v6.0 are included even if not yet in remote
807+
configured_branches = get_esp_idf_release_branches()
808+
for branch in configured_branches:
809+
if branch not in release_branches:
810+
# Verify branch exists in remote before adding
811+
if branch in branches or branch == "master":
812+
release_branches.append(branch)
813+
logger.info(f"Added configured branch: {branch}")
814+
815+
# Filter to v5.x and v6.x tags, excluding rc, dev, beta versions
805816
# Note: Previously unsupported SBOM versions are now included to show "No SBOM support" status
806-
v5_tags = [tag for tag in tags if tag.startswith("v5.") and
807-
not any(exclude in tag.lower() for exclude in ["rc", "dev", "beta"])]
808-
809-
logger.info(f"Found {len(v5_tags)} v5.x tags and {len(release_branches)} v5.x release branches")
817+
release_tags = [tag for tag in tags if (tag.startswith("v5.") or tag.startswith("v6.")) and
818+
not any(exclude in tag.lower() for exclude in ["rc", "dev", "beta"])]
810819

820+
logger.info(f"Found {len(release_tags)} release tags and {len(release_branches)} release branches")
821+
811822
if use_unified_mode:
812823
# Combine all targets for unified scanning
813-
all_targets = v5_tags + release_branches
824+
all_targets = release_tags + release_branches
814825
return self.scan_unified_targets(all_targets, prefer_git_over_docker)
815826
else:
816827
# Use traditional scanning approach
817-
return self.scan_releases(v5_tags, include_branches=release_branches)
828+
return self.scan_releases(release_tags, include_branches=release_branches)
818829

819830
def main():
820831
parser = argparse.ArgumentParser(description="Scan ESP-IDF releases for security vulnerabilities")
@@ -833,7 +844,7 @@ def main():
833844
parser.add_argument("--batch-mode", action="store_true",
834845
help="Use optimized batch scanning (single clone for multiple targets)")
835846
parser.add_argument("--scan-all-v5", action="store_true",
836-
help="Scan all available v5.x tags and release branches")
847+
help="Scan all available v5.x/v6.x tags and release branches")
837848
parser.add_argument("--unified-mode", action="store_true",
838849
help="Use unified scanning (single clone for all targets)")
839850
parser.add_argument("--git-only", action="store_true",

0 commit comments

Comments
 (0)