Skip to content

Add Rocket.Chat provider - #545

Open
mdiniz97 wants to merge 2 commits into
projectdiscovery:devfrom
mdiniz97:feat/rocketchat-provider
Open

Add Rocket.Chat provider#545
mdiniz97 wants to merge 2 commits into
projectdiscovery:devfrom
mdiniz97:feat/rocketchat-provider

Conversation

@mdiniz97

@mdiniz97 mdiniz97 commented Aug 1, 2026

Copy link
Copy Markdown

Summary

  • Adds a new rocketchat notify provider using Rocket.Chat Incoming Webhooks
  • Configurable channel, username (alias), avatar and emoji
  • Supports plain-text messages and attachment-based messages (rocketchat_attachment)
  • Automatically splits messages larger than Rocket.Chat's default max message size (5000 chars), breaking on line boundaries where possible
  • Unit tests covering ID filtering, payload building, attachment mode, invalid webhook URL, non-2xx responses, and message splitting

Example config

rocketchat:
  - id: "soc"
    rocketchat_webhook_url: "https://chat.example.com/hooks/XXXXXXXX"
    rocketchat_channel: "#alertas-seguranca"
    rocketchat_username: "ProjectDiscovery"
nuclei -u https://example.com | notify -provider rocketchat

Summary by CodeRabbit

  • New Features
    • Added Notion as a notification provider for database pages and optional in-page titles.
    • Added Rocket.Chat notifications with configurable webhooks, channels, sender identity, formatting, attachments, and message splitting.
    • Slack notifications now support optional custom emojis.
    • First-run setup can create a starter provider configuration automatically.
  • Bug Fixes
    • Invalid webhook URLs and failed delivery responses are detected and reported.
  • Documentation
    • Updated Slack and Telegram configuration examples.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Adds Notion and Rocket.Chat providers, changes Slack webhook delivery to direct HTTP, improves runner configuration initialization, updates HTTP and dependency handling, and removes the integration-test harness.

Changes

Provider integrations

