Skip to content

Added issue get command for FoD and SSC#978

Open
jmadhur87 wants to merge 1 commit intofortify:dev/v3.xfrom
jmadhur87:mjain6/974
Open

Added issue get command for FoD and SSC#978
jmadhur87 wants to merge 1 commit intofortify:dev/v3.xfrom
jmadhur87:mjain6/974

Conversation

@jmadhur87
Copy link
Copy Markdown
Contributor

Added issue get command for both SSC and FoD to fetch a single issue by ID, avoiding full list + client-side filtering.
Supports optional --embed to include additional issue details.

feat: Add get command for fcli ssc issue and fcli fod issue(#974 )

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds new get subcommands to the ssc issue and fod issue command groups to retrieve a single issue/vulnerability by identifier, supporting optional embedded data and avoiding manual client-side filtering workflows.

Changes:

  • Added fcli ssc issue get <id> --av <appversion> command and supporting i18n/table output definitions.
  • Added fcli fod issue get <id|vulnId> --rel <release> command with i18n updates and command registration.
  • Refactored SSC issue option message keys so --embed/--include descriptions can be shared beyond the list command.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
fcli-core/fcli-ssc/src/main/resources/com/fortify/cli/ssc/i18n/SSCMessages.properties Adds SSC issue-get help + table defaults; renames embed/include message keys for reuse.
fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/issue/cli/mixin/SSCIssueIncludeMixin.java Updates description key to new shared SSC issue include message key.
fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/issue/cli/cmd/SSCIssueGetCommand.java New SSC leaf command to fetch a single issue for an app version.
fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/issue/cli/cmd/SSCIssueCommands.java Registers SSCIssueGetCommand under ssc issue.
fcli-core/fcli-fod/src/main/resources/com/fortify/cli/fod/i18n/FoDMessages.properties Adds FoD issue-get help text keys.
fcli-core/fcli-fod/src/main/java/com/fortify/cli/fod/issue/cli/cmd/FoDIssueGetCommand.java New FoD leaf command to fetch a single vulnerability for a release.
fcli-core/fcli-fod/src/main/java/com/fortify/cli/fod/issue/cli/cmd/FoDIssueCommands.java Registers FoDIssueGetCommand under fod issue.

Comment on lines +37 to +39
@DisableTest(TestType.CMD_DEFAULT_TABLE_OPTIONS_PRESENT)
@Command(name = OutputHelperMixins.Get.CMD_NAME)
public class FoDIssueGetCommand extends AbstractFoDOutputCommand {
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FoDIssueGetCommand disables CMD_DEFAULT_TABLE_OPTIONS_PRESENT, but there is no *.output.table.args defined for this command in FoDMessages.properties. Rather than disabling the command-tree test, add a default table column definition (for example fcli.fod.issue.get.output.table.args or a shared fcli.fod.issue.output.table.args that get can inherit) and remove the @DisableTest annotation so this command adheres to the same output conventions as other leaf commands.

Copilot uses AI. Check for mistakes.
Comment on lines +73 to +77
private JsonNode getIssueByFilter(UnirestInstance unirest, String releaseId, String fieldName, String value) {
HttpRequest<?> request = unirest.get(FoDUrls.VULNERABILITIES)
.routeParam("relId", releaseId)
.queryString("filters", fieldName+":"+value)
.queryString("limit", "1");
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This get implementation still calls the vulnerabilities list endpoint (FoDUrls.VULNERABILITIES) with filters + limit=1 and then takes the first result. That contradicts the PR description/issue goal of avoiding list+filter for single-issue retrieval. Consider switching to the single-vulnerability endpoint described in #974 (GET /api/v3/releases/{releaseId}/vulnerabilities/{vulnId}), or at minimum document why the list endpoint is required here.

Copilot uses AI. Check for mistakes.
Comment on lines +74 to +80
HttpRequest<?> request = unirest.get(FoDUrls.VULNERABILITIES)
.routeParam("relId", releaseId)
.queryString("filters", fieldName+":"+value)
.queryString("limit", "1");
JsonNode body = includeMixin.updateRequest(request).asObject(JsonNode.class).getBody();
JsonNode items = FoDInputTransformer.getItems(body);
return items!=null && items.isArray() && !items.isEmpty() ? items.get(0) : null;
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getIssueByFilter() ignores HTTP status codes and treats any response without items as "not found". For example, authentication/authorization errors or an invalid release id could result in an error response body that then gets converted into the misleading "No issue found..." exception. Consider using Unirest's ifFailure(IfFailureHandler::handle) (or explicitly checking response.getStatus()) before attempting to parse items, so real API errors are surfaced correctly.

Copilot uses AI. Check for mistakes.
more immediate output.
fcli.ssc.issue.list.output.table.header.visibilityMarker =
fcli.ssc.issue.list.output.table.header.friority = Priority
fcli.ssc.issue.get.usage.header = Get application version vulnerability details.
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new fcli.ssc.issue.get.usage.header text says "Get application version vulnerability details", which reads like an application version command rather than an issue command. Consider aligning the header with the actual command (ssc issue get) to avoid confusing help output (for example, "Get vulnerability details" or "Get issue details").

Suggested change
fcli.ssc.issue.get.usage.header = Get application version vulnerability details.
fcli.ssc.issue.get.usage.header = Get vulnerability details.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants