Skip to content

Fix GO-2026-5410: upgrade slack-go/slack v0.15.0 → v0.23.1#629

Open
thiagoalessio wants to merge 1 commit into
openshift:mainfrom
thiagoalessio:govulncheck-slack
Open

Fix GO-2026-5410: upgrade slack-go/slack v0.15.0 → v0.23.1#629
thiagoalessio wants to merge 1 commit into
openshift:mainfrom
thiagoalessio:govulncheck-slack

Conversation

@thiagoalessio

@thiagoalessio thiagoalessio commented Jul 15, 2026

Copy link
Copy Markdown
Member

Resolves vulnerability GO-2026-5410 by upgrading github.com/slack-go/slack to v0.23.1. Adapts to breaking API changes:

  • UploadFileV2Parameters renamed to UploadFileParameters
  • RichTextPreformatted struct flattened (no longer embeds RichTextSection)
  • TextBlockObject.Emoji changed from bool to *bool
  • WorkflowStep types removed (deprecated Steps from Apps feature): defines local types and HTTP client for workflows.updateStep, workflows.stepCompleted, and workflows.stepFailed API calls
  • InteractionCallback.WorkflowStep field removed: extracts workflow_step_edit_id from raw JSON in handleInteraction

/hold

I didn't test locally yet, just want to see if govulncheck will pass with the changes first.

Summary by CodeRabbit

  • Bug Fixes
    • Improved Slack workflow-step handling, including support for deprecated “Steps from Apps” interactions.
    • Workflow steps can now be completed, failed, and reconfigured reliably.
    • Updated Slack file uploads for kubeconfigs, service account keys, and installation logs.
  • Compatibility
    • Updated Slack integration support for current API behavior.
    • Improved rendering of Slack modal views and workflow configuration screens.

Resolves vulnerability GO-2026-5410 by upgrading github.com/slack-go/slack
to v0.23.1. Adapts to breaking API changes:

- UploadFileV2Parameters renamed to UploadFileParameters
- RichTextPreformatted struct flattened (no longer embeds RichTextSection)
- TextBlockObject.Emoji changed from bool to *bool
- WorkflowStep types removed (deprecated Steps from Apps feature):
  defines local types and HTTP client for workflows.updateStep,
  workflows.stepCompleted, and workflows.stepFailed API calls
- InteractionCallback.WorkflowStep field removed: extracts
  workflow_step_edit_id from raw JSON in handleInteraction

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-ci-robot

Copy link
Copy Markdown

@thiagoalessio: No Jira issue with key GO-2026 exists in the tracker at https://redhat.atlassian.net.
Once a valid jira issue is referenced in the title of this pull request, request a refresh with /jira refresh.

Details

In response to this:

Resolves vulnerability GO-2026-5410 by upgrading github.com/slack-go/slack to v0.23.1. Adapts to breaking API changes:

  • UploadFileV2Parameters renamed to UploadFileParameters
  • RichTextPreformatted struct flattened (no longer embeds RichTextSection)
  • TextBlockObject.Emoji changed from bool to *bool
  • WorkflowStep types removed (deprecated Steps from Apps feature): defines local types and HTTP client for workflows.updateStep, workflows.stepCompleted, and workflows.stepFailed API calls
  • InteractionCallback.WorkflowStep field removed: extracts workflow_step_edit_id from raw JSON in handleInteraction

/hold

I didn't test locally yet, just want to see if govulncheck will pass with the changes first.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 15, 2026
@openshift-ci

openshift-ci Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: thiagoalessio
Once this PR has been reviewed and has the lgtm label, please assign bradmwilliams for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The change upgrades the Slack SDK, replaces file-upload APIs, adds an HTTP client for deprecated workflow endpoints, updates workflow event and modal handling, and adjusts modal payload construction for the newer SDK structures.

Changes

Slack compatibility updates

