Skip to content

Commit

Permalink
fix: NullPointerException in fcli fod *ast-scan get (fixes #553)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Snowden <[email protected]>
  • Loading branch information
MikeTheSnowman and Michael Snowden authored Jun 28, 2024
1 parent 8b762e2 commit f2eab9c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ public String getScanId(UnirestInstance unirest) {
}

public final String getDelimiter() {
return delimiterMixin.getDelimiter();
if( delimiterMixin!=null ) {
return delimiterMixin.getDelimiter();
}
return null;
}

}
Expand Down Expand Up @@ -95,7 +98,7 @@ public static class RequiredOption extends AbstractFoDScanResolverMixin {
}

public static class RequiredOptionMulti extends AbstractFoDMultiScanResolverMixin {
@EnvSuffix("SCANS") @Option(names = {"--scans"}, required=true, split=",", descriptionKey = "fcli.fod.scan.scan-id")
@EnvSuffix("SCANS") @Option(names = {"--scans"}, required=true, split=",", descriptionKey = "fcli.fod.scan.scan-ids")
@Getter private String[] releaseQualifiedScanOrIds;
}

Expand All @@ -105,7 +108,7 @@ public static class PositionalParameter extends AbstractFoDScanResolverMixin {
}

public static class PositionalParameterMulti extends AbstractFoDMultiScanResolverMixin {
@EnvSuffix("SCANS") @Parameters(index = "0", arity = "1..", paramLabel = "scan-id's", descriptionKey = "fcli.fod.scan.scan-id")
@EnvSuffix("SCANS") @Parameters(index = "0", arity = "1..", paramLabel = "scan-id's", descriptionKey = "fcli.fod.scan.scan-ids")
@Getter private String[] releaseQualifiedScanOrIds;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static final JsonNode renameFields(JsonNode record, FoDScanType scanType)
return obj;
}
public static final FoDScanDescriptor getScanDescriptor(UnirestInstance unirest, String releaseQualifiedScanOrId, String delimiter) {
String[] elts = releaseQualifiedScanOrId.split(delimiter);
String[] elts = (delimiter != null) ? releaseQualifiedScanOrId.split(delimiter) : new String[]{releaseQualifiedScanOrId};
switch (elts.length) {
case 2:
var pollingResult = unirest.get(FoDUrls.SCAN_POLLING_SUMMARY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ usage.description =

### top level product command ###
delim = Change the default delimiter character when using options that accept \
"application[:microservice]:release" as an argument or parameter.
"application[:microservice]:release" as an argument or parameter.
fcli.fod.usage.header = Interact with Fortify on Demand (FoD).
fcli.fod.usage.description.0 = The commands in this module allow for interacting with \
Fortify on Demand (FoD). This includes functionality like managing applications, \
Expand All @@ -26,8 +26,9 @@ fcli.fod.app.app-name = Application name.
fcli.fod.app.app-name-or-id = Application id or name. Note that numeric values are always interpreted \
as id's. If you have numeric application names, you will need to specify the application id.
fcli.fod.app.app-type = Application type. Valid values: ${COMPLETION-CANDIDATES}
fcli.fod.app.release.microservice-and-release-name = Initial release to be created on the application, in the format <microservice>:<release> for a microservices application, or just <release> for non-microservices applications.
fcli.fod.scan.scan-id = Scan id(s).
fcli.fod.app.release.microservice-and-release-name = Initial release to be created on the application, in the format <microservice>:<release> for a microservices application, or just <release> for non-microservices applications.
fcli.fod.scan.scan-id = Scan id.
fcli.fod.scan.scan-ids = Scan id(s).
fcli.fod.scan.entitlement-frequency = The entitlement frequency type to use. Valid values: ${COMPLETION-CANDIDATES}.
fcli.fod.scan.analysis-status = Scan analysis status. Valid values: ${COMPLETION-CANDIDATES}.
fcli.fod.scan.scan-type = Scan type. Valid values: ${COMPLETION-CANDIDATES}.
Expand Down Expand Up @@ -120,7 +121,7 @@ fcli.fod.session.login.client-id.1 = Environment variable:%n \
fcli.fod.session.login.client-secret.0 = FoD client secret.
fcli.fod.session.login.client-secret.1 = Environment variable:%n \
${fcli.env.default.prefix}_FOD_CLIENT_SECRET
fcli.fod.session.login.scopes = FoD scopes to request. Default value: ${DEFAULT-VALUE}
fcli.fod.session.login.scopes = FoD scopes to request. Default value: ${DEFAULT-VALUE}

fcli.fod.session.logout.usage.header = Terminate FoD session.
fcli.fod.session.logout.usage.description = This command terminates an FoD session previously created \
Expand All @@ -137,7 +138,7 @@ fcli.fod.rest.usage.description = These commands allow for direct interaction wi
(no need to manually specify Authorization header), rich output formatting options, and query functionality.
fcli.fod.rest.call.usage.header = Call an individual FoD REST API endpoint.
fcli.fod.rest.call.no-paging = By default, this command will load all pages of data from FoD (from the \
given offset if specified as a request parameter). Use this option to return only a single page.
given offset if specified as a request parameter). Use this option to return only a single page.
fcli.fod.rest.call.no-transform = By default, this command performs generic transformations on FoD REST \
responses, like only outputting the actual response data (contents of the 'items' property). Use this \
option to output the original response contents without transformations.
Expand All @@ -150,7 +151,7 @@ fcli.fod.rest.lookup.usage.header = Retrieve FoD REST API lookup values.
fcli.fod.rest.lookup.usage.description = Use this command to retrieve the values of lookup items (types) \
that are used with various commands and when using the FoD REST API directly.
fcli.fod.rest.lookup.<type>[0] = The type of lookup items to return. Valid values: ${COMPLETION-CANDIDATES}. \
Leave empty to list all the valid lookup items of the REST API.
Leave empty to list all the valid lookup items of the REST API.

# fcli fod action
# Apart from the top-level usage header, which includes a FoD reference, all headers
Expand Down Expand Up @@ -285,7 +286,7 @@ fcli.fod.app.output.header.microserviceName = Microservice
fcli.fod.app.create.usage.header = Create a new application.
fcli.fod.app.create.usage.description = This command allows a new application and its first release to be created. \
Please note some attributes might be mandatory depending on the configuration of your tenant. Please check the \
Fortify on Demand web portal first.
Fortify on Demand web portal first.
fcli.fod.app.create.application-name = The name of the application to create.
fcli.fod.app.create.type = The type of the application. Valid values: ${COMPLETION-CANDIDATES}.
fcli.fod.app.create.release-name = The name of the release to create for the application.
Expand Down Expand Up @@ -378,7 +379,7 @@ fcli.fod.assessment-type.usage.header = Manage FoD assessment types.
fcli.fod.assessment-type.output.header.assessmentTypeId = Id
fcli.fod.assessment-type.output.header.unitInfo = Units
fcli.fod.assessment-type.list.usage.header = List assessment types.
fcli.fod.assessment-type.list.scan-types = Comma-separated list of scan types for which to list assessment types. Default value: ${DEFAULT-VALUE}. Valid values: ${COMPLETION-CANDIDATES}.
fcli.fod.assessment-type.list.scan-types = Comma-separated list of scan types for which to list assessment types. Default value: ${DEFAULT-VALUE}. Valid values: ${COMPLETION-CANDIDATES}.

# fcli fod entitlement
fcli.fod.entitlement.usage.header = View FoD entitlements.
Expand All @@ -394,7 +395,7 @@ fcli.fod.scan.usage.header = Manage FoD scans.
fcli.fod.scan.usage.description = The commands listed below allow for generically managing scans on FoD. \
Commands for setting up, starting, downloading and importing existing scan results can be found on the \
relevant 'fcli fod xxx-scan' entities, for example SAST scan setup and start can be found in \
'fcli fod sast-scan'.
'fcli fod sast-scan'.
fcli.fod.scan.output.header.scanId = Id
fcli.fod.scan.output.header.scanType = Type
fcli.fod.scan.output.header.analysisStatusType = Analysis Status
Expand Down Expand Up @@ -422,7 +423,7 @@ fcli.fod.scan.wait-for.any-state = One or more scan states against which to matc

# fcli fod sast-scan
fcli.fod.sast-scan.usage.header = Manage FoD SAST scans.
fcli.fod.sast-scan.description = The commands listed below allow for starting and managing SAST scans on FoD.
fcli.fod.sast-scan.description = The commands listed below allow for starting and managing SAST scans on FoD.
fcli.fod.sast-scan.output.header.scanId = Id
fcli.fod.sast-scan.output.header.analysisStatusType = Analysis Status
fcli.fod.sast-scan.output.header.startedDateTime = Started
Expand Down Expand Up @@ -492,7 +493,7 @@ fcli.fod.sast-scan.download-latest.file = File path and name where to save the F

# fcli fod dast-scan
fcli.fod.dast-scan.usage.header = Manage FoD DAST scans.
fcli.fod.dast-scan.description = The commands listed below allow for starting and managing DAST scans on FoD.
fcli.fod.dast-scan.description = The commands listed below allow for starting and managing DAST scans on FoD.
fcli.fod.dast-scan.output.header.scanId = Id
fcli.fod.dast-scan.output.header.analysisStatusType = Analysis Status
fcli.fod.dast-scan.output.header.startedDateTime = Started
Expand Down Expand Up @@ -655,7 +656,7 @@ fcli.fod.dast-scan.setup-api.false-positive-removal = ${fcli.fod.dast-scan.setup

# fcli fod mast-scan
fcli.fod.mast-scan.usage.header = Manage FoD MAST scans.
fcli.fod.mast-scan.description = The commands listed below allow for starting and managing MAST scans on FoD.
fcli.fod.mast-scan.description = The commands listed below allow for starting and managing MAST scans on FoD.
fcli.fod.mast-scan.output.header.scanId = Id
fcli.fod.mast-scan.output.header.analysisStatusType = Analysis Status
fcli.fod.mast-scan.output.header.startedDateTime = Started
Expand Down Expand Up @@ -713,7 +714,7 @@ fcli.fod.mast-scan.download-latest.file = File path and name where to save the F

# fcli fod oss-scan
fcli.fod.oss-scan.usage.header = Manage FoD OSS scans.
fcli.fod.oss-scan.description = The commands listed below allow for starting and managing OSS scans on FoD.
fcli.fod.oss-scan.description = The commands listed below allow for starting and managing OSS scans on FoD.
fcli.fod.oss-scan.output.header.scanId = Id
fcli.fod.oss-scan.output.header.analysisStatusType = Analysis Status
fcli.fod.oss-scan.output.header.startedDateTime = Started
Expand Down

0 comments on commit f2eab9c

Please sign in to comment.