Skip to content

Conversation

@0xfurai
Copy link
Owner

@0xfurai 0xfurai commented Dec 30, 2025

…ting validation rules for Webhook URL and Channel requirements


Note

Introduces Bot Token-based Slack messaging alongside existing webhooks and aligns validations and UI.

  • Server: SlackConfig now accepts slack_bot_token and makes slack_webhook_url optional; Validate enforces either webhook or bot token and requires slack_channel when using a bot token; Send posts to Slack chat.postMessage with Authorization: Bearer <token> when a token is provided, otherwise uses the webhook; improves logs and error messages.
  • Web: slack-form adds slack_bot_token field, splits schema into baseSchema (for discriminated union) and refined schema enforcing the same rules; removes hard-required webhook UI markers; adds help links and notes; create-edit-notification-channel switches union to SlackForm.baseSchema.
  • i18n: Adds new Slack Bot Token labels/descriptions/notes across locales.

Written by Cursor Bugbot for commit d5b80d9. This will update automatically on new commits. Configure here.

…ting validation rules for Webhook URL and Channel requirements
@0xfurai 0xfurai self-assigned this Dec 30, 2025
@netlify
Copy link

netlify bot commented Dec 30, 2025

Deploy Preview for peekaping ready!

Name Link
🔨 Latest commit d5b80d9
🔍 Latest deploy log https://app.netlify.com/projects/peekaping/deploys/695350e4a01362000886f8b2
😎 Deploy Preview https://deploy-preview-248--peekaping.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Dec 30, 2025

Deploy Preview for docspeekaping ready!

Name Link
🔨 Latest commit d5b80d9
🔍 Latest deploy log https://app.netlify.com/projects/docspeekaping/deploys/695350e4da2e5a0008de6c7a
😎 Deploy Preview https://deploy-preview-248--docspeekaping.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

// Use Slack API if BotToken is provided, otherwise use webhook
if cfg.BotToken != "" {
fmt.Println("cfg.BotToken", cfg.BotToken)
fmt.Println("jsonPayload", string(jsonPayload))
Copy link

Choose a reason for hiding this comment

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

Debug statements leak bot token to stdout

Two fmt.Println statements print the cfg.BotToken and jsonPayload to stdout. This exposes the Slack bot token (a sensitive authentication credential) in logs/console output. These appear to be leftover debug statements that were accidentally committed and pose a security risk in production.

Fix in Cursor Fix in Web

TelegramForm.schema,
WebhookForm.schema,
SlackForm.schema,
SlackForm.baseSchema,
Copy link

Choose a reason for hiding this comment

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

Slack form validation refinements not applied

The discriminated union uses SlackForm.baseSchema instead of SlackForm.schema, so the .refine() validations never run on the frontend. Users won't see client-side validation errors for the requirements that either webhook URL or bot token must be provided, nor that channel is required when using bot token. Forms will submit without these validations, only failing at the backend.

Additional Locations (1)

Fix in Cursor Fix in Web

// Check response status
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return fmt.Errorf("Slack webhook returned status: %s", resp.Status)
return fmt.Errorf("Slack API returned status: %s", resp.Status)
Copy link

Choose a reason for hiding this comment

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

Slack API errors not detected due to HTTP 200 response

The Slack Web API (chat.postMessage) returns HTTP 200 for most errors, with {"ok": false, "error": "..."} in the response body. The code only checks HTTP status codes, so API-level errors like invalid tokens, missing permissions, or invalid channels will be silently treated as success. The function will return nil and log "Slack message sent successfully" even when the message failed to send. The response body needs to be parsed to check the ok field.

Fix in Cursor Fix in Web

@codecov
Copy link

codecov bot commented Dec 30, 2025

Codecov Report

❌ Patch coverage is 0% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 21.31%. Comparing base (ac2ee2a) to head (d5b80d9).

Files with missing lines Patch % Lines
...al/modules/notification_channel/providers/slack.go 0.00% 25 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #248      +/-   ##
==========================================
- Coverage   21.33%   21.31%   -0.03%     
==========================================
  Files         199      199              
  Lines       16129    16147      +18     
==========================================
  Hits         3441     3441              
- Misses      12468    12486      +18     
  Partials      220      220              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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