Skip to content

fix(tools): preserve configured content_types in GithubSearchTool (#8888) - #8909

Open
21-aakash wants to merge 1 commit into
crewAIInc:mainfrom
21-aakash:fix/github-search-tool-content-types
Open

21-aakash wants to merge 1 commit into
crewAIInc:mainfrom
21-aakash:fix/github-search-tool-content-types

Conversation

@21-aakash

@21-aakash 21-aakash commented Nov 1, 2026 •

Copy link
Copy Markdown

Fixes #8888

Summary

When GithubSearchTool is instantiated as a dynamic tool with custom content_types (e.g. content_types=['repo']), content_types was accepted in __init__ but not forwarded to super().__init__(**kwargs). As a result, the Pydantic field defaulted to ['code', 'repo', 'pr', 'issue'], causing subsequent searches to unexpectedly index PRs and issues.

Changes

  • Forward content_types into kwargs in GithubSearchTool.__init__ so Pydantic retains the configured value.
  • When github_repo is fixed at init, pass self.content_types instead of requiring both parameters to be explicitly truthy.
  • Added regression test asserting that a tool built with content_types=['repo'] passes ['repo'] to the adapter on add(repo=...).

Note

Low Risk
Narrow initialization fix in GithubSearchTool with a regression test; no auth or data-path changes beyond correct metadata for GitHub indexing.

Overview
Fixes a bug where GithubSearchTool ignored content_types passed at construction on dynamic tools (no fixed github_repo), so indexing still used the default mix of code, repo, PRs, and issues.

__init__ now puts content_types into kwargs before super().__init__, so the Pydantic field keeps the caller’s value. When a repo is fixed at init, add runs whenever github_repo is set and passes self.content_types instead of requiring both repo and an explicit content_types argument.

A regression test checks that a tool built with content_types=['repo'] sends ['repo'] in adapter metadata on add(repo=...).

Reviewed by Cursor Bugbot for commit c5e037b. Bugbot is set up for automated code reviews on this repo. Configure here.

@strix-security

strix-security Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Strix Security Review

✅ No open security findings.

PR summary: Fixes GithubSearchTool so a `content_types` list passed to the constructor is actually retained on the tool instead of falling back to the default set, and applies that configured value when a repository is fixed at init time, with a regression test.

Review summary

Reviewed the four changed lines in GithubSearchTool.__init__ and the added regression test. The change only forwards a caller-supplied content_types list into the Pydantic initializer and uses the instance's own value when a repo is pinned at construction. Traced the value end to end: it lands in the RAG adapter metadata and is consumed by GitHubLoader solely through in membership checks, so no untrusted value reaches a query, command, path, or URL. No authentication or validation control was removed, and the newly reachable add() call is driven by a developer-supplied constructor argument, not attacker input. No security issues found in this diff.

Review 1 on this PR · c5e037b · requested Nov 1 10:55 UTC when the PR was opened


Reviewed by Strix
Re-run review · Configure security review settings

This branch has not been deployed

No deployments
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.

[BUG] GithubSearchTool ignores content_types configured at construction

1 participant