Layer / File(s) Summary
Workflow API client
pkg/slack/events/workflowSubmissionEvents/types.go
Adds workflow event, input, output, request, and response types plus an authorized client for completing, failing, and updating workflow steps.
Workflow execution and endpoint wiring
pkg/slack/events/workflowSubmissionEvents/workflow_handler.go, pkg/slack/events/router/router.go, cmd/ci-chat-bot/slack.go
Builds workflow handlers from the bot token, decodes workflow events through JSON, preserves Jira ticket handling, and passes updated router dependencies.
Workflow modal integration
pkg/slack/interactions/router/router.go, pkg/slack/modals/stepsFromApp/*
Uses workflow-specific types and the extracted workflow step edit ID when saving workflow configuration.
File upload API migration
pkg/slack/parser/types.go, pkg/slack/slack.go, pkg/slack/actions_request_test.go, go.mod
Replaces UploadFileV2 with UploadFile in interfaces, production uploads, tests, and the Slack SDK version.
Modal payload compatibility
pkg/slack/modals/common/*, pkg/slack/modals/launch/views.go, pkg/slack/modals/list/views.go, pkg/slack/modals/mce/create/views.go, pkg/slack/modals/stepsFromApp/jira_step.go
Updates rich-text fields, emoji values, and workflow-step modal type values for the updated Slack payload structures.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Suggested reviewers: alexnpavel

Sequence Diagram(s)

sequenceDiagram
  participant Slack
  participant WorkflowHandler
  participant JiraIssueFiler
  participant SlackWorkflowClient
  participant SlackAPI
  Slack->>WorkflowHandler: workflow_step_execute event
  WorkflowHandler->>JiraIssueFiler: file Jira ticket
  JiraIssueFiler-->>WorkflowHandler: issue key and link
  WorkflowHandler->>SlackWorkflowClient: WorkflowStepCompleted(outputs)
  SlackWorkflowClient->>SlackAPI: POST workflows.stepCompleted
  SlackAPI-->>SlackWorkflowClient: workflow response
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly states the main change: upgrading slack-go/slack to address GO-2026-5410.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@openshift-ci-robot

Copy link
Copy Markdown

@thiagoalessio: No Jira issue with key GO-2026 exists in the tracker at https://redhat.atlassian.net.
Once a valid jira issue is referenced in the title of this pull request, request a refresh with /jira refresh.

Details

In response to this:

Resolves vulnerability GO-2026-5410 by upgrading github.com/slack-go/slack to v0.23.1. Adapts to breaking API changes:

  • UploadFileV2Parameters renamed to UploadFileParameters
  • RichTextPreformatted struct flattened (no longer embeds RichTextSection)
  • TextBlockObject.Emoji changed from bool to *bool
  • WorkflowStep types removed (deprecated Steps from Apps feature): defines local types and HTTP client for workflows.updateStep, workflows.stepCompleted, and workflows.stepFailed API calls
  • InteractionCallback.WorkflowStep field removed: extracts workflow_step_edit_id from raw JSON in handleInteraction

/hold

I didn't test locally yet, just want to see if govulncheck will pass with the changes first.

Summary by CodeRabbit

  • Bug Fixes
  • Improved Slack workflow-step handling, including support for deprecated “Steps from Apps” interactions.
  • Workflow steps can now be completed, failed, and reconfigured reliably.
  • Updated Slack file uploads for kubeconfigs, service account keys, and installation logs.
  • Compatibility
  • Updated Slack integration support for current API behavior.
  • Improved rendering of Slack modal views and workflow configuration screens.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (4)
pkg/slack/events/workflowSubmissionEvents/workflow_handler.go (1)

111-115: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Simplify the return statement.

The error check and explicit returns can be collapsed into a single return statement.

♻️ Proposed refactor
-	err = client.WorkflowStepCompleted(event.WorkflowStep.WorkflowStepExecuteID, outgoingOutputs)
-	if err != nil {
-		return err
-	}
-	return nil
+	return client.WorkflowStepCompleted(event.WorkflowStep.WorkflowStepExecuteID, outgoingOutputs)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/slack/events/workflowSubmissionEvents/workflow_handler.go` around lines
111 - 115, In the workflow submission handler, simplify the final
client.WorkflowStepCompleted call by returning its result directly instead of
assigning to err, checking it, and explicitly returning nil.
pkg/slack/events/workflowSubmissionEvents/types.go (1)

139-139: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Check HTTP status code before decoding JSON.

If the Slack API returns a non-2xx status (e.g., 502 Bad Gateway) with an HTML body, the JSON decoder will fail with a cryptic syntax error. Checking the status code first provides a clearer error message for debugging.

🛠️ Proposed fix
+	if resp.StatusCode >= 300 {
+		return fmt.Errorf("slack API %s returned HTTP %d", method, resp.StatusCode)
+	}
+
 	var sr slackResponse
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/slack/events/workflowSubmissionEvents/types.go` at line 139, In the
response-handling flow around the slackResponse variable, validate the HTTP
response status before attempting JSON decoding. For non-2xx responses, return a
clear error containing the status information and skip decoding the body; retain
the existing JSON decoding path for successful responses.
cmd/ci-chat-bot/slack.go (1)

64-66: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Add ReadTimeout to the HTTP server.

While ReadHeaderTimeout mitigates basic Slowloris attacks targeting headers, a malicious client could still slowly trickle the request body and exhaust connections. Adding a ReadTimeout bounds the total time allowed to read the full request (including the body).

🛡️ Proposed configuration
 	mux.Handle("/slack/interactive-endpoint", handler(handleInteraction(bot.BotSigningSecret, interactionrouter.ForModals(slackclient, jobManager, httpclient, bot.BotToken))))
-	server := &http.Server{Addr: ":" + strconv.Itoa(bot.Port), Handler: mux, ReadHeaderTimeout: 10 * time.Second}
+	server := &http.Server{
+		Addr:              ":" + strconv.Itoa(bot.Port),
+		Handler:           mux,
+		ReadHeaderTimeout: 10 * time.Second,
+		ReadTimeout:       30 * time.Second,
+	}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/ci-chat-bot/slack.go` around lines 64 - 66, Update the http.Server
configuration in the server initialization to include a ReadTimeout that bounds
the total request-read duration, including the body, while preserving the
existing ReadHeaderTimeout setting.

Source: Linters/SAST tools

pkg/slack/modals/common/version_views.go (1)

107-112: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Prefer the SDK constructor over manual struct initialization.

While using new(bool) functionally provides the pointer required by the upgraded slack-go/slack SDK, manually instantiating TextBlockObject literals leaves your code vulnerable to future upstream struct alterations. It is highly recommended to use the SDK's native constructor (slackClient.NewTextBlockObject), which safely handles pointer extraction for you and shrinks visual boilerplate (a pattern that is already appropriately used in pkg/slack/modals/common/simple_modals.go).

  • pkg/slack/modals/common/version_views.go#L107-L112: Replace the struct literal with Text: slackClient.NewTextBlockObject(slackClient.PlainTextType, "Version Specifications", false, false),
  • pkg/slack/modals/common/version_views.go#L163-L168: Replace the struct literal with slackClient.NewTextBlockObject(slackClient.PlainTextType, config.ContextMetadata, false, false),
  • pkg/slack/modals/common/version_views.go#L241-L246: Replace the struct literal with Text: slackClient.NewTextBlockObject(slackClient.PlainTextType, "Select a Version", false, false),
  • pkg/slack/modals/common/version_views.go#L270-L275: Replace the struct literal with slackClient.NewTextBlockObject(slackClient.PlainTextType, config.ContextMetadata, false, false),
  • pkg/slack/modals/common/version_views.go#L344-L349: Replace the struct literal with Text: slackClient.NewTextBlockObject(slackClient.PlainTextType, "There are too many results from the selected Stream. Select a Major.Minor as well", false, false),
  • pkg/slack/modals/common/version_views.go#L373-L378: Replace the struct literal with slackClient.NewTextBlockObject(slackClient.PlainTextType, config.ContextMetadata, false, false),
  • pkg/slack/modals/common/version_views.go#L404-L409: Replace the struct literal with Text: slackClient.NewTextBlockObject(slackClient.PlainTextType, "Enter A PR", false, false),
  • pkg/slack/modals/common/version_views.go#L428-L433: Replace the struct literal with slackClient.NewTextBlockObject(slackClient.PlainTextType, config.ContextMetadata, false, false),
  • pkg/slack/modals/common/version_views.go#L496-L501: Replace the struct literal with Text: slackClient.NewTextBlockObject(slackClient.PlainTextType, "Do you want to launch from a PR?", false, false),
  • pkg/slack/modals/common/version_views.go#L522-L527: Replace the struct literal with slackClient.NewTextBlockObject(slackClient.PlainTextType, config.ContextMetadata, false, false),
  • pkg/slack/modals/launch/views.go#L46-L51: Replace the struct literal with Text: slackClient.NewTextBlockObject(slackClient.PlainTextType, "Select the Launch Platform and Architecture", false, false),
  • pkg/slack/modals/launch/views.go#L139-L144: Replace the struct literal with slackClient.NewTextBlockObject(slackClient.PlainTextType, context, false, false),
  • pkg/slack/modals/list/views.go#L20-L25: Replace the struct literal with Text: slackClient.NewTextBlockObject(slackClient.PlainTextType, "See who is hogging all the clusters", false, false),
  • pkg/slack/modals/mce/create/views.go#L51-L56: Replace the struct literal with Text: slackClient.NewTextBlockObject(slackClient.PlainTextType, "Select the Launch Platform and Duration", false, false),
  • pkg/slack/modals/mce/create/views.go#L117-L122: Replace the struct literal with slackClient.NewTextBlockObject(slackClient.PlainTextType, context, false, false),
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/slack/modals/common/version_views.go` around lines 107 - 112, Replace
each manual slackClient.TextBlockObject literal with
slackClient.NewTextBlockObject, preserving the existing PlainTextType, text
value, and false/false arguments. Apply this in
pkg/slack/modals/common/version_views.go at lines 107-112, 163-168, 241-246,
270-275, 344-349, 373-378, 404-409, 428-433, 496-501, and 522-527;
pkg/slack/modals/launch/views.go at lines 46-51 and 139-144;
pkg/slack/modals/list/views.go at lines 20-25; and
pkg/slack/modals/mce/create/views.go at lines 51-56 and 117-122.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/slack/events/workflowSubmissionEvents/types.go`:
- Around line 36-43: Remove redundant pointers from WorkflowStepInputs and
WorkflowStepOutput throughout eventWorkflowStep, workflowUpdateStepRequest, and
SaveWorkflowStepConfiguration, using non-pointer map and slice types so nil
values remain safely rangeable. In
pkg/slack/events/workflowSubmissionEvents/workflow_handler.go, remove
dereferences of Inputs and Outputs. In pkg/slack/interactions/router/router.go,
pass input and output values directly and update the slackClient interface
signature to match; apply these changes at types.go lines 36-43, 73-77, and
112-120, workflow_handler.go lines 58-74, 76-116, and 118-144, and router.go
lines 96-101 and 124-127.
- Line 137: Update the defer around resp.Body.Close() to explicitly discard or
handle its returned error, preserving the existing response-body cleanup while
satisfying golangci-lint.
- Line 126: Update the request construction in the client method containing
http.NewRequestWithContext to derive the context with context.WithTimeout
instead of context.Background(), using the appropriate existing or defined
duration and ensuring the cancel function is released. Pass the timed context to
the POST request so unresponsive Slack API calls terminate within the bound.

---

Nitpick comments:
In `@cmd/ci-chat-bot/slack.go`:
- Around line 64-66: Update the http.Server configuration in the server
initialization to include a ReadTimeout that bounds the total request-read
duration, including the body, while preserving the existing ReadHeaderTimeout
setting.

In `@pkg/slack/events/workflowSubmissionEvents/types.go`:
- Line 139: In the response-handling flow around the slackResponse variable,
validate the HTTP response status before attempting JSON decoding. For non-2xx
responses, return a clear error containing the status information and skip
decoding the body; retain the existing JSON decoding path for successful
responses.

In `@pkg/slack/events/workflowSubmissionEvents/workflow_handler.go`:
- Around line 111-115: In the workflow submission handler, simplify the final
client.WorkflowStepCompleted call by returning its result directly instead of
assigning to err, checking it, and explicitly returning nil.

In `@pkg/slack/modals/common/version_views.go`:
- Around line 107-112: Replace each manual slackClient.TextBlockObject literal
with slackClient.NewTextBlockObject, preserving the existing PlainTextType, text
value, and false/false arguments. Apply this in
pkg/slack/modals/common/version_views.go at lines 107-112, 163-168, 241-246,
270-275, 344-349, 373-378, 404-409, 428-433, 496-501, and 522-527;
pkg/slack/modals/launch/views.go at lines 46-51 and 139-144;
pkg/slack/modals/list/views.go at lines 20-25; and
pkg/slack/modals/mce/create/views.go at lines 51-56 and 117-122.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 476b0573-8459-468f-9de0-37e8ba69449c

📥 Commits

Reviewing files that changed from the base of the PR and between 6752288 and 50ae70a.

⛔ Files ignored due to path filters (89)
  • go.sum is excluded by !**/*.sum
  • vendor/github.com/slack-go/slack/.gitignore is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/.golangci.yml is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/CHANGELOG.md is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/CONTRIBUTING.md is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/Makefile is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/README.md is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/TODO.txt is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/admin.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/admin_conversations.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/admin_conversations_ekm.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/admin_conversations_restrictAccess.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/admin_roles.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/admin_teams.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/apps.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/assistant.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/attachments.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/audit.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/auth.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_action.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_alert.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_call.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_card.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_carousel.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_context.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_context_actions.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_conv.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_divider.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_element.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_file.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_header.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_image.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_input.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_json.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_markdown.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_object.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_plan.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_rich_text.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_section.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_table.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_task_card.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_unknown.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/block_video.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/channels.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/chat.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/chat_stream_chunks.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/conversation.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/dialog.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/dnd.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/entity.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/files.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/function_execute.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/huddle.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/im.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/info.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/interactions.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/manifests.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/messages.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/metadata.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/migration.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/misc.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/mise.toml is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/oauth.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/reactions.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/remotefiles.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/retry.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/rtm.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/search.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/security.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/slack.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/slackevents/action_events.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/slackevents/inner_events.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/slackevents/parsers.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/socket_mode.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/stars.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/team.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/usergroups.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/users.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/views.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/webhooks.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/websocket_groups.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/websocket_managed_conn.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/websocket_misc.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/workflow_step.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/workflow_step_execute.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/workflows_featured.go is excluded by !vendor/**
  • vendor/github.com/slack-go/slack/workflows_triggers.go is excluded by !vendor/**
  • vendor/modules.txt is excluded by !vendor/**
📒 Files selected for processing (16)
  • cmd/ci-chat-bot/slack.go
  • go.mod
  • pkg/slack/actions_request_test.go
  • pkg/slack/events/router/router.go
  • pkg/slack/events/workflowSubmissionEvents/types.go
  • pkg/slack/events/workflowSubmissionEvents/workflow_handler.go
  • pkg/slack/interactions/router/router.go
  • pkg/slack/modals/common/simple_modals.go
  • pkg/slack/modals/common/version_views.go
  • pkg/slack/modals/launch/views.go
  • pkg/slack/modals/list/views.go
  • pkg/slack/modals/mce/create/views.go
  • pkg/slack/modals/stepsFromApp/jira_step.go
  • pkg/slack/modals/stepsFromApp/workflow_submit.go
  • pkg/slack/parser/types.go
  • pkg/slack/slack.go

Comment on lines +36 to +43
type eventWorkflowStep struct {
WorkflowStepExecuteID string `json:"workflow_step_execute_id"`
WorkflowID string `json:"workflow_id"`
WorkflowInstanceID string `json:"workflow_instance_id"`
StepID string `json:"step_id"`
Inputs *WorkflowStepInputs `json:"inputs,omitempty"`
Outputs *[]WorkflowStepOutput `json:"outputs,omitempty"`
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🔴 Critical | 🏗️ Heavy lift

Nil-pointer panic hazard: Remove redundant map and slice pointers.

WorkflowStepInputs (a map) and []WorkflowStepOutput (a slice) are being used as pointers. In Go, maps and slices are already reference types, and standard JSON omitempty correctly omits nil maps/slices without requiring pointers. Using pointers here introduces a critical risk: if the optional inputs or outputs fields are omitted in the Slack JSON payload (unmarshaling to nil), the dereferencing operations in workflow_handler.go will cause a runtime panic. Removing the pointers completely resolves the panic hazard because ranging over a nil map or slice is safe in Go.

  • pkg/slack/events/workflowSubmissionEvents/types.go#L36-L43: Change Inputs to WorkflowStepInputs and Outputs to []WorkflowStepOutput (remove the *) in eventWorkflowStep.
  • pkg/slack/events/workflowSubmissionEvents/types.go#L73-L77: Change Inputs to WorkflowStepInputs and Outputs to []WorkflowStepOutput in workflowUpdateStepRequest.
  • pkg/slack/events/workflowSubmissionEvents/types.go#L112-L120: Change the inputs and outputs parameters in SaveWorkflowStepConfiguration to non-pointers.
  • pkg/slack/events/workflowSubmissionEvents/workflow_handler.go#L58-L74: Remove the * dereference from *event.WorkflowStep.Inputs on line 59.
  • pkg/slack/events/workflowSubmissionEvents/workflow_handler.go#L76-L116: Remove the * dereference from *event.WorkflowStep.Outputs on line 103.
  • pkg/slack/events/workflowSubmissionEvents/workflow_handler.go#L118-L144: Remove the * dereference from *event.WorkflowStep.Inputs on line 122.
  • pkg/slack/interactions/router/router.go#L96-L101: Pass input, output directly on line 99 instead of using addresses &input, &output.
  • pkg/slack/interactions/router/router.go#L124-L127: Update the slackClient interface signature to match.
📍 Affects 3 files
  • pkg/slack/events/workflowSubmissionEvents/types.go#L36-L43 (this comment)
  • pkg/slack/events/workflowSubmissionEvents/types.go#L73-L77
  • pkg/slack/events/workflowSubmissionEvents/types.go#L112-L120
  • pkg/slack/events/workflowSubmissionEvents/workflow_handler.go#L58-L74
  • pkg/slack/events/workflowSubmissionEvents/workflow_handler.go#L76-L116
  • pkg/slack/events/workflowSubmissionEvents/workflow_handler.go#L118-L144
  • pkg/slack/interactions/router/router.go#L96-L101
  • pkg/slack/interactions/router/router.go#L124-L127
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/slack/events/workflowSubmissionEvents/types.go` around lines 36 - 43,
Remove redundant pointers from WorkflowStepInputs and WorkflowStepOutput
throughout eventWorkflowStep, workflowUpdateStepRequest, and
SaveWorkflowStepConfiguration, using non-pointer map and slice types so nil
values remain safely rangeable. In
pkg/slack/events/workflowSubmissionEvents/workflow_handler.go, remove
dereferences of Inputs and Outputs. In pkg/slack/interactions/router/router.go,
pass input and output values directly and update the slackClient interface
signature to match; apply these changes at types.go lines 36-43, 73-77, and
112-120, workflow_handler.go lines 58-74, 76-116, and 118-144, and router.go
lines 96-101 and 124-127.

if err != nil {
return err
}
req, err := http.NewRequestWithContext(context.Background(), "POST", c.endpoint+method, bytes.NewReader(body))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Add a timeout to the external API call.

Using context.Background() with http.DefaultClient means the HTTP request has no timeout. If the Slack API is unresponsive, this will block the worker thread indefinitely. Use context.WithTimeout to bound the request duration.

⚡ Proposed fix to add a context timeout
-	req, err := http.NewRequestWithContext(context.Background(), "POST", c.endpoint+method, bytes.NewReader(body))
+	ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
+	defer cancel()
+	req, err := http.NewRequestWithContext(ctx, "POST", c.endpoint+method, bytes.NewReader(body))
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
req, err := http.NewRequestWithContext(context.Background(), "POST", c.endpoint+method, bytes.NewReader(body))
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
req, err := http.NewRequestWithContext(ctx, "POST", c.endpoint+method, bytes.NewReader(body))
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/slack/events/workflowSubmissionEvents/types.go` at line 126, Update the
request construction in the client method containing http.NewRequestWithContext
to derive the context with context.WithTimeout instead of context.Background(),
using the appropriate existing or defined duration and ensuring the cancel
function is released. Pass the timed context to the POST request so unresponsive
Slack API calls terminate within the bound.

if err != nil {
return err
}
defer resp.Body.Close()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Handle or explicitly ignore the resp.Body.Close() error.

As per coding guidelines, code must pass make verify lint. The golangci-lint tool flags the unhandled error from resp.Body.Close(). Explicitly handle or discard it to satisfy the linter and prevent CI failures.

🧹 Proposed fix to explicitly discard the error
-	defer resp.Body.Close()
+	defer func() {
+		_ = resp.Body.Close()
+	}()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
defer resp.Body.Close()
defer func() {
_ = resp.Body.Close()
}()
🧰 Tools
🪛 golangci-lint (2.12.2)

[error] 137-137: Error return value of resp.Body.Close is not checked

(errcheck)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/slack/events/workflowSubmissionEvents/types.go` at line 137, Update the
defer around resp.Body.Close() to explicitly discard or handle its returned
error, preserving the existing response-body cleanup while satisfying
golangci-lint.

Sources: Coding guidelines, Linters/SAST tools

@openshift-ci

openshift-ci Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@thiagoalessio: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/lint 50ae70a link true /test lint
ci/prow/fix 50ae70a link true /test fix

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants