Skip to content

Commit

Permalink
feat: Carthage analyzer (#6614)
Browse files Browse the repository at this point in the history
Co-authored-by: Jeremy Long <[email protected]>
  • Loading branch information
alinradut and jeremylong committed May 1, 2024
1 parent d464dee commit 758f1f9
Show file tree
Hide file tree
Showing 24 changed files with 427 additions and 1 deletion.
23 changes: 23 additions & 0 deletions ant/src/main/java/org/owasp/dependencycheck/taskdefs/Check.java
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,10 @@ public class Check extends Update {
* Whether or not the CocoaPods Analyzer is enabled.
*/
private Boolean cocoapodsAnalyzerEnabled;
/**
* Whether or not the Carthage Analyzer is enabled.
*/
private Boolean carthageAnalyzerEnabled;

/**
* Whether or not the Swift package Analyzer is enabled.
Expand Down Expand Up @@ -1105,6 +1109,24 @@ public void setCocoapodsAnalyzerEnabled(Boolean cocoapodsAnalyzerEnabled) {
this.cocoapodsAnalyzerEnabled = cocoapodsAnalyzerEnabled;
}

/**
* Returns if the Carthage analyzer is enabled.
*
* @return if the Carthage analyzer is enabled
*/
public boolean isCarthageAnalyzerEnabled() {
return carthageAnalyzerEnabled;
}

/**
* Sets whether or not the Carthage analyzer is enabled.
*
* @param carthageAnalyzerEnabled the state of the Carthage analyzer
*/
public void setCarthageAnalyzerEnabled(Boolean carthageAnalyzerEnabled) {
this.carthageAnalyzerEnabled = carthageAnalyzerEnabled;
}

/**
* Returns whether or not the Swift package Analyzer is enabled.
*
Expand Down Expand Up @@ -2144,6 +2166,7 @@ protected void populateSettings() throws BuildException {
getSettings().setBooleanIfNotNull(Settings.KEYS.ANALYZER_SWIFT_PACKAGE_MANAGER_ENABLED, swiftPackageManagerAnalyzerEnabled);
getSettings().setBooleanIfNotNull(Settings.KEYS.ANALYZER_SWIFT_PACKAGE_RESOLVED_ENABLED, swiftPackageResolvedAnalyzerEnabled);
getSettings().setBooleanIfNotNull(Settings.KEYS.ANALYZER_COCOAPODS_ENABLED, cocoapodsAnalyzerEnabled);
getSettings().setBooleanIfNotNull(Settings.KEYS.ANALYZER_CARTHAGE_ENABLED, carthageAnalyzerEnabled);
getSettings().setBooleanIfNotNull(Settings.KEYS.ANALYZER_BUNDLE_AUDIT_ENABLED, bundleAuditAnalyzerEnabled);
getSettings().setStringIfNotNull(Settings.KEYS.ANALYZER_BUNDLE_AUDIT_PATH, bundleAuditPath);
getSettings().setStringIfNotNull(Settings.KEYS.ANALYZER_BUNDLE_AUDIT_WORKING_DIRECTORY, bundleAuditWorkingDirectory);
Expand Down
1 change: 1 addition & 0 deletions ant/src/site/markdown/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ nuspecAnalyzerEnabled | Sets whether the .NET Nuget Nuspec Analyze
nugetconfAnalyzerEnabled | Sets whether the [experimental](../analyzers/index.html) .NET Nuget packages.config Analyzer will be used. `enableExperimental` must be set to true. | true
libmanAnalyzerEnabled | Sets whether the Libman Analyzer will be used. | true
cocoapodsAnalyzerEnabled | Sets whether the [experimental](../analyzers/index.html) Cocoapods Analyzer should be used. `enableExperimental` must be set to true. | true
carthageAnalyzerEnabled | Sets whether the [experimental](../analyzers/index.html) Carthage Analyzer should be used. `enableExperimental` must be set to true. | true
mixAuditAnalyzerEnabled | Sets whether the [experimental](../analyzers/index.html) Mix Audit Analyzer should be used. `enableExperimental` must be set to true. | true
mixAuditPath | Sets the path to the mix_audit executable; only used if mix audit analyzer is enabled and experimental analyzers are enabled. | &nbsp;
bundleAuditAnalyzerEnabled | Sets whether the [experimental](../analyzers/index.html) Bundle Audit Analyzer should be used. `enableExperimental` must be set to true. | true
Expand Down
2 changes: 2 additions & 0 deletions cli/src/main/java/org/owasp/dependencycheck/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,8 @@ protected void populateSettings(CliParser cli) throws InvalidSettingException {
!cli.isDisabled(CliParser.ARGUMENT.DISABLE_SWIFT_RESOLVED, Settings.KEYS.ANALYZER_SWIFT_PACKAGE_RESOLVED_ENABLED));
settings.setBoolean(Settings.KEYS.ANALYZER_COCOAPODS_ENABLED,
!cli.isDisabled(CliParser.ARGUMENT.DISABLE_COCOAPODS, Settings.KEYS.ANALYZER_COCOAPODS_ENABLED));
settings.setBoolean(Settings.KEYS.ANALYZER_CARTHAGE_ENABLED,
!cli.isDisabled(CliParser.ARGUMENT.DISABLE_CARTHAGE, Settings.KEYS.ANALYZER_CARTHAGE_ENABLED));
settings.setBoolean(Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED,
!cli.isDisabled(CliParser.ARGUMENT.DISABLE_RUBYGEMS, Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED));
settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED,
Expand Down
5 changes: 5 additions & 0 deletions cli/src/main/java/org/owasp/dependencycheck/CliParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ private void addAdvancedOptions(final Options options) {
.addOption(newOption(ARGUMENT.DISABLE_OSSINDEX, "Disable the Sonatype OSS Index Analyzer."))
.addOption(newOption(ARGUMENT.DISABLE_OSSINDEX_CACHE, "Disallow the OSS Index Analyzer from caching results"))
.addOption(newOption(ARGUMENT.DISABLE_COCOAPODS, "Disable the CocoaPods Analyzer."))
.addOption(newOption(ARGUMENT.DISABLE_CARTHAGE, "Disable the Carthage Analyzer."))
.addOption(newOption(ARGUMENT.DISABLE_SWIFT, "Disable the swift package Analyzer."))
.addOption(newOption(ARGUMENT.DISABLE_SWIFT_RESOLVED, "Disable the swift package resolved Analyzer."))
.addOption(newOption(ARGUMENT.DISABLE_GO_DEP, "Disable the Golang Package Analyzer."))
Expand Down Expand Up @@ -1286,6 +1287,10 @@ public static class ARGUMENT {
* Disables the cocoapods analyzer.
*/
public static final String DISABLE_COCOAPODS = "disableCocoapodsAnalyzer";
/**
* Disables the Carthage analyzer.
*/
public static final String DISABLE_CARTHAGE = "disableCarthageAnalyzer";
/**
* Disables the swift package manager analyzer.
*/
Expand Down
1 change: 1 addition & 0 deletions cli/src/main/resources/completion-for-dependency-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ _odc_completions()
--disableCentralCache
--disableCmake
--disableCocoapodsAnalyzer
--disableCarthageAnalyzer
--disableComposer
--disableDart
--disableFileName
Expand Down
1 change: 1 addition & 0 deletions cli/src/site/markdown/arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Advanced Options
| | \-\-disableRubygems | | Sets whether the [experimental](../analyzers/index.html) Ruby Gemspec Analyzer will be used. | &nbsp; |
| | \-\-disableBundleAudit | | Sets whether the [experimental](../analyzers/index.html) Ruby Bundler Audit Analyzer will be used. | &nbsp; |
| | \-\-disableCocoapodsAnalyzer | | Sets whether the [experimental](../analyzers/index.html) Cocoapods Analyzer will be used. | &nbsp; |
| | \-\-disableCarthageAnalyzer | | Sets whether the [experimental](../analyzers/index.html) Carthage Analyzer will be used. | &nbsp; |
| | \-\-disableSwiftPackageManagerAnalyzer | | Sets whether the [experimental](../analyzers/index.html) Swift Package Manager Analyzer will be used. | &nbsp; |
| | \-\-disableSwiftPackageResolvedAnalyzer| | Sets whether the [experimental](../analyzers/index.html) Swift Package Resolved Analyzer will be used. | &nbsp; |
| | \-\-disableAutoconf | | Sets whether the [experimental](../analyzers/index.html) Autoconf Analyzer will be used. | &nbsp; |
Expand Down
1 change: 1 addition & 0 deletions cli/src/test/resources/sample.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ analyzer.openssl.enabled=true
analyzer.central.enabled=true
analyzer.nexus.enabled=false
analyzer.cocoapods.enabled=true
analyzer.carthage.enabled=true
analyzer.swift.package.manager.enabled=true
#whether the nexus analyzer uses the proxy
analyzer.nexus.proxy=true
Expand Down
1 change: 1 addition & 0 deletions cli/src/test/resources/sample2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ analyzer.openssl.enabled=false
analyzer.central.enabled=false
analyzer.nexus.enabled=true
analyzer.cocoapods.enabled=false
analyzer.carthage.enabled=false
analyzer.swift.package.manager.enabled=false
#whether the nexus analyzer uses the proxy
analyzer.nexus.proxy=false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public enum AnalysisPhase {
* {@link AutoconfAnalyzer}
* {@link CMakeAnalyzer}
* {@link CentralAnalyzer}
* {@link CarthageAnalyzer}
* {@link CocoaPodsAnalyzer}
* {@link ComposerLockAnalyzer}
* {@link DartAnalyzer}
Expand Down
Loading

0 comments on commit 758f1f9

Please sign in to comment.