File tree Expand file tree Collapse file tree
main/java/org/owasp/dependencycheck/analyzer
test/java/org/owasp/dependencycheck/analyzer
src/site/markdown/analyzers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -134,7 +134,8 @@ protected void prepareAnalyzer(Engine engine) throws InitializationException {
134134 synchronized (FETCH_MUTIX ) {
135135 if (StringUtils .isEmpty (getSettings ().getString (KEYS .ANALYZER_OSSINDEX_USER , StringUtils .EMPTY )) ||
136136 StringUtils .isEmpty (getSettings ().getString (KEYS .ANALYZER_OSSINDEX_PASSWORD , StringUtils .EMPTY ))) {
137- throw new InitializationException ("Error initializing OSS Index analyzer due to missing user/password credentials. Authentication is now required: https://ossindex.sonatype.org/doc/auth-required" );
137+ LOG .info ("Disabling OSS Index analyzer due to missing user/password credentials. Authentication is now required: https://ossindex.sonatype.org/doc/auth-required" );
138+ setEnabled (false );
138139 }
139140 }
140141 }
Original file line number Diff line number Diff line change 2828import java .util .concurrent .Executors ;
2929import java .util .concurrent .Future ;
3030
31- import static org .junit .jupiter .api .Assertions .assertDoesNotThrow ;
32- import static org .junit .jupiter .api .Assertions .assertEquals ;
33- import static org .junit .jupiter .api .Assertions .assertThrows ;
34- import static org .junit .jupiter .api .Assertions .assertTrue ;
31+ import static org .junit .jupiter .api .Assertions .*;
3532
3633class OssIndexAnalyzerTest extends BaseTest {
3734
@@ -252,14 +249,14 @@ void should_analyzeDependency_fail_when_socket_error_from_sonatype() throws Exce
252249 }
253250
254251 @ Test
255- void should_prepareAnalyzer_fail_when_credentials_not_set () throws Exception {
252+ void should_prepareAnalyzer_disable_when_credentials_not_set () throws Exception {
256253 OssIndexAnalyzer analyzer = new OssIndexAnalyzer ();
257254 Settings settings = getSettings ();
258255 Engine engine = new Engine (settings );
259256 analyzer .initialize (settings );
260257 try {
261258 analyzer .prepareAnalyzer (engine );
262- assertThrows ( InitializationException . class , () -> analyzer .prepareAnalyzer ( engine ));
259+ assertFalse ( analyzer .isEnabled ( ));
263260 } catch (InitializationException e ) {
264261 analyzer .close ();
265262 engine .close ();
Original file line number Diff line number Diff line change @@ -13,4 +13,6 @@ Sonatype [announced](https://ossindex.sonatype.org/doc/auth-required) that OSS I
1313
1414You can get an API Token following these steps:
15151 . [ Sign In] ( https://ossindex.sonatype.org/user/signin ) or [ Sign Up] ( https://ossindex.sonatype.org/user/register ) for free.
16- 2 . Get the API Token from user Settings.
16+ 2 . Get the API Token from user Settings.
17+
18+ If no credentials are provided, this analyzer will be disabled.
You can’t perform that action at this time.
0 commit comments