5353 # Note: v5.0.3, v5.0.2, v5.0.1, v5.0 excluded due to limited SBOM support
5454}
5555
56- # Default releases to scan (most recent stable versions)
57- DEFAULT_RELEASES = [
58- 'v5.4.2' , 'v5.4.1' ,
59- 'v5.3.3' , 'v5.3.2' ,
60- 'v5.2.5' , 'v5.2.4' ,
61- 'v5.1.6' , 'v5.1.5' ,
62- 'v5.0.9' , 'v5.0.8'
63- ]
56+ # Default releases to scan (configurable via environment variables)
57+ def get_default_releases ():
58+ """Get default releases from environment variable or use hardcoded fallback"""
59+ env_releases = os .getenv ('DEFAULT_RELEASES' )
60+ if env_releases :
61+ return [r .strip () for r in env_releases .split (',' )]
62+ return [
63+ 'v5.4.2' , 'v5.4.1' ,
64+ 'v5.3.3' , 'v5.3.2' ,
65+ 'v5.2.5' , 'v5.2.4' ,
66+ 'v5.1.6' , 'v5.1.5' ,
67+ 'v5.0.9' , 'v5.0.8'
68+ ]
6469
65- # ESP-IDF release branches to scan
66- ESP_IDF_RELEASE_BRANCHES = [
67- 'master' ,
68- 'release/v5.5' ,
69- 'release/v5.4' ,
70- 'release/v5.3' ,
71- 'release/v5.2' ,
72- 'release/v5.1' ,
73- 'release/v5.0'
74- ]
70+ # ESP-IDF release branches to scan (configurable via environment variables)
71+ def get_esp_idf_release_branches ():
72+ """Get ESP-IDF release branches from environment variable or use hardcoded fallback"""
73+ env_branches = os .getenv ('ESP_IDF_RELEASE_BRANCHES' )
74+ if env_branches :
75+ return [b .strip () for b in env_branches .split (',' )]
76+ return [
77+ 'master' ,
78+ 'release/v5.5' ,
79+ 'release/v5.4' ,
80+ 'release/v5.3' ,
81+ 'release/v5.2' ,
82+ 'release/v5.1' ,
83+ 'release/v5.0'
84+ ]
85+
86+ # Legacy constants for backwards compatibility
87+ DEFAULT_RELEASES = get_default_releases ()
88+ ESP_IDF_RELEASE_BRANCHES = get_esp_idf_release_branches ()
7589
7690class ESPIDFSecurityScanner :
7791 def __init__ (self , output_dir , use_docker = True ):
@@ -652,7 +666,7 @@ def scan_releases(self, releases, include_branches=None, include_release_branche
652666
653667 # Add release branches
654668 if include_release_branches :
655- git_targets .extend (ESP_IDF_RELEASE_BRANCHES )
669+ git_targets .extend (get_esp_idf_release_branches () )
656670
657671 # Add custom branches
658672 if include_branches :
@@ -684,8 +698,9 @@ def scan_releases(self, releases, include_branches=None, include_release_branche
684698
685699 # Scan ESP-IDF release branches if requested (and not in batch mode)
686700 if include_release_branches :
687- logger .info (f"Scanning ESP-IDF release branches: { ESP_IDF_RELEASE_BRANCHES } " )
688- for branch in ESP_IDF_RELEASE_BRANCHES :
701+ release_branches = get_esp_idf_release_branches ()
702+ logger .info (f"Scanning ESP-IDF release branches: { release_branches } " )
703+ for branch in release_branches :
689704 version_id , scan_result = self .scan_latest_branch (branch )
690705 if scan_result :
691706 tool_version = self .get_tool_version ()
@@ -840,10 +855,11 @@ def main():
840855 return
841856
842857 if args .list_release_branches :
858+ release_branches = get_esp_idf_release_branches ()
843859 print ("Available ESP-IDF release branches:" )
844- for branch in ESP_IDF_RELEASE_BRANCHES :
860+ for branch in release_branches :
845861 print (f" { branch } " )
846- print (f"\n Total: { len (ESP_IDF_RELEASE_BRANCHES )} release branches" )
862+ print (f"\n Total: { len (release_branches )} release branches" )
847863 print ("\n To scan these branches, use: --include-release-branches" )
848864 return
849865
@@ -879,7 +895,7 @@ def main():
879895 elif args .versions :
880896 versions = [v .strip () for v in args .versions .split (',' )]
881897 else :
882- versions = DEFAULT_RELEASES
898+ versions = get_default_releases ()
883899
884900 branches = None
885901 if args .include_branches :
@@ -893,15 +909,16 @@ def main():
893909 logger .info (f"Git-only mode: { args .git_only } " )
894910 logger .info (f"Versions to scan: { len (versions )} " )
895911 if args .include_release_branches :
896- logger .info (f"Release branches to scan: { len (ESP_IDF_RELEASE_BRANCHES )} " )
912+ release_branches = get_esp_idf_release_branches ()
913+ logger .info (f"Release branches to scan: { len (release_branches )} " )
897914 if branches :
898915 logger .info (f"Custom branches to scan: { branches } " )
899916
900917 # Use unified mode if requested
901918 if args .unified_mode :
902919 all_targets = versions [:]
903920 if args .include_release_branches :
904- all_targets .extend (ESP_IDF_RELEASE_BRANCHES )
921+ all_targets .extend (get_esp_idf_release_branches () )
905922 if branches :
906923 all_targets .extend (branches )
907924
0 commit comments