Skip to content

Fix security issues and add credential update flow - #236

Open
smcneece wants to merge 2 commits into
jjjonesjr33:devfrom
smcneece:fix-security-and-credentials
Open

Fix security issues and add credential update flow#236
smcneece wants to merge 2 commits into
jjjonesjr33:devfrom
smcneece:fix-security-and-credentials

Conversation

@smcneece

@smcneece smcneece commented Jun 8, 2026

Copy link
Copy Markdown

Proposed change

Fixes three security issues and adds credential management to the options flow.

Security fixes:

  • Auth token no longer written to HA logs at DEBUG level (api.py, config_flow.py). The token appeared in three separate log statements. Anyone following the README's own troubleshooting steps (enabling debug logging) was silently leaking their live session token into HA's log files.
  • Avatar URL is now validated before fetch (pets/entity.py). Only https:// URLs from petlibro.com or *.petlibro.com are allowed. Falls back to the bundled default avatar if rejected. Prevents a compromised API from directing HA to make arbitrary outbound requests (SSRF).
  • Removed unused make_api_call function (api.py) and its unused import from 11 files. The function made unauthenticated POST requests to arbitrary URLs and was never called.

New feature:

  • Added "Change login credentials" option to the options flow gear menu, allowing email and/or password to be updated without removing and re-adding the integration.
  • Added async_step_reconfigure following the HA 2024.3+ standard pattern, accessible via the three-dot menu on the integration card.

Type of change

  • Bug fix (non-breaking change which fixes an issue).
  • New feature or enhancement (non-breaking change which adds functionality).

Checklist

  • If applicable, I have tested my code for new features & regressions on the latest version of Home Assistant.

Additional notes

The token-in-logs issue is the most urgent. It only triggers when debug logging is enabled, but the README's own troubleshooting section instructs users to enable it, making credential exposure likely for anyone debugging the integration.

smcneece added 2 commits June 7, 2026 18:14
- Remove auth token from debug log statements (api.py, config_flow.py)
  - Add URL validation for pet avatar fetch to prevent SSRF
  - Remove unused make_api_call function and its imports across 11 files
  - Add "Change login credentials" option to the options flow gear menu
  - Add reconfigure flow via the three-dot menu (HA 2024.3+ standard)
  - Add translations for new credential update UI
@jjjonesjr33 jjjonesjr33 self-assigned this Jun 8, 2026
@github-project-automation github-project-automation Bot moved this to To triage in Petlibro Jun 8, 2026
@jjjonesjr33 jjjonesjr33 added this to the Other milestone Jun 8, 2026
@jjjonesjr33 jjjonesjr33 added the Enhancement New feature or request label Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request

Projects

Status: To triage

Development

Successfully merging this pull request may close these issues.

2 participants