Skip to content

Add MCP Config Settings - #106

Merged
mergify[bot] merged 31 commits into
mainfrom
fix-langgraph
Aug 6, 2025
Merged

Add MCP Config Settings#106
mergify[bot] merged 31 commits into
mainfrom
fix-langgraph

Conversation

@MH0386

@MH0386 MH0386 commented Aug 4, 2025

Copy link
Copy Markdown
Contributor

Summary by Sourcery

Introduce file-based configuration for MCP settings and unify MCP endpoint definitions, simplify default URL assignments, and add error handling for MCP tool loading in the graph builder.

New Features:

  • Add MCPSettings.path field to load MCP connection configurations from a JSON file.

Enhancements:

  • Replace separate voice and video MCP endpoints with a single generic mcp setting in global settings.
  • Add Pydantic validators to ensure the MCP config file has a .json extension and optionally parse its content.
  • Simplify default Redis and vector database URLs to plain strings.
  • Catch and log exceptions when fetching tools from the MCP client to return an empty list if MCP is unavailable.

Copilot AI review requested due to automatic review settings August 4, 2025 17:51
@gitnotebooks

gitnotebooks Bot commented Aug 4, 2025

Copy link
Copy Markdown

@sourcery-ai

sourcery-ai Bot commented Aug 4, 2025

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Refactors settings to support JSON-based MCP configuration via a file path with validation, simplifies default URL fields, consolidates MCP settings, and adds error handling for MCP client failures in graph building.

Class diagram for updated MCPSettings and Settings classes

classDiagram
    class MCPSettings {
        FilePath path
        +is_json() Self
        +check_mcp_config() Self
    }
    class Settings {
        ModelSettings model
        MemorySettings memory
        VectorDatabaseSettings vector_database
        MCPSettings mcp
        DirectorySettings directory
    }
    Settings --> MCPSettings : mcp
    Settings --> ModelSettings : model
    Settings --> MemorySettings : memory
    Settings --> VectorDatabaseSettings : vector_database
    Settings --> DirectorySettings : directory
Loading

Class diagram for updated MemorySettings and VectorDatabaseSettings defaults

classDiagram
    class MemorySettings {
        RedisDsn url = "redis://localhost:6379"
    }
    class VectorDatabaseSettings {
        StrictStr name = "chattr"
        HttpUrl url = "http://localhost:6333"
    }
Loading

Flow diagram for MCP config file validation and loading

flowchart TD
    A[User provides MCP config file path] --> B{Is file extension .json?}
    B -- No --> C[Raise ValueError: must be JSON]
    B -- Yes --> D[Read file contents]
    D --> E[Parse JSON into config dict]
    E --> F[Print config]
    F --> G[Return MCPSettings instance]
Loading

File-Level Changes

Change Details Files
Simplify default URL fields
  • Use string literal for Redis URL default
  • Use string literal for vector database URL default
src/chattr/settings.py
Introduce JSON-based MCP configuration with validation
  • Replace multiple MCP parameters with a single FilePath field
  • Add post-validation to enforce .json extension
  • Load and parse JSON config in a validator
src/chattr/settings.py
Consolidate MCP settings into one model field
  • Remove voice_generator_mcp and video_generator_mcp entries
  • Add a singular 'mcp' field of type MCPSettings
src/chattr/settings.py
Handle MCP client failures gracefully in graph builder
  • Wrap get_tools call in try/except
  • Log a warning and return an empty list on failure
src/chattr/graph/builder.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Aug 4, 2025

Copy link
Copy Markdown
Contributor

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Warning

Rate limit exceeded

@MH0386 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 21 minutes and 29 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between da34ddb and c0aa1eb.

📒 Files selected for processing (1)
  • src/chattr/settings.py (3 hunks)
📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Introduced unified memory management for enhanced context and personalization.
    • Added support for configurable MCP server setups via new JSON schema and configuration files.
    • Implemented a new state representation to support user-specific memory.
  • Improvements

    • Enhanced error handling during tool setup for greater reliability.
    • Updated logging system for improved diagnostics and log management.
    • Streamlined settings for simpler configuration and deployment.
  • Dependency Updates

    • Upgraded and replaced several dependencies, including memory and embedding libraries.
  • Chores

    • Removed Redis memory service from testing workflow.
    • Added new words to the project dictionary.

Walkthrough

Exception handling was added to the _setup_tools method in the graph builder to ensure it returns an empty list on failure. The MCPSettings configuration was refactored to load from a JSON file, consolidating multiple fields into a single file path, with validation for file type and content. Settings were updated to use this new MCPSettings structure.

Changes

Cohort / File(s) Change Summary
Graph Builder Refactor
src/chattr/graph/builder.py, src/chattr/graph/state.py
Replaced Redis-based memory with unified Memory abstraction; updated constructor and factory method to initialize Memory; changed state handling to use new State class; enhanced model invocation with personalized memory context; improved error handling in tool setup.
Settings Refactor and Logging Update
src/chattr/settings.py, src/chattr/utils.py
Replaced Redis URL with collection name in memory settings; refactored MCPSettings to use a single JSON file path with schema validation; updated logging to use loguru; changed system message field to string.
New MCP Configuration Files
assets/mcp-config.json, mcp.json
Added JSON schema file defining MCP server configuration structure; added MCP server configuration file for qdrant and jetbrains servers.
Project Dependencies Update
pyproject.toml
Updated dependencies: bumped gradio version, replaced langchain with langchain-community, removed Redis checkpoint package, added loguru and mem0ai.
CI Workflow Update
.github/workflows/docker.yaml
Removed Redis service from test job; updated environment variables to reflect removal; changed vector database URL to internal Docker hostname.
IDE Configuration
.idea/dictionaries/project.xml
Added new dictionary entries for project-specific terms "ghcr" and "jlumbroso".

Sequence Diagram(s)

sequenceDiagram
    participant Graph as GraphBuilder
    participant Memory as Memory Abstraction
    participant Model as LLM Model
    participant Logger as Logger

    Graph->>Memory: Initialize Memory instance (_setup_memory)
    Graph->>Graph: Setup tools (_setup_tools)
    alt Tool setup success
        Graph-->>Graph: Tools list
    else Tool setup failure
        Graph->>Logger: Log warning
        Graph-->>Graph: Return empty list
    end

    User->>Graph: Generate response with State input
    Graph->>Memory: Search user memories by user ID and latest message
    Memory-->>Graph: Return relevant memories
    Graph->>Model: Call model with system prompt + memory context
    Model-->>Graph: Model response
    Graph->>Memory: Add model response to memory with user ID
    Graph-->>User: Return response
Loading
sequenceDiagram
    participant User as User
    participant MCPSettings as MCPSettings Validator
    participant FileSystem as JSON File

    User->>MCPSettings: Provide MCP config file path
    MCPSettings->>FileSystem: Check file extension (.json)
    alt Valid extension
        MCPSettings->>FileSystem: Load and parse JSON
        MCPSettings->>MCPSettings: Validate JSON against schema
        alt Valid JSON
            MCPSettings-->>User: Accept config
        else Invalid JSON
            MCPSettings-->>User: Raise validation error
        end
    else Invalid extension
        MCPSettings-->>User: Raise validation error
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Suggested reviewers

  • sourcery-ai

Poem

A hop through code, a leap through files,
Settings now load with JSON smiles.
Errors caught, no tools will break—
Just empty lists for safety’s sake.
Refactoring neat, a rabbit’s delight,
Reviewing this change feels just right! 🐇

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-langgraph

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Summary of Changes

Hello @MH0386, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request centralizes the configuration for the Multi-Server Control Plane (MCP) by introducing a single, file-based configuration approach. This change enhances the flexibility and maintainability of MCP settings. Additionally, I've improved the system's robustness by adding error handling for MCP client communication, ensuring that the application can gracefully handle scenarios where the MCP service is unavailable.

