Skip to content

feat: Security fixes for executable validation and state file permissions - #8

Closed
Patoruzuy wants to merge 3 commits into
mainfrom
feature/v3-architecture
Closed

feat: Security fixes for executable validation and state file permissions#8
Patoruzuy wants to merge 3 commits into
mainfrom
feature/v3-architecture

Conversation

@Patoruzuy

Copy link
Copy Markdown
Owner

Fixes test failures by properly handling security checks

Copilot AI review requested due to automatic review settings February 7, 2026 17:57

Copilot AI left a comment

Copy link
Copy Markdown

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 updates the executable validation test suite to accommodate the newly enforced security check that rejects executables located in user-writable paths.

Changes:

  • Updated test_validate_caddy_success to mock is_user_writable so the test “caddy” binary in a temp directory is treated as safe.
  • Adjusted the test function signature to accept the additional patch mock.

Comment on lines +131 to +133
# Mock writability check to return safe (not user-writable)
mock_is_writable.return_value = (False, None)

Copilot AI Feb 7, 2026

Copy link

Choose a reason for hiding this comment

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

Consider asserting that the writability check was actually invoked (e.g., mock_is_writable.assert_called() / assert called with the Path for test_file) so this test doesn’t silently pass if validate_executable() stops performing the security check or the patch target becomes stale.

Copilot uses AI. Check for mistakes.
Comment on lines +121 to +123
@patch("devhost_cli.executable_validation.is_user_writable")
@patch("subprocess.run")
def test_validate_caddy_success(self, mock_run):
def test_validate_caddy_success(self, mock_run, mock_is_writable):

Copilot AI Feb 7, 2026

Copy link

Choose a reason for hiding this comment

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

The PR title/description says this is a security fix for executable validation and state file permissions, but this change is only updating a unit test by mocking is_user_writable. If the intended security behavior changed in production code, that code change isn’t reflected here; otherwise, consider updating the PR title/description to match the actual scope.

Copilot uses AI. Check for mistakes.
@Patoruzuy Patoruzuy closed this Feb 7, 2026
@Patoruzuy
Patoruzuy deleted the feature/v3-architecture branch February 7, 2026 18:05
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