Skip to content
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

Documentation update for HA PR #140661 (http banned networks) #38012

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

Conversation

HLFCode
Copy link

@HLFCode HLFCode commented Mar 16, 2025

Proposed change

Added documentation for HA pull request Improve http component to ban IP addresses by subnet
Issue discussed in Ban by subnet in http component (with working code) and [Security] Improvement of IPBan [HTTP Integration]

Type of change

  • Spelling, grammar or other readability improvements (current branch).
  • Adjusted missing or incorrect information in the current documentation (current branch).
  • Added documentation for a new integration I'm adding to Home Assistant (next branch).
  • Added documentation for a new feature I'm adding to Home Assistant (next branch).
  • Removed stale or deprecated documentation.

Additional information

  • Link to parent pull request in the codebase:
  • Link to parent pull request in the Brands repository:
  • This PR fixes or closes issue: fixes #

Checklist

  • This PR uses the correct branch, based on one of the following:
    • I made a change to the existing documentation and used the current branch.
    • I made a change that is related to an upcoming version of Home Assistant and used the next branch.
  • The documentation follows the Home Assistant documentation standards.

Summary by CodeRabbit

  • New Features

    • Added three new configuration settings allowing users to specify banned IP networks and control related logging and notifications.
  • Documentation

    • Updated configuration examples and guidelines to demonstrate proper usage, including formatting the IP ranges and noting that changes require a restart.

@HLFCode HLFCode requested a review from a team as a code owner March 16, 2025 11:34
@home-assistant home-assistant bot added current This PR goes into the current branch has-parent This PR has a parent PR in a other repo in-progress This PR/Issue is currently being worked on needs-rebase The PR has been branched of the wrong base branch or targets an incorrect target branch labels Mar 16, 2025
@home-assistant
Copy link

It seems that this PR is targeted against an incorrect branch since it has a parent PR on one of our codebases. Documentation that needs to be updated for an upcoming release should target the next branch. Please change the target branch of this PR to next and rebase if needed.

Copy link

netlify bot commented Mar 16, 2025

Deploy Preview for home-assistant-docs ready!

Name Link
🔨 Latest commit bf1b71d
🔍 Latest deploy log https://app.netlify.com/sites/home-assistant-docs/deploys/67d6bc0a0dbe3e000841fd98
😎 Deploy Preview https://deploy-preview-38012--home-assistant-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

Copy link
Contributor

coderabbitai bot commented Mar 16, 2025

📝 Walkthrough

Walkthrough

The pull request introduces three new configuration options for the http integration: banned_networks, log_banned_networks, and notify_banned_networks. The banned_networks option allows users to specify IP range(s) to block access when ip_ban_enabled is true. The additional options control whether attempts from these banned networks should be logged and trigger persistent notifications in the frontend. The documentation is updated with a new configuration example and detailed instructions on formatting and applying these settings.

Changes

File Change Summary
source/_integrations/http.markdown Added three new options (banned_networks, log_banned_networks, and notify_banned_networks) and updated the configuration example and documentation.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client
    participant HTTP as HTTP Integration
    participant Log as Logging System
    participant Notify as Notification System

    Client->>HTTP: Send HTTP request
    HTTP->>HTTP: Check IP against banned_networks
    alt IP is banned
        HTTP->>Log: Log request (if log_banned_networks enabled)
        HTTP->>Notify: Trigger notification (if notify_banned_networks enabled)
        HTTP-->>Client: Deny request
    else IP not banned
        HTTP-->>Client: Process request normally
    end
Loading

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

🪧 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 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 or @coderabbitai title 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
Contributor

@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 (1)
source/_integrations/http.markdown (1)

167-175: Typographical and Formatting Suggestions in the IP Ban Section

This block contains several minor issues that could be addressed to improve clarity and correctness:

  • CIDR Notation Correction:
    On line 169, the example uses 1.2.0.0\16 which appears to be a typo. It should use a forward slash:
    - To block `1.2.[0-255].[0-255]` use `1.2.0.0\16`
    + To block `1.2.[0-255].[0-255]` use `1.2.0.0/16`
  • Spell Correction:
    On line 171, change “take affect” to “take effect” for semantic clarity:
    - If you edit the banned networks list you will need to restart Home Assistant for it to take affect
    + If you edit the banned networks list, you will need to restart Home Assistant for it to take effect
  • Punctuation Improvements:
    The sentences on lines 171, 173, and 175 could benefit from additional commas to enhance readability. For example, on line 175, a clearer phrasing might be:
    - Banned IP log entries are `info` messages so to see them the logger default or for this integration must be at `info` or lower.
    + Banned IP log entries are logged as `info` messages, so the logger (or this integration) must be set to `info` or lower.