Highlights

  • Refactored MCP Configuration: The MCPSettings class has been refactored to accept a single file path for a JSON configuration, moving away from individual fields like name, url, and transport.
  • Added Configuration Validation: Validation logic has been added to MCPSettings to ensure the provided path points to a valid JSON file.
  • Consolidated MCP Settings: The main Settings class now uses a single 'mcp' field, consolidating previously separate voice and video generator MCP settings.
  • Improved Error Handling for MCP Client: Error handling has been implemented in the _setup_tools function to gracefully manage cases where the MCP client is unavailable, logging a warning and returning an empty list.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@deepsource-io

deepsource-io Bot commented Aug 4, 2025

Copy link
Copy Markdown

Here's the code health analysis summary for commits 2ad5331..c0aa1eb. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource Python LogoPython✅ Success
🎯 15 occurences resolved
View Check ↗
DeepSource Docker LogoDocker✅ SuccessView Check ↗
DeepSource Secrets LogoSecrets✅ SuccessView Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey @MH0386 - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `src/chattr/settings.py:75` </location>
<code_context>
-    transport: Literal["sse", "stdio", "streamable_http", "websocket"] = Field(
-        default=None
-    )
+    path: FilePath = Field(default=None)
+
+    @model_validator(mode="after")
</code_context>

<issue_to_address>
Using FilePath with a default of None may cause type issues.

Consider changing the type to Optional[FilePath] if None is intended as a valid value, to avoid type or validation errors.
</issue_to_address>

### Comment 2
<location> `src/chattr/settings.py:93` </location>
<code_context>
+                | StreamableHttpConnection
+                | WebsocketConnection,
+            ] = loads(self.path.read_text(encoding="utf-8"))
+            print(config)
+            print()
+        return self

</code_context>

<issue_to_address>
Debug print statements should be removed from production code.

Print statements in configuration validation may clutter logs or expose sensitive data. Please remove them or use appropriate logging if necessary.
</issue_to_address>

