Skip to content

Conversation

@bomoko
Copy link
Contributor

@bomoko bomoko commented Oct 9, 2025

This pull request updates the RemoveAppInstancesByEmail command to support searching for app instances by email patterns using SQL wildcards (%), rather than only exact email addresses. The changes improve flexibility for bulk operations and enhance the information shown in command output.

@bomoko bomoko requested a review from Copilot October 9, 2025 23:39
Copy link
Contributor

Copilot AI left a comment

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 enhances the RemoveAppInstancesByEmail command to support wildcard patterns using SQL LIKE syntax with % characters, allowing bulk removal of app instances matching email patterns instead of just exact email addresses. The changes improve operational flexibility for managing multiple app instances.

  • Added wildcard pattern support using SQL LIKE queries for flexible email matching
  • Enhanced command output to display email addresses in the results table
  • Updated validation logic to handle both exact emails and wildcard patterns

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

// Find all app instances with the given email or pattern in their data
if ($isPattern) {
// Use raw SQL for pattern matching (compatible with MariaDB/MySQL)
$instances = PolydockAppInstance::whereRaw("JSON_UNQUOTE(JSON_EXTRACT(data, '$.\"user-email\"')) LIKE ?", [$email])->get();
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

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

The raw SQL query with user input could be vulnerable to SQL injection. Consider using a parameterized query builder method or additional input sanitization to ensure the email pattern is properly escaped.

Suggested change
$instances = PolydockAppInstance::whereRaw("JSON_UNQUOTE(JSON_EXTRACT(data, '$.\"user-email\"')) LIKE ?", [$email])->get();
$instances = PolydockAppInstance::where(
DB::raw('JSON_UNQUOTE(JSON_EXTRACT(data, \'$."user-email"\'))'),
'LIKE',
$email
)->get();

Copilot uses AI. Check for mistakes.
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