Please review and adjust these suggestions to align with Home Assistant’s documentation style.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~171-~171: Possible missing comma found.
Context: ...0\16`. If you edit the banned networks list you will need to restart Home Assistant...

(AI_HYDRA_LEO_MISSING_COMMA)


[misspelling] ~171-~171: Did you mean “effect” (consequence, outcome, result)?
Context: ...o restart Home Assistant for it to take affect By default, logging failed attempts to...

(AFFECT_EFFECT)


[uncategorized] ~173-~173: Possible missing comma found.
Context: ...tions are enabled. To disable either of these use the log_banned_networks and `noti...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~175-~175: Possible missing comma found.
Context: ...lags. Banned IP log entries are info messages so to see them the logger default or fo...

(AI_HYDRA_LEO_MISSING_COMMA)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c9aec73 and 74b56eb.

📒 Files selected for processing (1)
  • source/_integrations/http.markdown (3 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_integrations/http.markdown

[uncategorized] ~171-~171: Possible missing comma found.
Context: ...0\16`. If you edit the banned networks list you will need to restart Home Assistant...

(AI_HYDRA_LEO_MISSING_COMMA)


[misspelling] ~171-~171: Did you mean “effect” (consequence, outcome, result)?
Context: ...o restart Home Assistant for it to take affect By default, logging failed attempts to...

(AFFECT_EFFECT)


[uncategorized] ~173-~173: Possible missing comma found.
Context: ...tions are enabled. To disable either of these use the log_banned_networks and `noti...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~175-~175: Possible missing comma found.
Context: ...lags. Banned IP log entries are info messages so to see them the logger default or fo...

(AI_HYDRA_LEO_MISSING_COMMA)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Redirect rules - home-assistant-docs
  • GitHub Check: Header rules - home-assistant-docs
  • GitHub Check: Pages changed - home-assistant-docs
🔇 Additional comments (1)
source/_integrations/http.markdown (1)

82-95: New HTTP Configuration Options for IP Ban Enhancements

The new configuration options—banned_networks, log_banned_networks, and notify_banned_networks—have been added with clear descriptions, appropriate types, and default values. This addition aligns well with the intent to extend the HTTP integration’s filtering capabilities. Please ensure that the examples later in the file remain consistent with these updated options.

Copy link
Contributor

@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 (1)
source/_integrations/http.markdown (1)

82-95: Add new configuration options for banned networks

The new options (banned_networks, log_banned_networks, and notify_banned_networks) are clearly defined with appropriate descriptions, types, and default values. The description for banned_networks explicitly ties its functionality to ip_ban_enabled, which is very helpful for users.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 74b56eb and bf1b71d.

📒 Files selected for processing (1)
  • source/_integrations/http.markdown (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Redirect rules - home-assistant-docs
  • GitHub Check: Header rules - home-assistant-docs
  • GitHub Check: Pages changed - home-assistant-docs
🔇 Additional comments (2)
source/_integrations/http.markdown (2)

120-124: Validate the sample configuration snippet for banned networks

The sample configuration snippet now includes entries for banned_networks, as well as explicit settings for log_banned_networks and notify_banned_networks. This example nicely demonstrates the expected format (using CIDR notation) and reinforces how these options should be configured.


167-175: Enhance documentation for IP filtering with subnet banning

The added prose offers valuable context on the rationale behind subnet banning and explains the expected behavior:

  • It highlights how hackers may attempt to bypass IP blocking by shifting addresses.
  • It instructs users on how to specify network ranges in CIDR notation.
  • It reminds users that any change to the banned networks list requires a Home Assistant restart.
  • It clarifies that logging and persistent notifications for banned IP events are enabled by default.

Overall, these additions provide clear and actionable information to end users.

@HLFCode
Copy link
Author

HLFCode commented Mar 16, 2025

It seems that this PR is targeted against an incorrect branch since it has a parent PR on one of our codebases. Documentation that needs to be updated for an upcoming release should target the next branch. Please change the target branch of this PR to next and rebase if needed.

Do I need to do anything about this?
If so I have no idea how so any help gratefully received.

@c0ffeeca7
Copy link
Contributor

It seems that this PR is targeted against an incorrect branch since it has a parent PR on one of our codebases. Documentation that needs to be updated for an upcoming release should target the next branch. Please change the target branch of this PR to next and rebase if needed.

Do I need to do anything about this? If so I have no idea how so any help gratefully received.

Right now, your docs PR is based on, and targeting the current branch.
image

  1. rebase it against the next branch, and target the next branch. for example, like they do here:
    image

  2. In the PR template, next to "parent PR, add a link to your core PR.
    image

@HLFCode
Copy link
Author

HLFCode commented Mar 17, 2025

  1. rebase it against the next branch, and target the next branch. for example, like they do here:

That's the bit I don't understand how to do - I can't find a rebase button anywhere...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
current This PR goes into the current branch has-parent This PR has a parent PR in a other repo in-progress This PR/Issue is currently being worked on needs-rebase The PR has been branched of the wrong base branch or targets an incorrect target branch
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

2 participants