Layer / File(s) Summary
Provider contracts and registration
pkg/providers/notion/*, pkg/providers/rocketchat/*, pkg/providers/providers.go
Adds Notion and Rocket.Chat configuration, payload types, API delivery, destination filtering, and provider registration.
Rocket.Chat delivery and message handling
pkg/providers/rocketchat/rocketchat.go
Sends validated webhook payloads, supports attachments, aggregates errors, and splits oversized UTF-8 messages.
Rocket.Chat behavior tests
pkg/providers/rocketchat/rocketchat_test.go
Covers filtering, payloads, HTTP failures, cancellation, response-body errors, and message splitting.

Slack webhook delivery

Layer / File(s) Summary
Direct Slack webhook delivery
pkg/providers/slack/slack.go, README.md
Replaces Shoutrrr webhook delivery with direct HTTP POST requests and adds emoji configuration examples.

Runner configuration

Layer / File(s) Summary
Provider configuration initialization
internal/runner/runner.go, internal/runner/runner_test.go
Creates a default configuration template, rejects missing explicit paths, and accepts empty or comment-only files.

Maintenance and cleanup

Layer / File(s) Summary
HTTP client and module updates
pkg/utils/httpreq/httpreq.go, go.mod
Adds a 10-second client timeout, updates response-body cleanup, and refreshes dependencies.
Integration-test harness removal
cmd/integration-test/*, internal/testutils/integration.go
Removes integration-test scripts, entrypoints, provider handlers, and shared test helpers.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Notify
  participant ProviderRegistry
  participant Notion
  participant RocketChat
  participant ExternalService
  Notify->>ProviderRegistry: Initialize configured providers
  ProviderRegistry->>Notion: Register selected destinations
  ProviderRegistry->>RocketChat: Register selected destinations
  Notion->>ExternalService: Create database page
  RocketChat->>ExternalService: POST webhook payload
  ExternalService-->>Notion: Return API response
  ExternalService-->>RocketChat: Return HTTP status
Loading

Possibly related PRs

Poem

A rabbit sends messages through the night,
Notion pages bloom, Rocket.Chat takes flight.
Slack posts JSON, neat and clear,
Config files appear when first-run is near.
“Hop!” says the rabbit, “the tests all agree!”

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.25% 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
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the primary change: adding the Rocket.Chat notification provider.
✨ 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.

@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

🤖 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/providers/rocketchat/rocketchat.go`:
- Around line 52-88: Update Provider.Send to track whether any chunk fails for
each provider, resetting the flag at the start of each Rocketchat provider
iteration and setting it when send returns an error; emit the existing success
log only when that provider’s chunks all succeed, while preserving error
accumulation and continuation behavior.
- Around line 90-106: Update send to avoid http.Post by creating a context-aware
POST request and executing it with an HTTP client configured with a finite
timeout. Preserve the existing JSON payload and non-success status handling, use
Client.Do with NewRequestWithContext, and handle any error from resp.Body.Close
so the noctx and errcheck findings are resolved.
- Around line 108-145: Update splitMessage to measure message and line lengths
in runes and slice via rune boundaries, ensuring multi-byte UTF-8 characters are
never split while preserving the existing newline-aware chunking behavior. Add a
multi-byte content case, such as emoji or accented text, to TestSplitMessage
covering correct chunk contents and limits.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 40375ab7-7eb5-47a4-a607-250ab571bfed

📥 Commits

Reviewing files that changed from the base of the PR and between 2d6ef20 and cea9538.

📒 Files selected for processing (4)
  • pkg/providers/providers.go
  • pkg/providers/rocketchat/rocketchat.go
  • pkg/providers/rocketchat/rocketchat_test.go
  • pkg/providers/rocketchat/rocketchat_types.go

Comment thread pkg/providers/rocketchat/rocketchat.go
Comment thread pkg/providers/rocketchat/rocketchat.go
Comment thread pkg/providers/rocketchat/rocketchat.go
Adds a new notify provider for Rocket.Chat Incoming Webhooks, supporting
configurable channel, username (alias), avatar and emoji, plain-text or
attachment-based messages, and automatic splitting of messages larger
than Rocket.Chat's default max message size.
Use bounded HTTP requests, preserve UTF-8 message chunks, and avoid reporting success after partial delivery failures.
@mdiniz97
mdiniz97 force-pushed the feat/rocketchat-provider branch from cea9538 to 59e9d3b Compare August 3, 2026 14:25
@mdiniz97
mdiniz97 changed the base branch from main to dev August 3, 2026 14:25

@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: 5

🧹 Nitpick comments (1)
pkg/providers/notion/notion.go (1)

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

Use "ID" instead of "Id" for initialisms in exported field names. Both sites introduce a new struct field ending in "Id" instead of the Go convention "ID", and notion.go's Options struct now mixes both conventions in the same declaration (ID at line 20 vs NotionDatabaseId at line 22).

  • pkg/providers/notion/notion.go#L19-L24: rename NotionDatabaseId to NotionDatabaseID for consistency with the sibling ID field; keep the yaml:"notion_database_id,omitempty" tag unchanged.
  • pkg/providers/notion/notion_types.go#L1-L21: rename Page.ParentId to Page.ParentID; keep the json:"parent_id" tag unchanged, and update the one usage in pkg/providers/notion/notion_api.go (page.ParentId) accordingly.
🤖 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/providers/notion/notion.go` around lines 19 - 24, Rename
Options.NotionDatabaseId to NotionDatabaseID in pkg/providers/notion/notion.go,
preserving the existing YAML tag. Rename Page.ParentId to ParentID in
pkg/providers/notion/notion_types.go, preserve its JSON tag, and update the
page.ParentId usage in pkg/providers/notion/notion_api.go to page.ParentID.
🤖 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 `@go.mod`:
- Line 96: Update the golang.org/x/crypto dependency in go.mod from v0.46.0 to
v0.52.0, then refresh the Go module graph so go.sum and any indirect dependency
versions remain consistent.

In `@internal/runner/runner.go`:
- Around line 66-70: Update the os.WriteFile error branch in the runner
initialization flow to return the writeErr, wrapped with the surrounding
operation context, instead of logging the warning and continuing. Preserve the
existing success logging in the else branch so NewRunner cannot succeed with an
incomplete provider configuration.

In `@pkg/providers/notion/notion_api.go`:
- Around line 28-36: Update the response handling after httpreq.NewClient().Post
in the Notion request flow to check whether response is non-nil before accessing
response.Object or response.Message. Only validate the Notion response fields
when a decoded response exists, while preserving the existing error return for
non-page responses.

In `@pkg/providers/notion/notion.go`:
- Around line 53-58: Update the error branch in the CreatePage call to rename
success to an error-appropriate variable and wrap that underlying error with the
existing ID context before appending it to NotionErr. Remove the generic
fmt.Errorf that discards the CreatePage failure details, while preserving the
continue behavior.

In `@pkg/providers/slack/slack.go`:
- Around line 101-105: Update the Slack webhook request in Provider.Send to use
an http.Client with a 10-second timeout instead of the implicit http.Post
client; if Send accepts a context.Context, build the request with that context
and execute it via the client’s Do method, while preserving the existing error
wrapping and multierr handling.

---

Nitpick comments:
In `@pkg/providers/notion/notion.go`:
- Around line 19-24: Rename Options.NotionDatabaseId to NotionDatabaseID in
pkg/providers/notion/notion.go, preserving the existing YAML tag. Rename
Page.ParentId to ParentID in pkg/providers/notion/notion_types.go, preserve its
JSON tag, and update the page.ParentId usage in
pkg/providers/notion/notion_api.go to page.ParentID.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e4ff7ff7-c37c-4f6b-b76a-63a91189f796

📥 Commits

Reviewing files that changed from the base of the PR and between cea9538 and 59e9d3b.

⛔ Files ignored due to path filters (9)
  • .github/workflows/build-test.yml is excluded by !**/*.yml
  • .github/workflows/codeql-analysis.yml is excluded by !**/*.yml
  • .github/workflows/dockerhub-push.yml is excluded by !**/*.yml
  • .github/workflows/lint-test.yml is excluded by !**/*.yml
  • .github/workflows/release-binary.yml is excluded by !**/*.yml
  • .github/workflows/release-test.yml is excluded by !**/*.yml
  • .goreleaser.yml is excluded by !**/*.yml
  • cmd/integration-test/test-config.yaml is excluded by !**/*.yaml
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (19)
  • README.md
  • cmd/integration-test/action-run.sh
  • cmd/integration-test/gotify.sh
  • cmd/integration-test/integration.go
  • cmd/integration-test/providers.go
  • cmd/integration-test/run.sh
  • go.mod
  • internal/runner/runner.go
  • internal/runner/runner_test.go
  • internal/testutils/integration.go
  • pkg/providers/notion/notion.go
  • pkg/providers/notion/notion_api.go
  • pkg/providers/notion/notion_types.go
  • pkg/providers/providers.go
  • pkg/providers/rocketchat/rocketchat.go
  • pkg/providers/rocketchat/rocketchat_test.go
  • pkg/providers/rocketchat/rocketchat_types.go
  • pkg/providers/slack/slack.go
  • pkg/utils/httpreq/httpreq.go
💤 Files with no reviewable changes (6)
  • cmd/integration-test/gotify.sh
  • cmd/integration-test/action-run.sh
  • cmd/integration-test/run.sh
  • cmd/integration-test/providers.go
  • internal/testutils/integration.go
  • cmd/integration-test/integration.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/providers/rocketchat/rocketchat_types.go
  • pkg/providers/rocketchat/rocketchat.go

@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.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 5

🧹 Nitpick comments (1)
pkg/providers/notion/notion.go (1)

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

Use "ID" instead of "Id" for initialisms in exported field names. Both sites introduce a new struct field ending in "Id" instead of the Go convention "ID", and notion.go's Options struct now mixes both conventions in the same declaration (ID at line 20 vs NotionDatabaseId at line 22).

  • pkg/providers/notion/notion.go#L19-L24: rename NotionDatabaseId to NotionDatabaseID for consistency with the sibling ID field; keep the yaml:"notion_database_id,omitempty" tag unchanged.
  • pkg/providers/notion/notion_types.go#L1-L21: rename Page.ParentId to Page.ParentID; keep the json:"parent_id" tag unchanged, and update the one usage in pkg/providers/notion/notion_api.go (page.ParentId) accordingly.
🤖 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/providers/notion/notion.go` around lines 19 - 24, Rename
Options.NotionDatabaseId to NotionDatabaseID in pkg/providers/notion/notion.go,
preserving the existing YAML tag. Rename Page.ParentId to ParentID in
pkg/providers/notion/notion_types.go, preserve its JSON tag, and update the
page.ParentId usage in pkg/providers/notion/notion_api.go to page.ParentID.
🤖 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 `@go.mod`:
- Line 96: Update the golang.org/x/crypto dependency in go.mod from v0.46.0 to
v0.52.0, then refresh the Go module graph so go.sum and any indirect dependency
versions remain consistent.

In `@internal/runner/runner.go`:
- Around line 66-70: Update the os.WriteFile error branch in the runner
initialization flow to return the writeErr, wrapped with the surrounding
operation context, instead of logging the warning and continuing. Preserve the
existing success logging in the else branch so NewRunner cannot succeed with an
incomplete provider configuration.

In `@pkg/providers/notion/notion_api.go`:
- Around line 28-36: Update the response handling after httpreq.NewClient().Post
in the Notion request flow to check whether response is non-nil before accessing
response.Object or response.Message. Only validate the Notion response fields
when a decoded response exists, while preserving the existing error return for
non-page responses.

In `@pkg/providers/notion/notion.go`:
- Around line 53-58: Update the error branch in the CreatePage call to rename
success to an error-appropriate variable and wrap that underlying error with the
existing ID context before appending it to NotionErr. Remove the generic
fmt.Errorf that discards the CreatePage failure details, while preserving the
continue behavior.

In `@pkg/providers/slack/slack.go`:
- Around line 101-105: Update the Slack webhook request in Provider.Send to use
an http.Client with a 10-second timeout instead of the implicit http.Post
client; if Send accepts a context.Context, build the request with that context
and execute it via the client’s Do method, while preserving the existing error
wrapping and multierr handling.

---

Nitpick comments:
In `@pkg/providers/notion/notion.go`:
- Around line 19-24: Rename Options.NotionDatabaseId to NotionDatabaseID in
pkg/providers/notion/notion.go, preserving the existing YAML tag. Rename
Page.ParentId to ParentID in pkg/providers/notion/notion_types.go, preserve its
JSON tag, and update the page.ParentId usage in
pkg/providers/notion/notion_api.go to page.ParentID.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e4ff7ff7-c37c-4f6b-b76a-63a91189f796

📥 Commits

Reviewing files that changed from the base of the PR and between cea9538 and 59e9d3b.

⛔ Files ignored due to path filters (9)
  • .github/workflows/build-test.yml is excluded by !**/*.yml
  • .github/workflows/codeql-analysis.yml is excluded by !**/*.yml
  • .github/workflows/dockerhub-push.yml is excluded by !**/*.yml
  • .github/workflows/lint-test.yml is excluded by !**/*.yml
  • .github/workflows/release-binary.yml is excluded by !**/*.yml
  • .github/workflows/release-test.yml is excluded by !**/*.yml
  • .goreleaser.yml is excluded by !**/*.yml
  • cmd/integration-test/test-config.yaml is excluded by !**/*.yaml
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (19)
  • README.md
  • cmd/integration-test/action-run.sh
  • cmd/integration-test/gotify.sh
  • cmd/integration-test/integration.go
  • cmd/integration-test/providers.go
  • cmd/integration-test/run.sh
  • go.mod
  • internal/runner/runner.go
  • internal/runner/runner_test.go
  • internal/testutils/integration.go
  • pkg/providers/notion/notion.go
  • pkg/providers/notion/notion_api.go
  • pkg/providers/notion/notion_types.go
  • pkg/providers/providers.go
  • pkg/providers/rocketchat/rocketchat.go
  • pkg/providers/rocketchat/rocketchat_test.go
  • pkg/providers/rocketchat/rocketchat_types.go
  • pkg/providers/slack/slack.go
  • pkg/utils/httpreq/httpreq.go
💤 Files with no reviewable changes (6)
  • cmd/integration-test/gotify.sh
  • cmd/integration-test/action-run.sh
  • cmd/integration-test/run.sh
  • cmd/integration-test/providers.go
  • internal/testutils/integration.go
  • cmd/integration-test/integration.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/providers/rocketchat/rocketchat_types.go
  • pkg/providers/rocketchat/rocketchat.go
🛑 Comments failed to post (5)
go.mod (1)

96-96: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

curl -sS https://api.osv.dev/v1/query \
  -H 'Content-Type: application/json' \
  -d '{"package":{"ecosystem":"Go","name":"golang.org/x/crypto"},"version":"v0.46.0"}' |
  jq '{vulnerabilities: [.vulns[] | {id, summary, modified, affected}]}'

Repository: projectdiscovery/notify

Length of output: 30296


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf 'go.mod crypto line:\n'
rg -n 'golang.org/x/crypto' go.mod || true

printf '\nmodule graph references mentioning ssh/agent/openpgp:\n'
rg -n '"golang.org/x/crypto/(ssh/(agent|knownhosts)|openpgp)' -g '*.go' . || true

printf '\nmodule availability summary:\n'
version='v0.52.0'
echo "module golang.org/x/crypto $version" > /tmp/mod_check.go.mod
go get -modfile=/tmp/mod_check.go.mod golang.org/x/crypto@$version 2>&1 || true
rm -f /tmp/mod_check.go.sum /tmp/mod_check.go.mod

Repository: projectdiscovery/notify

Length of output: 403


🌐 Web query:

golang.org/x/crypto v0.52.0 module go proxy

💡 Result:

The module golang.org/x/crypto version v0.52.0 is a legitimate, tagged release of the Go supplementary cryptography library [1][2]. It was published to address specific security vulnerabilities [3]. You can retrieve and use this version through the standard Go module proxy (proxy.golang.org) by running the following command in your terminal: go get golang.org/x/crypto@v0.52.0 As an official part of the Go project's "x" (extended) repository, it is indexed and served by the Go module proxy, which provides an immutable, reliable source for Go modules [4][5]. As of August 3, 2026, newer versions (such as v0.54.0 and later) are also available, but v0.52.0 remains accessible via the proxy [4][6][7].

Citations:


Upgrade golang.org/x/crypto to a fixed version.

golang.org/x/crypto v0.46.0 is affected by multiple advisories fixed in v0.52.0, including SSH key enforcement and FIDO/U2F checks. Update the dependency and refresh the module graph.

🧰 Tools
🪛 OSV Scanner (2.4.0)

[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: Invoking key constraints not enforced in golang.org/x/crypto/ssh/agent

(GO-2026-5005)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: Invoking agent constraints dropped when forwarding keys in golang.org/x/crypto/ssh/agent

(GO-2026-5006)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: Invoking byte arithmetic causes underflow and panic in golang.org/x/crypto/ssh

(GO-2026-5013)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: Invoking bypass of certificate restrictions in golang.org/x/crypto/ssh

(GO-2026-5014)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: Invoking server panic during CheckHostKey/Authenticate in golang.org/x/crypto/ssh

(GO-2026-5015)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: Invoking memory leak when rejecting channels can lead to DoS in golang.org/x/crypto/ssh

(GO-2026-5016)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: Invoking client can cause server deadlock on unexpected responses in golang.org/x/crypto/ssh

(GO-2026-5017)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: Invoking pathological RSA/DSA parameters may cause DoS in golang.org/x/crypto/ssh

(GO-2026-5018)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: Invoking bypass of FIDO/U2F security keys physical interaction in golang.org/x/crypto/ssh

(GO-2026-5019)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: Invoking infinite loop on large channel writes in golang.org/x/crypto/ssh

(GO-2026-5020)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: Invoking auth bypass via unenforced @revoked status in golang.org/x/crypto/ssh/knownhosts

(GO-2026-5021)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: Invoking VerifiedPublicKeyCallback permissions skip enforcement in golang.org/x/crypto/ssh

(GO-2026-5023)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: Invoking pathological inputs can lead to client panic in golang.org/x/crypto/ssh/agent

(GO-2026-5033)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: The golang.org/x/crypto/openpgp package is unmaintained, unsafe by design, and has known security issues

(GO-2026-5932)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: golang.org/x/crypto vulnerable to invoking bypass of certificate restrictions

(GHSA-45gg-vh54-h5m9)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: golang.org/x/crypto vulnerable to auth bypass via unenforced @revoked status

(GHSA-5cgq-3rg8-m6cv)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: golang.org/x/crypto is vulnerable to invoking server panic during CheckHostKey/Authenticate flow

(GHSA-78mq-xcr3-xm33)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: golang.org/x/crypto: FIDO/U2F security key physical presence check can be bypassed

(GHSA-89gr-r52h-f8rx)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: golang.org/x/crypto: Invoking pathological inputs can lead to client panic

(GHSA-9m57-25v3-79x9)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: golang.org/x/crypto doesn't drop invoking agent constraints when forwarding keys

(GHSA-f5wc-c3c7-36mc)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: golang.org/x/crypto doesn't enforce invoking key constraints

(GHSA-jppx-rxg9-jmrx)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: golang.org/x/crypto: Invoking byte arithmetic causes underflow and panic

(GHSA-q4h4-gmj2-qvw2)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: golang.org/x/crypto: Invoking memory leak when rejecting channels can lead to DoS

(GHSA-qpw4-5x99-6vjp)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: golang.org/x/crypto vulnerable to infinite loop on large channel writes

(GHSA-rm3j-f69w-wqmq)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: golang.org/x/crypto: Invoking client can cause server deadlock on unexpected responses

(GHSA-vgwf-h737-ff37)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: golang.org/x/crypto: Invoking pathological RSA/DSA parameters may cause DoS

(GHSA-w879-237q-wc7r)


[CRITICAL] 96-96: golang.org/x/crypto 0.46.0: golang.org/x/crypto: Invoking VerifiedPublicKeyCallback permissions skip enforcement

(GHSA-x527-x647-q7gg)

🤖 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 `@go.mod` at line 96, Update the golang.org/x/crypto dependency in go.mod from
v0.46.0 to v0.52.0, then refresh the Go module graph so go.sum and any indirect
dependency versions remain consistent.

Source: Linters/SAST tools

internal/runner/runner.go (1)

66-70: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Return template write errors.

If os.WriteFile fails after a partial write, the file can still contain only comments. Lines 81-84 then accept the file, and NewRunner can return success with no configured providers. Return the wrapped writeErr instead of continuing.

Proposed fix
 		if writeErr := os.WriteFile(options.ProviderConfig, []byte(defaultConfig), 0600); writeErr != nil {
-			gologger.Warning().Msgf("Could not create default provider config at %s: %s\n", options.ProviderConfig, writeErr)
+			return nil, errors.Wrap(writeErr, "could not create default provider config")
 		} else {
 			gologger.Info().Msgf("Created default provider config at %s — please add your provider credentials.\n", options.ProviderConfig)
 		}
📝 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.

		if writeErr := os.WriteFile(options.ProviderConfig, []byte(defaultConfig), 0600); writeErr != nil {
			return nil, errors.Wrap(writeErr, "could not create default provider config")
		} else {
			gologger.Info().Msgf("Created default provider config at %s — please add your provider credentials.\n", options.ProviderConfig)
		}
🤖 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 `@internal/runner/runner.go` around lines 66 - 70, Update the os.WriteFile
error branch in the runner initialization flow to return the writeErr, wrapped
with the surrounding operation context, instead of logging the warning and
continuing. Preserve the existing success logging in the else branch so
NewRunner cannot succeed with an incomplete provider configuration.
pkg/providers/notion/notion_api.go (1)

28-36: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Inspect httpreq.Post to confirm decode-on-nil-error behavior.
fd -a 'httpreq.go' pkg/utils/httpreq
rg -n -B2 -A40 'func.*Post' pkg/utils/httpreq/httpreq.go

Repository: projectdiscovery/notify

Length of output: 1115


Decode non-empty responses before checking the Notion response fields.

Post always decodes the response when the request succeeds, but empty response bodies still pass back nil error. Add an explicit response-body check and only validate response.Object when the decoded body is non-empty to avoid a nil Response dereference.

🤖 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/providers/notion/notion_api.go` around lines 28 - 36, Update the response
handling after httpreq.NewClient().Post in the Notion request flow to check
whether response is non-nil before accessing response.Object or
response.Message. Only validate the Notion response fields when a decoded
response exists, while preserving the existing error return for non-page
responses.
pkg/providers/notion/notion.go (1)

53-58: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Do not discard the underlying error from CreatePage.

success holds the actual error returned by pr.CreatePage(newPage), which can contain the Notion API failure message (see notion_api.go line 35: "error while sending notion message: %s ") or a network error. The code replaces it with a new, generic fmt.Errorf("failed to send notion notification") and discards success entirely. This removes all diagnostic detail needed to debug a failed send.

Wrap the actual error instead of creating a new one, and rename the misleadingly-named success variable, since it holds an error, not a success flag.

🐛 Proposed fix to preserve the underlying error
-		if success := pr.CreatePage(newPage); success != nil {
-			err := errors.Wrap(fmt.Errorf("failed to send notion notification"),
-				fmt.Sprintf("failed to send notion notification for id: %s", pr.ID))
-			NotionErr = multierr.Append(NotionErr, err)
-			continue
-		}
+		if err := pr.CreatePage(newPage); err != nil {
+			wrappedErr := errors.Wrap(err, fmt.Sprintf("failed to send notion notification for id: %s", pr.ID))
+			NotionErr = multierr.Append(NotionErr, wrappedErr)
+			continue
+		}
📝 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.

		if err := pr.CreatePage(newPage); err != nil {
			wrappedErr := errors.Wrap(err, fmt.Sprintf("failed to send notion notification for id: %s", pr.ID))
			NotionErr = multierr.Append(NotionErr, wrappedErr)
			continue
		}
🤖 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/providers/notion/notion.go` around lines 53 - 58, Update the error branch
in the CreatePage call to rename success to an error-appropriate variable and
wrap that underlying error with the existing ID context before appending it to
NotionErr. Remove the generic fmt.Errorf that discards the CreatePage failure
details, while preserving the continue behavior.
pkg/providers/slack/slack.go (1)

101-105: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the provider Send contract and its callers before adding context propagation.
ast-grep outline pkg/providers/slack/slack.go --items all
rg -n -C 4 --type go 'func \(p \*Provider\) Send\(|\.Send\(' .

Repository: projectdiscovery/notify

Length of output: 16126


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== slack provider =="
cat -n pkg/providers/slack/slack.go | sed -n '1,140p'

echo "== providers interface and Send aggregation =="
cat -n pkg/providers/providers.go | sed -n '1,220p'

echo "== runner Send path =="
cat -n internal/runner/runner.go | sed -n '130,195p'

echo "== http utility clients/defaults =="
fd -a httpreq.go pkg/util pkg/utils . | sed 's#^\./##' | xargs -r -n1 sh -c 'echo "--- $0"; cat -n "$0" | sed -n "1,180p"'

echo "== search for Client default / HTTP client uses =="
rg -n --type go 'http\.Client|Client:|Do\(|Timeout:' .

Repository: projectdiscovery/notify

Length of output: 18859


Bound the Slack webhook request duration.

http.Post uses the implicit client, which has no timeout; a stalled Slack webhook can block Provider.Send. Use a 10-second http.Client for this request. If Provider.Send can accept a context.Context, create the request with that context and call Do.

🧰 Tools
🪛 golangci-lint (2.12.2)

[error] 101-101: net/http.Post must not be called. use net/http.NewRequestWithContext and (*net/http.Client).Do(*http.Request)

(noctx)

🤖 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/providers/slack/slack.go` around lines 101 - 105, Update the Slack
webhook request in Provider.Send to use an http.Client with a 10-second timeout
instead of the implicit http.Post client; if Send accepts a context.Context,
build the request with that context and execute it via the client’s Do method,
while preserving the existing error wrapping and multierr handling.

Source: Linters/SAST tools

@mdiniz97

mdiniz97 commented Aug 3, 2026

Copy link
Copy Markdown
Author

Rebased PR onto dev and fixed the Rocket.Chat review findings. The new workflows are waiting for fork approval; could someone approve and run them? @ehsandeep

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.

1 participant