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

Update shell_command.markdown #35906

Draft
wants to merge 1 commit into
base: current
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions source/_integrations/shell_command.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ input_number:
min: 18
max: 32
step: 1

```
```yaml
# configuration.yaml entry
shell_command:
set_ac_to_slider: 'irsend SEND_ONCE DELONGHI AC_{{ states("input_number.ac_temperature") }}_AUTO'
```
Expand Down Expand Up @@ -128,8 +130,9 @@ automation:
data:
title: "ToDo file error"
message: "{{ todo_response['stderr'] }}"


```
```yaml
# configuration.yaml entry
shell_command:
get_file_contents: "cat {{ filename }}"
```
Comment on lines +135 to 138
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add security warning about file access

The example effectively demonstrates response handling, but should include security considerations.

Add a warning note about:

  • Ensuring proper file permissions
  • Restricting access to sensitive files
  • Using absolute paths within the Home Assistant configuration directory
  • Input validation for the filename parameter

Example addition:

{% note title="Security" %}
Ensure that:
- The file is within the Home Assistant configuration directory
- The file has appropriate read permissions
- The filename parameter is properly validated
- Access to sensitive files is restricted
{% endnote %}

Expand Down