### Comment 3
<location> `src/chattr/graph/builder.py:182` </location>
<code_context>
             list[BaseTool]: A list of BaseTool objects retrieved from the MCP client.
         """
-        return await _mcp_client.get_tools()
+        try:
+            return await _mcp_client.get_tools()
+        except Exception as e:
+            logger.warning(f"MCP unavailable: {e}")
+            return []

     def draw_graph(self) -> None:
</code_context>

<issue_to_address>
Catching all exceptions may mask underlying issues.

Catching only specific exceptions, such as network-related errors, will help prevent masking unrelated bugs.
</issue_to_address>

### Comment 4
<location> `src/chattr/settings.py:74` </location>
<code_context>
+    url: HttpUrl = Field(default="http://localhost:6333")


 class MCPSettings(BaseModel):
-    name: StrictStr = Field(default=None)
-    url: HttpUrl = Field(default=None)
</code_context>

<issue_to_address>
Consider moving file I/O and JSON parsing out of the MCPSettings model into a separate loader function to keep the model focused on data validation.

Here’s one way to drastically simplify `MCPSettings` by pulling all file-I/O and JSON parsing out into a tiny loader function, and keeping the Pydantic model strictly focused on its final shape:

```python
# mcp_loader.py
from pathlib import Path
from json import loads

def load_mcp_config(path: Path) -> dict:
    if path.suffix.lower() != ".json":
        raise ValueError("MCP config file must be a .json")
    text = path.read_text(encoding="utf-8")
    return loads(text)
```

```python
# settings.py
from pathlib import Path
from typing import Literal, List
from pydantic import BaseModel, Field
from .mcp_loader import load_mcp_config

class MCPSettings(BaseModel):
    name: str
    url: HttpUrl
    transport: Literal["sse", "stdio", "streamable_http", "websocket"]
    args: List[str] = []

class Settings(BaseSettings):
    # pick up the path from an ENV or default location
    mcp_path: Path = Field(default=Path("mcp_config.json"))
    mcp: MCPSettings = Field(
        default_factory=lambda: MCPSettings(**load_mcp_config(Settings.__config__.env_file))
    )
```

What this gives you:

- **No in-model I/O** or `@model_validator` complexity.
- A single, tiny loader with just one responsibility.
- A lean `MCPSettings` that only declares the final fields and types.
- All existing behavior (validate “.json”, parse JSON) stays intact.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/chattr/settings.py Outdated
Comment on lines +93 to +94
print(config)
print()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

issue: Debug print statements should be removed from production code.

Print statements in configuration validation may clutter logs or expose sensitive data. Please remove them or use appropriate logging if necessary.

Comment on lines +182 to +186
try:
return await _mcp_client.get_tools()
except Exception as e:
logger.warning(f"MCP unavailable: {e}")
return []

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion (bug_risk): Catching all exceptions may mask underlying issues.

Catching only specific exceptions, such as network-related errors, will help prevent masking unrelated bugs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR simplifies MCP (Model Context Protocol) configuration by replacing individual service configurations with a unified JSON file-based approach. The changes consolidate multiple MCP service settings into a single configuration file path and add error handling for MCP unavailability.

  • Replaced individual MCP service configurations with a single JSON file path configuration
  • Added validation to ensure MCP config files are JSON format
  • Added exception handling in MCP client setup to gracefully handle unavailable services

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
src/chattr/settings.py Refactored MCPSettings to use a single JSON config file instead of individual service configurations
src/chattr/graph/builder.py Added exception handling for MCP client tool retrieval

Comment thread src/chattr/settings.py Outdated
Comment on lines +93 to +94
print(config)
print()

Copilot AI Aug 4, 2025

Copy link

Choose a reason for hiding this comment

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

Debug print statements should be removed from production code. Consider using the logger instead or removing these statements entirely.

Suggested change
print(config)
print()
logger.debug(config)

Copilot uses AI. Check for mistakes.
Comment thread src/chattr/settings.py Outdated
Comment on lines +93 to +94
print(config)
print()

Copilot AI Aug 4, 2025

Copy link

Choose a reason for hiding this comment

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

Debug print statements should be removed from production code. Consider using the logger instead or removing these statements entirely.

Suggested change
print(config)
print()
logger.info(config)

Copilot uses AI. Check for mistakes.
Comment thread src/chattr/settings.py Outdated

class MemorySettings(BaseModel):
url: RedisDsn = Field(default=RedisDsn(url="redis://localhost:6379"))
url: RedisDsn = Field(default="redis://localhost:6379")

Copilot AI Aug 4, 2025

Copy link

Choose a reason for hiding this comment

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

The default value should be wrapped in RedisDsn() constructor to maintain type consistency with the field annotation.

Suggested change
url: RedisDsn = Field(default="redis://localhost:6379")
url: RedisDsn = Field(default=RedisDsn("redis://localhost:6379"))

Copilot uses AI. Check for mistakes.
Comment thread src/chattr/settings.py Outdated
class VectorDatabaseSettings(BaseModel):
name: StrictStr = Field(default="chattr")
url: HttpUrl = Field(default=HttpUrl(url="http://localhost:6333"))
url: HttpUrl = Field(default="http://localhost:6333")

Copilot AI Aug 4, 2025

Copy link

Choose a reason for hiding this comment

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

The default value should be wrapped in HttpUrl() constructor to maintain type consistency with the field annotation.

Suggested change
url: HttpUrl = Field(default="http://localhost:6333")
url: HttpUrl = Field(default=HttpUrl("http://localhost:6333", scheme="http", host="localhost", tld=""))

Copilot uses AI. Check for mistakes.
Comment thread src/chattr/graph/builder.py Outdated

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the MCP configuration to be loaded from a single JSON file, which is a good simplification. It also adds error handling for when MCP tools are unavailable. My main concern is that the code in src/chattr/graph/builder.py has not been updated to use this new configuration method, which will cause the application to break as it still references the old, now-removed settings. Additionally, there are some debugging artifacts (print statements) in src/chattr/settings.py, and the loaded MCP configuration is not actually stored or used. Please see my detailed comments for suggestions.

Comment thread src/chattr/settings.py
Comment on lines +84 to +95
def check_mcp_config(self) -> Self:
if self.path:
config: dict[
str,
StdioConnection
| SSEConnection
| StreamableHttpConnection
| WebsocketConnection,
] = loads(self.path.read_text(encoding="utf-8"))
print(config)
print()
return self

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

This validator loads the configuration from the file, but the config variable is local and its value is discarded when the method returns. For this feature to be useful, the loaded configuration needs to be stored on the MCPSettings instance so it can be accessed by other parts of the application. You could consider adding a pydantic.PrivateAttr to the MCPSettings model and assigning the loaded config to it within this validator.

Comment thread src/chattr/settings.py Outdated
Comment on lines +93 to +94
print(config)
print()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

These print statements appear to be for debugging and should be removed from the code before merging.

Comment thread src/chattr/graph/builder.py Outdated
try:
return await _mcp_client.get_tools()
except Exception as e:
logger.warning(f"MCP unavailable: {e}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

To aid in debugging, it's helpful to log the full traceback when an exception occurs. You can do this by adding exc_info=True. Also, consider catching a more specific exception type on the line above instead of the generic Exception if possible, to avoid masking other potential issues.

Suggested change
logger.warning(f"MCP unavailable: {e}")
logger.warning(f"MCP unavailable: {e}", exc_info=True)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (3)
src/chattr/settings.py (2)

75-75: Fix type annotation for optional FilePath field.

Using FilePath with a default of None may cause type issues. Consider changing the type to Optional[FilePath] if None is intended as a valid value, to avoid type or validation errors.

-    path: FilePath = Field(default=None)
+    path: FilePath | None = Field(default=None)

83-95: Address multiple issues in check_mcp_config validator.

Several issues need attention:

  1. Debug print statements should be removed from production code
  2. Missing error handling for file I/O and JSON parsing
  3. Complex file I/O logic belongs in a separate function
     @model_validator(mode="after")
     def check_mcp_config(self) -> Self:
         if self.path:
-            config: dict[
-                str,
-                StdioConnection
-                | SSEConnection
-                | StreamableHttpConnection
-                | WebsocketConnection,
-            ] = loads(self.path.read_text(encoding="utf-8"))
-            print(config)
-            print()
+            try:
+                config: dict[str, StdioConnection | SSEConnection | StreamableHttpConnection | WebsocketConnection] = loads(
+                    self.path.read_text(encoding="utf-8")
+                )
+                logger.debug(f"Loaded MCP config: {config}")
+            except (OSError, FileNotFoundError) as e:
+                raise ValueError(f"Failed to read MCP config file: {e}")
+            except Exception as e:
+                raise ValueError(f"Failed to parse MCP config JSON: {e}")
         return self
src/chattr/graph/builder.py (1)

182-186: Consider catching specific exceptions for better error handling.

While the exception handling improves fault tolerance, catching all exceptions may mask underlying issues that should be addressed differently.

Consider catching specific exceptions that are expected during MCP client initialization:

         try:
             return await _mcp_client.get_tools()
-        except Exception as e:
-            logger.warning(f"MCP unavailable: {e}")
+        except (ConnectionError, TimeoutError, OSError) as e:
+            logger.warning(f"Failed to retrieve MCP tools - service unavailable: {e}")
+            return []
+        except Exception as e:
+            logger.error(f"Unexpected error retrieving MCP tools: {e}")
             return []

This approach:

  • Handles expected network/connectivity issues gracefully with a warning
  • Logs unexpected errors at error level for investigation
  • Prevents masking of programming errors
🧹 Nitpick comments (1)
src/chattr/settings.py (1)

77-81: Improve file extension validation.

The current validation only checks for exact ".json" but should be case-insensitive to handle ".JSON" files as well.

-    def is_json(self) -> Self:
-        if self.path and self.path.suffix != ".json":
-            raise ValueError("MCP config file must be a JSON file")
-        return self
+    def is_json(self) -> Self:
+        if self.path and self.path.suffix.lower() != ".json":
+            raise ValueError("MCP config file must be a JSON file")
+        return self
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c063dcf and dc2a2a8.

📒 Files selected for processing (2)
  • src/chattr/graph/builder.py (1 hunks)
  • src/chattr/settings.py (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Mergify Merge Protections
  • GitHub Check: Summary
🔇 Additional comments (1)
src/chattr/settings.py (1)

3-3: LGTM! Import changes support the new MCP configuration approach.

The new imports are appropriately added to support JSON parsing, self-referencing type hints, and MCP connection type definitions.

Also applies to: 6-6, 10-15, 20-20

Comment thread src/chattr/settings.py
@MH0386

MH0386 commented Aug 4, 2025

Copy link
Copy Markdown
Contributor Author

🔍 Vulnerabilities of ghcr.io/alphaspheredotai/chattr:f07e93f-pr-106

📦 Image Reference ghcr.io/alphaspheredotai/chattr:f07e93f-pr-106
digestsha256:6fa7a52c76ef88cd51d2a77937e5d4de2d9f16866e4c7f245ad8915856e07359
vulnerabilitiescritical: 0 high: 2 medium: 6 low: 36
platformlinux/amd64
size274 MB
packages360
📦 Base Image python:1e02be40c22aa1c20a4ae404c529966193ebfc54beb8ff6a863062c853aa94f3
also known as
  • 3-slim
  • 3-slim-bookworm
  • 3.13-slim
  • 3.13-slim-bookworm
  • 3.13.5-slim
  • 3.13.5-slim-bookworm
  • slim
  • slim-bookworm
digestsha256:27e5dbf4794217dd490e049cf356cc95654d28b88ce0bb675af2d8320ef4640a
vulnerabilitiescritical: 0 high: 1 medium: 6 low: 27
critical: 0 high: 1 medium: 0 low: 0 gradio 5.41.0 (pypi)

pkg:pypi/gradio@5.41.0

# Dockerfile (41:41)
COPY --from=builder --chown=app:app --chmod=555 /app/.venv /app/.venv

high 8.1: CVE--2023--6572 OWASP Top Ten 2017 Category A9 - Using Components with Known Vulnerabilities

Affected range<2023-11-06
Fixed versionNot Fixed
CVSS Score8.1
CVSS VectorCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
EPSS Score1.662%
EPSS Percentile81st percentile
Description

Exposure of Sensitive Information to an Unauthorized Actor in GitHub repository gradio-app/gradio prior to main.

critical: 0 high: 1 medium: 0 low: 0 pam 1.5.2-6+deb12u1 (deb)

pkg:deb/debian/pam@1.5.2-6%2Bdeb12u1?os_distro=bookworm&os_name=debian&os_version=12

# Dockerfile (32:37)
RUN groupadd app && \
    useradd -m -g app -s /bin/bash app && \
    apt-get update > /dev/null && \
    apt-get install -y --no-install-recommends curl > /dev/null && \
    apt-get clean > /dev/null && \
    rm -rf /var/lib/apt/lists/*

high : CVE--2025--6020

Affected range>=1.5.2-6+deb12u1
Fixed versionNot Fixed
EPSS Score0.018%
EPSS Percentile3rd percentile
Description

A flaw was found in linux-pam. The module pam_namespace may use access user-controlled paths without proper protection, allowing local users to elevate their privileges to root via multiple symlink attacks and race conditions.


[experimental] - pam 1.7.0-4

critical: 0 high: 0 medium: 4 low: 1 gnutls28 3.7.9-2+deb12u4 (deb)

pkg:deb/debian/gnutls28@3.7.9-2%2Bdeb12u4?os_distro=bookworm&os_name=debian&os_version=12

# Dockerfile (32:37)
RUN groupadd app && \
    useradd -m -g app -s /bin/bash app && \
    apt-get update > /dev/null && \
    apt-get install -y --no-install-recommends curl > /dev/null && \
    apt-get clean > /dev/null && \
    rm -rf /var/lib/apt/lists/*

medium : CVE--2025--6395

Affected range<3.7.9-2+deb12u5
Fixed version3.7.9-2+deb12u5
EPSS Score0.053%
EPSS Percentile16th percentile
Description

A NULL pointer dereference flaw was found in the GnuTLS software in _gnutls_figure_common_ciphersuite().


medium : CVE--2025--32990

Affected range<3.7.9-2+deb12u5
Fixed version3.7.9-2+deb12u5
EPSS Score0.059%
EPSS Percentile18th percentile
Description

A heap-buffer-overflow (off-by-one) flaw was found in the GnuTLS software in the template parsing logic within the certtool utility. When it reads certain settings from a template file, it allows an attacker to cause an out-of-bounds (OOB) NULL pointer write, resulting in memory corruption and a denial-of-service (DoS) that could potentially crash the system.


medium : CVE--2025--32988

Affected range<3.7.9-2+deb12u5
Fixed version3.7.9-2+deb12u5
EPSS Score0.052%
EPSS Percentile16th percentile
Description

A flaw was found in GnuTLS. A double-free vulnerability exists in GnuTLS due to incorrect ownership handling in the export logic of Subject Alternative Name (SAN) entries containing an otherName. If the type-id OID is invalid or malformed, GnuTLS will call asn1_delete_structure() on an ASN.1 node it does not own, leading to a double-free condition when the parent function or caller later attempts to free the same structure. This vulnerability can be triggered using only public GnuTLS APIs and may result in denial of service or memory corruption, depending on allocator behavior.


medium : CVE--2025--32989

Affected range<3.7.9-2+deb12u5
Fixed version3.7.9-2+deb12u5
EPSS Score0.021%
EPSS Percentile4th percentile
Description

A heap-buffer-overread vulnerability was found in GnuTLS in how it handles the Certificate Transparency (CT) Signed Certificate Timestamp (SCT) extension during X.509 certificate parsing. This flaw allows a malicious user to create a certificate containing a malformed SCT extension (OID 1.3.6.1.4.1.11129.2.4.2) that contains sensitive data. This issue leads to the exposure of confidential information when GnuTLS verifies certificates from certain websites when the certificate (SCT) is not checked correctly.


low : CVE--2011--3389

Affected range>=3.7.9-2+deb12u4
Fixed versionNot Fixed
EPSS Score5.423%
EPSS Percentile90th percentile
Description

The SSL protocol, as used in certain configurations in Microsoft Windows and Microsoft Internet Explorer, Mozilla Firefox, Google Chrome, Opera, and other products, encrypts data by using CBC mode with chained initialization vectors, which allows man-in-the-middle attackers to obtain plaintext HTTP headers via a blockwise chosen-boundary attack (BCBA) on an HTTPS session, in conjunction with JavaScript code that uses (1) the HTML5 WebSocket API, (2) the Java URLConnection API, or (3) the Silverlight WebClient API, aka a "BEAST" attack.


critical: 0 high: 0 medium: 1 low: 1 tar 1.34+dfsg-1.2+deb12u1 (deb)

pkg:deb/debian/tar@1.34%2Bdfsg-1.2%2Bdeb12u1?os_distro=bookworm&os_name=debian&os_version=12

# Dockerfile (32:37)
RUN groupadd app && \
    useradd -m -g app -s /bin/bash app && \
    apt-get update > /dev/null && \
    apt-get install -y --no-install-recommends curl > /dev/null && \
    apt-get clean > /dev/null && \
    rm -rf /var/lib/apt/lists/*

medium : CVE--2025--45582

Affected range>=1.34+dfsg-1.2+deb12u1
Fixed versionNot Fixed
EPSS Score0.029%
EPSS Percentile6th percentile
Description

GNU Tar through 1.35 allows file overwrite via directory traversal in crafted TAR archives, with a certain two-step process. First, the victim must extract an archive that contains a ../ symlink to a critical directory. Second, the victim must extract an archive that contains a critical file, specified via a relative pathname that begins with the symlink name and ends with that critical file's name. Here, the extraction follows the symlink and overwrites the critical file. This bypasses the protection mechanism of "Member name contains '..'" that would occur for a single TAR archive that attempted to specify the critical file via a ../ approach. For example, the first archive can contain "x -> ../../../../../home/victim/.ssh" and the second archive can contain x/authorized_keys. This can affect server applications that automatically extract any number of user-supplied TAR archives, and were relying on the blocking of traversal. This can also affect software installation processes in which "tar xf" is run more than once (e.g., when installing a package can automatically install two dependencies that are set up as untrusted tarballs instead of official packages).


low : CVE--2005--2541

Affected range>=1.34+dfsg-1.2+deb12u1
Fixed versionNot Fixed
EPSS Score3.739%
EPSS Percentile88th percentile
Description

Tar 1.15.1 does not properly warn the user when extracting setuid or setgid files, which may allow local users or remote attackers to gain privileges.


This is intended behaviour, after all tar is an archiving tool and you
need to give -p as a command line flag

critical: 0 high: 0 medium: 1 low: 1 sqlite3 3.40.1-2+deb12u1 (deb)

pkg:deb/debian/sqlite3@3.40.1-2%2Bdeb12u1?os_distro=bookworm&os_name=debian&os_version=12

# Dockerfile (32:37)
RUN groupadd app && \
    useradd -m -g app -s /bin/bash app && \
    apt-get update > /dev/null && \
    apt-get install -y --no-install-recommends curl > /dev/null && \
    apt-get clean > /dev/null && \
    rm -rf /var/lib/apt/lists/*

medium : CVE--2025--7458

Affected range>=3.40.1-2+deb12u1
Fixed versionNot Fixed
EPSS Score0.016%
EPSS Percentile2nd percentile
Description

An integer overflow in the sqlite3KeyInfoFromExprList function in SQLite versions 3.39.2 through 3.41.1 allows an attacker with the ability to execute arbitrary SQL statements to cause a denial of service or disclose sensitive information from process memory via a crafted SELECT statement with a large number of expressions in the ORDER BY clause.


low : CVE--2021--45346

Affected range>=3.40.1-2+deb12u1
Fixed versionNot Fixed
EPSS Score0.205%
EPSS Percentile43rd percentile
Description

A Memory Leak vulnerability exists in SQLite Project SQLite3 3.35.1 and 3.37.0 via maliciously crafted SQL Queries (made via editing the Database File), it is possible to query a record, and leak subsequent bytes of memory that extend beyond the record, which could let a malicious user obtain sensitive information. NOTE: The developer disputes this as a vulnerability stating that If you give SQLite a corrupted database file and submit a query against the database, it might read parts of the database that you did not intend or expect.


critical: 0 high: 0 medium: 0 low: 7 glibc 2.36-9+deb12u10 (deb)

pkg:deb/debian/glibc@2.36-9%2Bdeb12u10?os_distro=bookworm&os_name=debian&os_version=12

# Dockerfile (32:37)
RUN groupadd app && \
    useradd -m -g app -s /bin/bash app && \
    apt-get update > /dev/null && \
    apt-get install -y --no-install-recommends curl > /dev/null && \
    apt-get clean > /dev/null && \
    rm -rf /var/lib/apt/lists/*

low : CVE--2019--9192

Affected range>=2.36-9+deb12u10
Fixed versionNot Fixed
EPSS Score0.164%
EPSS Percentile38th percentile
Description

In the GNU C Library (aka glibc or libc6) through 2.29, check_dst_limits_calc_pos_1 in posix/regexec.c has Uncontrolled Recursion, as demonstrated by '(|)(\1\1)*' in grep, a different issue than CVE-2018-20796. NOTE: the software maintainer disputes that this is a vulnerability because the behavior occurs only with a crafted pattern


low : CVE--2019--1010025

Affected range>=2.36-9+deb12u10
Fixed versionNot Fixed
EPSS Score0.235%
EPSS Percentile46th percentile
Description

GNU Libc current is affected by: Mitigation bypass. The impact is: Attacker may guess the heap addresses of pthread_created thread. The component is: glibc. NOTE: the vendor's position is "ASLR bypass itself is not a vulnerability.


low : CVE--2019--1010024

Affected range>=2.36-9+deb12u10
Fixed versionNot Fixed
EPSS Score0.375%
EPSS Percentile58th percentile
Description

GNU Libc current is affected by: Mitigation bypass. The impact is: Attacker may bypass ASLR using cache of thread stack and heap. The component is: glibc. NOTE: Upstream comments indicate "this is being treated as a non-security bug and no real threat.


low : CVE--2019--1010023

Affected range>=2.36-9+deb12u10
Fixed versionNot Fixed
EPSS Score0.703%
EPSS Percentile71st percentile
Description

GNU Libc current is affected by: Re-mapping current loaded library with malicious ELF file. The impact is: In worst case attacker may evaluate privileges. The component is: libld. The attack vector is: Attacker sends 2 ELF files to victim and asks to run ldd on it. ldd execute code. NOTE: Upstream comments indicate "this is being treated as a non-security bug and no real threat.


low : CVE--2019--1010022

Affected range>=2.36-9+deb12u10
Fixed versionNot Fixed
EPSS Score0.145%
EPSS Percentile36th percentile
Description

GNU Libc current is affected by: Mitigation bypass. The impact is: Attacker may bypass stack guard protection. The component is: nptl. The attack vector is: Exploit stack buffer overflow vulnerability and use this bypass vulnerability to bypass stack guard. NOTE: Upstream comments indicate "this is being treated as a non-security bug and no real threat.


low : CVE--2018--20796

Affected range>=2.36-9+deb12u10
Fixed versionNot Fixed
EPSS Score1.996%
EPSS Percentile83rd percentile
Description

In the GNU C Library (aka glibc or libc6) through 2.29, check_dst_limits_calc_pos_1 in posix/regexec.c has Uncontrolled Recursion, as demonstrated by '(\227|)(\1\1|t1|\\2537)+' in grep.


low : CVE--2010--4756

Affected range>=2.36-9+deb12u10
Fixed versionNot Fixed
EPSS Score0.373%
EPSS Percentile58th percentile
Description

The glob implementation in the GNU C Library (aka glibc or libc6) allows remote authenticated users to cause a denial of service (CPU and memory consumption) via crafted glob expressions that do not match any pathnames, as demonstrated by glob expressions in STAT commands to an FTP daemon, a different vulnerability than CVE-2010-2632.


  • glibc (unimportant)
  • eglibc (unimportant)
    That's standard POSIX behaviour implemented by (e)glibc. Applications using
    glob need to impose limits for themselves
critical: 0 high: 0 medium: 0 low: 4 openldap 2.5.13+dfsg-5 (deb)

pkg:deb/debian/openldap@2.5.13%2Bdfsg-5?os_distro=bookworm&os_name=debian&os_version=12

# Dockerfile (32:37)
RUN groupadd app && \
    useradd -m -g app -s /bin/bash app && \
    apt-get update > /dev/null && \
    apt-get install -y --no-install-recommends curl > /dev/null && \
    apt-get clean > /dev/null && \
    rm -rf /var/lib/apt/lists/*

low : CVE--2020--15719

Affected range>=2.5.13+dfsg-5
Fixed versionNot Fixed
EPSS Score0.371%
EPSS Percentile58th percentile
Description

libldap in certain third-party OpenLDAP packages has a certificate-validation flaw when the third-party package is asserting RFC6125 support. It considers CN even when there is a non-matching subjectAltName (SAN). This is fixed in, for example, openldap-2.4.46-10.el8 in Red Hat Enterprise Linux.


low : CVE--2017--17740

Affected range>=2.5.13+dfsg-5
Fixed versionNot Fixed
EPSS Score2.838%
EPSS Percentile86th percentile
Description

contrib/slapd-modules/nops/nops.c in OpenLDAP through 2.4.45, when both the nops module and the memberof overlay are enabled, attempts to free a buffer that was allocated on the stack, which allows remote attackers to cause a denial of service (slapd crash) via a member MODDN operation.


low : CVE--2017--14159

Affected range>=2.5.13+dfsg-5
Fixed versionNot Fixed
EPSS Score0.113%
EPSS Percentile31st percentile
Description

slapd in OpenLDAP 2.4.45 and earlier creates a PID file after dropping privileges to a non-root account, which might allow local users to kill arbitrary processes by leveraging access to this non-root account for PID file modification before a root script executes a "kill cat /pathname" command, as demonstrated by openldap-initscript.


low : CVE--2015--3276

Affected range>=2.5.13+dfsg-5
Fixed versionNot Fixed
EPSS Score1.757%
EPSS Percentile82nd percentile
Description

The nss_parse_ciphers function in libraries/libldap/tls_m.c in OpenLDAP does not properly parse OpenSSL-style multi-keyword mode cipher strings, which might cause a weaker than intended cipher to be used and allow remote attackers to have unspecified impact via unknown vectors.


  • openldap (unimportant)
    Debian builds with GNUTLS, not NSS
critical: 0 high: 0 medium: 0 low: 4 systemd 252.38-1~deb12u1 (deb)

pkg:deb/debian/systemd@252.38-1~deb12u1?os_distro=bookworm&os_name=debian&os_version=12

# Dockerfile (32:37)
RUN groupadd app && \
    useradd -m -g app -s /bin/bash app && \
    apt-get update > /dev/null && \
    apt-get install -y --no-install-recommends curl > /dev/null && \
    apt-get clean > /dev/null && \
    rm -rf /var/lib/apt/lists/*

low : CVE--2023--31439

Affected range>=252.36-1~deb12u1
Fixed versionNot Fixed
EPSS Score0.094%
EPSS Percentile27th percentile
Description

An issue was discovered in systemd 253. An attacker can modify the contents of past events in a sealed log file and then adjust the file such that checking the integrity shows no error, despite modifications. NOTE: the vendor reportedly sent "a reply denying that any of the finding was a security vulnerability."


low : CVE--2023--31438

Affected range>=252.36-1~deb12u1
Fixed versionNot Fixed
EPSS Score0.100%
EPSS Percentile28th percentile
Description

An issue was discovered in systemd 253. An attacker can truncate a sealed log file and then resume log sealing such that checking the integrity shows no error, despite modifications. NOTE: the vendor reportedly sent "a reply denying that any of the finding was a security vulnerability."


low : CVE--2023--31437

Affected range>=252.36-1~deb12u1
Fixed versionNot Fixed
EPSS Score0.128%
EPSS Percentile33rd percentile
Description

An issue was discovered in systemd 253. An attacker can modify a sealed log file such that, in some views, not all existing and sealed log messages are displayed. NOTE: the vendor reportedly sent "a reply denying that any of the finding was a security vulnerability."


low : CVE--2013--4392

Affected range>=252.36-1~deb12u1
Fixed versionNot Fixed
EPSS Score0.067%
EPSS Percentile21st percentile
Description

systemd, when updating file permissions, allows local users to change the permissions and SELinux security contexts for arbitrary files via a symlink attack on unspecified files.


critical: 0 high: 0 medium: 0 low: 3 krb5 1.20.1-2+deb12u3 (deb)

pkg:deb/debian/krb5@1.20.1-2%2Bdeb12u3?os_distro=bookworm&os_name=debian&os_version=12

# Dockerfile (32:37)
RUN groupadd app && \
    useradd -m -g app -s /bin/bash app && \
    apt-get update > /dev/null && \
    apt-get install -y --no-install-recommends curl > /dev/null && \
    apt-get clean > /dev/null && \
    rm -rf /var/lib/apt/lists/*

low : CVE--2024--26461

Affected range>=1.20.1-2+deb12u3
Fixed versionNot Fixed
EPSS Score0.081%
EPSS Percentile25th percentile
Description

Kerberos 5 (aka krb5) 1.21.2 contains a memory leak vulnerability in /krb5/src/lib/gssapi/krb5/k5sealv3.c.


low : CVE--2024--26458

Affected range>=1.20.1-2+deb12u3
Fixed versionNot Fixed
EPSS Score0.206%
EPSS Percentile43rd percentile
Description

Kerberos 5 (aka krb5) 1.21.2 contains a memory leak in /krb5/src/lib/rpc/pmap_rmt.c.


low : CVE--2018--5709

Affected range>=1.20.1-2+deb12u3
Fixed versionNot Fixed
EPSS Score0.463%
EPSS Percentile63rd percentile
Description

An issue was discovered in MIT Kerberos 5 (aka krb5) through 1.16. There is a variable "dbentry->n_key_data" in kadmin/dbutil/dump.c that can store 16-bit data but unknowingly the developer has assigned a "u4" variable to it, which is for 32-bit data. An attacker can use this vulnerability to affect other artifacts of the database as we know that a Kerberos database dump file contains trusted data.


critical: 0 high: 0 medium: 0 low: 2 coreutils 9.1-1 (deb)

pkg:deb/debian/coreutils@9.1-1?os_distro=bookworm&os_name=debian&os_version=12

# Dockerfile (32:37)
RUN groupadd app && \
    useradd -m -g app -s /bin/bash app && \
    apt-get update > /dev/null && \
    apt-get install -y --no-install-recommends curl > /dev/null && \
    apt-get clean > /dev/null && \
    rm -rf /var/lib/apt/lists/*

low : CVE--2025--5278

Affected range>=9.1-1
Fixed versionNot Fixed
EPSS Score0.018%
EPSS Percentile3rd percentile
Description

A flaw was found in GNU Coreutils. The sort utility's begfield() function is vulnerable to a heap buffer under-read. The program may access memory outside the allocated buffer if a user runs a crafted command using the traditional key format. A malicious input could lead to a crash or leak sensitive data.


low : CVE--2017--18018

Affected range>=9.1-1
Fixed versionNot Fixed
EPSS Score0.056%
EPSS Percentile17th percentile
Description

In GNU Coreutils through 8.29, chown-core.c in chown and chgrp does not prevent replacement of a plain file with a symlink during use of the POSIX "-R -L" options, which allows local users to modify the ownership of arbitrary files by leveraging a race condition.


critical: 0 high: 0 medium: 0 low: 2 perl 5.36.0-7+deb12u2 (deb)

pkg:deb/debian/perl@5.36.0-7%2Bdeb12u2?os_distro=bookworm&os_name=debian&os_version=12

# Dockerfile (32:37)
RUN groupadd app && \
    useradd -m -g app -s /bin/bash app && \
    apt-get update > /dev/null && \
    apt-get install -y --no-install-recommends curl > /dev/null && \
    apt-get clean > /dev/null && \
    rm -rf /var/lib/apt/lists/*

low : CVE--2023--31486

Affected range>=5.36.0-7+deb12u2
Fixed versionNot Fixed
EPSS Score0.448%
EPSS Percentile63rd percentile
Description

HTTP::Tiny before 0.083, a Perl core module since 5.13.9 and available standalone on CPAN, has an insecure default TLS configuration where users must opt in to verify certificates.


low : CVE--2011--4116

Affected range>=5.36.0-7+deb12u2
Fixed versionNot Fixed
EPSS Score0.738%
EPSS Percentile72nd percentile
Description

_is_safe in the File::Temp module for Perl does not properly handle symlinks.


critical: 0 high: 0 medium: 0 low: 2 libgcrypt20 1.10.1-3 (deb)

pkg:deb/debian/libgcrypt20@1.10.1-3?os_distro=bookworm&os_name=debian&os_version=12

# Dockerfile (32:37)
RUN groupadd app && \
    useradd -m -g app -s /bin/bash app && \
    apt-get update > /dev/null && \
    apt-get install -y --no-install-recommends curl > /dev/null && \
    apt-get clean > /dev/null && \
    rm -rf /var/lib/apt/lists/*

low : CVE--2024--2236

Affected range>=1.10.1-3
Fixed versionNot Fixed
EPSS Score0.228%
EPSS Percentile46th percentile
Description

A timing-based side-channel flaw was found in libgcrypt's RSA implementation. This issue may allow a remote attacker to initiate a Bleichenbacher-style attack, which can lead to the decryption of RSA ciphertexts.


low : CVE--2018--6829

Affected range>=1.10.1-3
Fixed versionNot Fixed
EPSS Score1.266%
EPSS Percentile79th percentile
Description

cipher/elgamal.c in Libgcrypt through 1.8.2, when used to encrypt messages directly, improperly encodes plaintexts, which allows attackers to obtain sensitive information by reading ciphertext data (i.e., it does not have semantic security in face of a ciphertext-only attack). The Decisional Diffie-Hellman (DDH) assumption does not hold for Libgcrypt's ElGamal implementation.


critical: 0 high: 0 medium: 0 low: 2 openssl 3.0.16-1~deb12u1 (deb)

pkg:deb/debian/openssl@3.0.16-1~deb12u1?os_distro=bookworm&os_name=debian&os_version=12

# Dockerfile (32:37)
RUN groupadd app && \
    useradd -m -g app -s /bin/bash app && \
    apt-get update > /dev/null && \
    apt-get install -y --no-install-recommends curl > /dev/null && \
    apt-get clean > /dev/null && \
    rm -rf /var/lib/apt/lists/*

low : CVE--2025--27587

Affected range>=3.0.16-1~deb12u1
Fixed versionNot Fixed
EPSS Score0.050%
EPSS Percentile15th percentile
Description

OpenSSL 3.0.0 through 3.3.2 on the PowerPC architecture is vulnerable to a Minerva attack, exploitable by measuring the time of signing of random messages using the EVP_DigestSign API, and then using the private key to extract the K value (nonce) from the signatures. Next, based on the bit size of the extracted nonce, one can compare the signing time of full-sized nonces to signatures that used smaller nonces, via statistical tests. There is a side-channel in the P-364 curve that allows private key extraction (also, there is a dependency between the bit size of K and the size of the side channel). NOTE: This CVE is disputed because the OpenSSL security policy explicitly notes that any side channels which require same physical system to be detected are outside of the threat model for the software. The timing signal is so small that it is infeasible to be detected without having the attacking process running on the same physical system.


low : CVE--2010--0928

Affected range>=3.0.11-1~deb12u2
Fixed versionNot Fixed
EPSS Score0.109%
EPSS Percentile30th percentile
Description

OpenSSL 0.9.8i on the Gaisler Research LEON3 SoC on the Xilinx Virtex-II Pro FPGA uses a Fixed Width Exponentiation (FWE) algorithm for certain signature calculations, and does not verify the signature before providing it to a caller, which makes it easier for physically proximate attackers to determine the private key via a modified supply voltage for the microprocessor, related to a "fault-based attack."


http://www.eecs.umich.edu/~valeria/research/publications/DATE10RSA.pdf
openssl/openssl#24540
Fault injection based attacks are not within OpenSSLs threat model according
to the security policy: https://www.openssl.org/policies/general/security-policy.html

critical: 0 high: 0 medium: 0 low: 2 curl 7.88.1-10+deb12u12 (deb)

pkg:deb/debian/curl@7.88.1-10%2Bdeb12u12?os_distro=bookworm&os_name=debian&os_version=12

# Dockerfile (32:37)
RUN groupadd app && \
    useradd -m -g app -s /bin/bash app && \
    apt-get update > /dev/null && \
    apt-get install -y --no-install-recommends curl > /dev/null && \
    apt-get clean > /dev/null && \
    rm -rf /var/lib/apt/lists/*

low : CVE--2025--0725

Affected range>=7.88.1-10+deb12u12
Fixed versionNot Fixed
EPSS Score0.282%
EPSS Percentile51st percentile
Description

When libcurl is asked to perform automatic gzip decompression of content-encoded HTTP responses with the CURLOPT_ACCEPT_ENCODING option, using zlib 1.2.0.3 or older, an attacker-controlled integer overflow would make libcurl perform a buffer overflow.


low : CVE--2024--2379

Affected range>=7.88.1-10+deb12u12
Fixed versionNot Fixed
EPSS Score0.139%
EPSS Percentile35th percentile
Description

libcurl skips the certificate verification for a QUIC connection under certain conditions, when built to use wolfSSL. If told to use an unknown/bad cipher or curve, the error path accidentally skips the verification and returns OK, thus ignoring any certificate problems.


critical: 0 high: 0 medium: 0 low: 1 apt 2.6.1 (deb)

pkg:deb/debian/apt@2.6.1?os_distro=bookworm&os_name=debian&os_version=12

# Dockerfile (32:37)
RUN groupadd app && \
    useradd -m -g app -s /bin/bash app && \
    apt-get update > /dev/null && \
    apt-get install -y --no-install-recommends curl > /dev/null && \
    apt-get clean > /dev/null && \
    rm -rf /var/lib/apt/lists/*

low : CVE--2011--3374

Affected range>=2.6.1
Fixed versionNot Fixed
EPSS Score1.476%
EPSS Percentile80th percentile
Description

It was found that apt-key in apt, all versions, do not correctly validate gpg keys with the master keyring, leading to a potential man-in-the-middle attack.


critical: 0 high: 0 medium: 0 low: 1 gcc-12 12.2.0-14+deb12u1 (deb)

pkg:deb/debian/gcc-12@12.2.0-14%2Bdeb12u1?os_distro=bookworm&os_name=debian&os_version=12

# Dockerfile (32:37)
RUN groupadd app && \
    useradd -m -g app -s /bin/bash app && \
    apt-get update > /dev/null && \
    apt-get install -y --no-install-recommends curl > /dev/null && \
    apt-get clean > /dev/null && \
    rm -rf /var/lib/apt/lists/*

low : CVE--2022--27943

Affected range>=12.2.0-14+deb12u1
Fixed versionNot Fixed
EPSS Score0.047%
EPSS Percentile14th percentile
Description

libiberty/rust-demangle.c in GNU GCC 11.2 allows stack consumption in demangle_const, as demonstrated by nm-new.


critical: 0 high: 0 medium: 0 low: 1 gnupg2 2.2.40-1.1 (deb)

pkg:deb/debian/gnupg2@2.2.40-1.1?os_distro=bookworm&os_name=debian&os_version=12

# Dockerfile (32:37)
RUN groupadd app && \
    useradd -m -g app -s /bin/bash app && \
    apt-get update > /dev/null && \
    apt-get install -y --no-install-recommends curl > /dev/null && \
    apt-get clean > /dev/null && \
    rm -rf /var/lib/apt/lists/*

low : CVE--2022--3219

Affected range>=2.2.40-1.1
Fixed versionNot Fixed
EPSS Score0.012%
EPSS Percentile1st percentile
Description

GnuPG can be made to spin on a relatively small input by (for example) crafting a public key with thousands of signatures attached, compressed down to just a few KB.


critical: 0 high: 0 medium: 0 low: 1 util-linux 2.38.1-5+deb12u3 (deb)

pkg:deb/debian/util-linux@2.38.1-5%2Bdeb12u3?os_distro=bookworm&os_name=debian&os_version=12

# Dockerfile (32:37)
RUN groupadd app && \
    useradd -m -g app -s /bin/bash app && \
    apt-get update > /dev/null && \
    apt-get install -y --no-install-recommends curl > /dev/null && \
    apt-get clean > /dev/null && \
    rm -rf /var/lib/apt/lists/*

low : CVE--2022--0563

Affected range>=2.38.1-5+deb12u3
Fixed versionNot Fixed
EPSS Score0.025%
EPSS Percentile5th percentile
Description

A flaw was found in the util-linux chfn and chsh utilities when compiled with Readline support. The Readline library uses an "INPUTRC" environment variable to get a path to the library config file. When the library cannot parse the specified file, it prints an error message containing data from the file. This flaw allows an unprivileged user to read root-owned files, potentially leading to privilege escalation. This flaw affects util-linux versions prior to 2.37.4.


critical: 0 high: 0 medium: 0 low: 1 shadow 1:4.13+dfsg1-1+deb12u1 (deb)

pkg:deb/debian/shadow@1%3A4.13%2Bdfsg1-1%2Bdeb12u1?os_distro=bookworm&os_name=debian&os_version=12

# Dockerfile (32:37)
RUN groupadd app && \
    useradd -m -g app -s /bin/bash app && \
    apt-get update > /dev/null && \
    apt-get install -y --no-install-recommends curl > /dev/null && \
    apt-get clean > /dev/null && \
    rm -rf /var/lib/apt/lists/*

low : CVE--2007--5686

Affected range>=1:4.13+dfsg1-1+deb12u1
Fixed versionNot Fixed
EPSS Score0.245%
EPSS Percentile48th percentile
Description

initscripts in rPath Linux 1 sets insecure permissions for the /var/log/btmp file, which allows local users to obtain sensitive information regarding authentication attempts. NOTE: because sshd detects the insecure permissions and does not log certain events, this also prevents sshd from logging failed authentication attempts by remote attackers.


  • shadow (unimportant)
    See #290803, on Debian LOG_UNKFAIL_ENAB in login.defs is set to no so
    unknown usernames are not recorded on login failures

@MH0386

MH0386 commented Aug 4, 2025

Copy link
Copy Markdown
Contributor Author

Recommended fixes for image ghcr.io/alphaspheredotai/chattr:f07e93f-pr-106

Base image is python:3-slim

Name3.13.5-slim-bookworm
Digestsha256:27e5dbf4794217dd490e049cf356cc95654d28b88ce0bb675af2d8320ef4640a
Vulnerabilitiescritical: 0 high: 1 medium: 6 low: 27
Pushed1 month ago
Size44 MB
Packages139
Flavordebian
OS12
Runtime3.13.5
Slim
The base image is also available under the supported tag(s): 3-slim-bookworm, 3.13-slim, 3.13-slim-bookworm, 3.13.5-slim, 3.13.5-slim-bookworm, slim, slim-bookworm

Refresh base image

Rebuild the image using a newer base image version. Updating this may result in breaking changes.
TagDetailsPushedVulnerabilities
3-slim
Newer image for same tag
Also known as:
  • 3.13.5-slim
  • 3.13-slim
  • 3.13.5-slim-bookworm
  • 3.13-slim-bookworm
  • 3-slim-bookworm
  • slim
  • slim-bookworm
Benefits:
  • Same OS detected
  • Minor runtime version update
  • Newer image for same tag
  • Image has similar size
  • Image introduces no new vulnerability but removes 4
  • Image contains equal number of packages
  • Tag is using slim variant
  • 3-slim was pulled 26K times last month
Image details:
  • Size: 44 MB
  • Flavor: debian
  • OS: 12
  • Runtime: 3.13.5
  • Slim: ✅
1 month ago



Change base image

TagDetailsPushedVulnerabilities
alpine
Tag is preferred tag
Also known as:
  • alpine3.22
  • 3.13.5-alpine
  • 3.13.5-alpine3.22
  • 3.13-alpine
  • 3.13-alpine3.22
  • 3-alpine
  • 3-alpine3.22
Benefits:
  • Minor runtime version update
  • Image is smaller by 26 MB
  • Image contains 100 fewer packages
  • Tag is preferred tag
  • Image introduces no new vulnerability but removes 33
  • alpine is more popular with 41K pulls per month
Image details:
  • Size: 17 MB
  • Flavor: alpine
  • OS: 3.22
  • Runtime: 3.13.5
1 month ago



@MH0386

MH0386 commented Aug 4, 2025

Copy link
Copy Markdown
Contributor Author
Your image ghcr.io/alphaspheredotai/chattr:f07e93f-pr-106 critical: 0 high: 2 medium: 6 low: 36
Current base image python:3-slim critical: 0 high: 1 medium: 6 low: 27
Refreshed base image python:3-slim critical: 0 high: 1 medium: 2 low: 27
Updated base image python:alpine critical: 0 high: 1 medium: 0 low: 0

@socket-security

socket-security Bot commented Aug 5, 2025

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🔭 Outside diff range comments (1)
src/chattr/graph/builder.py (1)

139-142: Fix missing voice_generator_mcp in Settings or refactor to use generic MCPSettings

The GraphBuilder (src/chattr/graph/builder.py:139–142) still calls

cls.settings.voice_generator_mcp.name: SSEConnection(
    url=str(cls.settings.voice_generator_mcp.url),
    transport=cls.settings.voice_generator_mcp.transport,
),

but voice_generator_mcp is no longer defined on Settings (we only have mcp: MCPSettings). This will cause an attribute‐error at runtime.

Please update one of the following:

• Re-introduce a dedicated field in Settings for voice_generator_mcp if you still need it.
• Or consolidate fully by refactoring these lines to load the SSE endpoint from the generic settings.mcp (e.g. parse your mcp-config.json and pull out the “voice_generator” entry).

Example diff (pseudo‐code):

-   cls.settings.voice_generator_mcp.name: SSEConnection(
-       url=str(cls.settings.voice_generator_mcp.url),
-       transport=cls.settings.voice_generator_mcp.transport,
-   ),
+   # Load “voice_generator” endpoint from generic MCP config
+   endpoint = Settings.mcp.load_endpoint("voice_generator")
+   endpoint.name: SSEConnection(
+       url=str(endpoint.url),
+       transport=endpoint.transport,
+   ),
♻️ Duplicate comments (2)
src/chattr/graph/builder.py (2)

213-217: Consider catching specific exceptions.

As noted in previous reviews, catching specific exceptions would be better than catching all exceptions, which may mask underlying issues.


51-59: Fix potential None value passed to constructor.

The tools variable is initialized to None and may remain None if an exception occurs. However, the constructor expects list[BaseTool], not Optional[list[BaseTool]].

Apply this fix to ensure tools is always a list:

-        tools = None
+        tools = []
         memory = await cls._setup_memory()
         try:
             tools: list[BaseTool] = await cls._setup_tools(
                 MultiServerMCPClient(cls._create_mcp_config())
             )
         except Exception as e:
-            logger.warning(f"Failed to setup tools: {e}")
+            logger.warning(f"Failed to retrieve MCP tools: {e}")
         return cls(memory, tools)

The error message improvement aligns with past review feedback about being more specific.

🧹 Nitpick comments (1)
src/chattr/graph/state.py (1)

4-7: LGTM! Consider enhancing the docstring.

The State class correctly extends MessagesState with the mem0_user_id field. Consider expanding the docstring to explain what mem0_user_id represents and its role in the memory management system.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2787fea and 4a517fb.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • assets/mcp-config.json (1 hunks)
  • mcp.json (1 hunks)
  • pyproject.toml (1 hunks)
  • src/chattr/graph/builder.py (8 hunks)
  • src/chattr/graph/state.py (1 hunks)
  • src/chattr/settings.py (3 hunks)
  • src/chattr/utils.py (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • src/chattr/utils.py
  • assets/mcp-config.json
  • pyproject.toml
  • mcp.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/chattr/settings.py
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/chattr/graph/builder.py (2)
src/chattr/graph/state.py (1)
  • State (4-7)
src/chattr/settings.py (1)
  • Settings (129-143)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build and push Docker image
  • GitHub Check: Mergify Merge Protections
  • GitHub Check: Summary

Comment thread src/chattr/graph/builder.py Outdated
Comment thread src/chattr/graph/builder.py Outdated
Comment thread src/chattr/graph/builder.py Outdated
Comment thread src/chattr/graph/builder.py Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (1)
.github/workflows/docker.yaml (1)

115-118: Pin the Qdrant image to a specific version for reproducible CI

qdrant/qdrant:latest can introduce breaking changes at any push; last week’s v1.8.4 introduced an incompatible gRPC port default. Pinning to a concrete tag (e.g., qdrant/qdrant:1.8.5) keeps the workflow deterministic and protects the PR against unrelated CI breakage.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4a517fb and 66fd7e9.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • .github/workflows/docker.yaml (1 hunks)
  • pyproject.toml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • pyproject.toml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build and push Docker image
  • GitHub Check: Mergify Merge Protections
  • GitHub Check: Summary

Comment thread .github/workflows/docker.yaml Outdated
MH0386 and others added 4 commits August 6, 2025 02:37
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@AlphaSphereDotAI AlphaSphereDotAI deleted a comment from sourcery-ai Bot Aug 6, 2025
@AlphaSphereDotAI AlphaSphereDotAI deleted a comment from sourcery-ai Bot Aug 6, 2025
@MH0386

MH0386 commented Aug 6, 2025

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Aug 6, 2025

Copy link
Copy Markdown
Contributor

queue

🟠 Waiting for conditions to match

Details
  • any of: [🔀 queue conditions]
    • all of: [📌 queue conditions of queue default]
      • all of:
        • check-success = API Test
        • check-success = DeepSource: Python
        • check-success = CodeFactor
        • check-success = CodeQL
        • check-success = CodeRabbit
        • check-success = DeepSource: Docker
        • check-success = DeepSource: Secrets
        • check-success = DeepSource: Transformers
        • check-success = DeepSource: pyproject.toml
        • check-success = GitGuardian Security Checks
        • check-success = SonarCloud
        • check-success = Trunk Check
      • any of: [🛡 GitHub repository ruleset rule]
        • check-neutral = Mergify Merge Protections
        • check-skipped = Mergify Merge Protections
        • check-success = Mergify Merge Protections
  • -closed [📌 queue requirement]
  • -conflict [📌 queue requirement]
  • -draft [📌 queue requirement]
  • any of: [📌 queue -> configuration change requirements]
    • -mergify-configuration-changed
    • check-success = Configuration changed
  • any of: [📌 queue requirement]
    • check-neutral = Mergify Merge Protections
    • check-skipped = Mergify Merge Protections
    • check-success = Mergify Merge Protections

@sonarqubecloud

sonarqubecloud Bot commented Aug 6, 2025

Copy link
Copy Markdown

@MH0386

MH0386 commented Aug 6, 2025

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Aug 6, 2025

Copy link
Copy Markdown
Contributor

queue

✅ The pull request has been merged automatically

Details

The pull request has been merged automatically at c0aa1eb

@mergify
mergify Bot merged commit c0aa1eb into main Aug 6, 2025
28 checks passed
@mergify
mergify Bot deleted the fix-langgraph branch August 6, 2025 01:15
@mergify

mergify Bot commented Aug 6, 2025

Copy link
Copy Markdown
Contributor

Thank you for your contribution @MH0386! Your pull request has been merged.

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