Skip to content

feat: add verifySSL param #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Pehesi97
Copy link

@Pehesi97 Pehesi97 commented Apr 11, 2025

This PR adds a verifySSL bool parameter to the InfisicalSDKClient so requests to self-hosted servers with self-signed certificates work.

Summary by CodeRabbit

  • New Features

    • Added an optional setting to enable or disable SSL certificate verification, allowing enhanced security configuration during API interactions.
  • Documentation

    • Updated the user guide to include details on the new SSL verification option.

Copy link

coderabbitai bot commented Apr 11, 2025

Walkthrough

This pull request adds an optional boolean parameter, verifySSL (defaulting to True), to the constructors of both the InfisicalSDKClient and InfisicalRequests classes. The change allows users to control whether SSL/TLS certificate verification is performed during API requests. Documentation in the README has been updated to reflect this new configuration option, and the instantiation of the InfisicalRequests class now passes the verifySSL parameter.

Changes

File(s) Change Summary
README.md Updated documentation to include the new optional verifySSL parameter in the InfisicalSDKClient constructor.
infisical_sdk/client.py
infisical_sdk/infisical_requests.py
Modified constructors to accept an optional verifySSL parameter (default True) and updated method calls to propagate SSL verification preference during API requests.

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant Client as InfisicalSDKClient
    participant Req as InfisicalRequests
    participant API as API Server

    User->>Client: Instantiate with verifySSL option
    Client->>Req: Pass host, token, cache_ttl, verifySSL
    Req->>API: Execute HTTP request (using verifySSL setting)
    API-->>Req: Return response
    Req-->>Client: Return processed data
Loading

Poem

In the code garden under the byte-lit sky,
I hopped to add a flag, oh my!
verifySSL now leads the way,
Secure hops on every API play.
With whiskers twitching, I cheer this ride—
A rabbit's delight, with CodeRabbit pride!
🐇✨

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3678f71 and 80ce708.

📒 Files selected for processing (2)
  • infisical_sdk/client.py (1 hunks)
  • infisical_sdk/infisical_requests.py (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • infisical_sdk/client.py
  • infisical_sdk/infisical_requests.py

🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
infisical_sdk/client.py (1)

10-18: Consider updating constructor docstring

While the new parameter is well-documented in the README, consider also documenting it in the constructor docstring for developers viewing the source code directly.

        :param str host: The host URL for your Infisical instance. Will default to `https://app.infisical.com` if not specified.
        :param str token: The authentication token for the client. If not specified, you can use the `auth` methods to authenticate.
        :param int cache_ttl: The time to live for the secrets cache. This is the number of seconds that secrets fetched from the API will be cached for. Set to `None` to disable caching. Defaults to `60` seconds.
+       :param bool verifySSL: Whether to verify SSL certificates. Set to `False` to disable verification for self-signed certificates. Defaults to `True`.
        """
infisical_sdk/infisical_requests.py (2)

178-178: Fix docstring in delete method

This is a pre-existing issue unrelated to your changes, but the docstring for the delete method incorrectly states it makes a PATCH request.

-        """Make a PATCH request with JSON data"""
+        """Make a DELETE request with JSON data"""

54-193: Consider adding a warning about security implications

Since disabling SSL verification can pose security risks in production environments, consider adding a warning in the docstring about the security implications.

    def __init__(self, host: str, token: Optional[str] = None, verifySSL: bool = True):
+        """
+        Initialize the Infisical requests client.
+        
+        :param str host: The host URL for your Infisical instance.
+        :param str token: Optional authentication token for the client.
+        :param bool verifySSL: Whether to verify SSL certificates. Set to `False` to disable 
+                              verification for self-signed certificates. Warning: Disabling 
+                              SSL verification may expose you to man-in-the-middle attacks.
+                              Only use in development or with trusted networks. Defaults to `True`.
+        """
        self.host = host.rstrip("/")
        self.session = requests.Session()
        self.verifySSL = verifySSL
🧰 Tools
🪛 Ruff (0.8.2)

87-91: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


93-93: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


95-95: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 807da32 and 3678f71.

📒 Files selected for processing (3)
  • README.md (1 hunks)
  • infisical_sdk/client.py (2 hunks)
  • infisical_sdk/infisical_requests.py (5 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
infisical_sdk/client.py (1)
infisical_sdk/infisical_requests.py (1)
  • InfisicalRequests (53-193)
🔇 Additional comments (7)
infisical_sdk/client.py (3)

10-10: Well-implemented signature update with sensible default

The addition of the verifySSL parameter with a default value of True is a good practice as it maintains secure behavior by default while allowing flexibility for users with self-signed certificates.


21-21: LGTM: Properly storing the parameter

Good practice to store the parameter as an instance variable for potential future use.


23-23: Correctly passing parameter to the requests class

Properly propagating the verifySSL parameter to the InfisicalRequests class ensures consistent SSL verification behavior throughout the SDK.

README.md (1)

54-54: Clear and helpful documentation

The documentation for the new parameter clearly explains its purpose, type, and default value, which is important for users to understand the security implications.

infisical_sdk/infisical_requests.py (3)

54-54: Well-implemented parameter addition

The addition of the verifySSL parameter with a default value of True is consistent with the client class and maintains secure behavior by default.


57-57: LGTM: Properly storing the parameter

Good practice to store the parameter as an instance variable for use in the request methods.


112-112: Consistently applying SSL verification across all HTTP methods

The implementation correctly uses the verify parameter of the underlying requests library in all HTTP methods, ensuring consistent behavior.

Also applies to: 136-136, 160-160, 184-184

@Pehesi97
Copy link
Author

@DanielHougaard any chance you have time to see this?

@Pehesi97
Copy link
Author

@sheensantoscapadngan

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