Skip to content

Conversation

@dermatz
Copy link
Collaborator

@dermatz dermatz commented Dec 8, 2025

…xes and log regex improvements

@dermatz dermatz requested a review from Copilot December 8, 2025 10:57
@dermatz dermatz merged commit c106f11 into main Dec 8, 2025
11 checks passed
@dermatz dermatz deleted the fix-1.23.0-security-issues-and-log-regex branch December 8, 2025 11:02
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 bumps the version to 1.23.1 and introduces important reliability and code quality improvements. The main focus is enhancing log level detection to support both uppercase and lowercase formats (e.g., .WARN: and .warn:), improving null safety for the status bar item, and cleaning up unused code.

Key Changes:

  • Enhanced regex pattern from \.(\w+): to \.([A-Za-z]+): for more reliable and restrictive log level parsing
  • Added null safety checks for the status bar item to prevent potential crashes
  • Removed unused code and parameters to improve maintainability

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
package.json Version bumped from 1.23.0 to 1.23.1
CHANGELOG.md Added comprehensive release notes for version 1.23.1 documenting regex improvements, null safety fixes, and refactoring
src/logViewer.ts Changed statusBarItem to optional type, added null checks, updated log level regex pattern to \.([A-Za-z]+):, removed unused label parameter from getLogItems() methods
src/helpers.ts Added null safety check for statusBarItem access, removed unused getAllReportFiles() function
src/extension.ts Removed unused import selectMagentoRootFolder
src/test/reportReader.test.ts Updated test interface to match actual implementation signature (removed unused label parameter)
.gitignore Added entry to ignore Codacy AI rules instructions file
.codacy/codacy.yaml Added new Codacy configuration with runtime and tool specifications
.codacy/cli.sh Added new Codacy CLI download and execution script (contains a critical bug - missing fatal function definition)

handle_rate_limit() {
local response="$1"
if echo "$response" | grep -q "API rate limit exceeded"; then
fatal "Error: GitHub API rate limit exceeded. Please try again later"
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The script calls a fatal function on lines 65, 78, and 142, but this function is never defined. This will cause the script to fail with "fatal: command not found" when these error conditions are encountered.

Consider adding a fatal function definition at the beginning of the script:

fatal() {
    echo "Error: $1" >&2
    exit 1
}

Copilot uses AI. Check for mistakes.
@@ -1,5 +1,5 @@
import * as vscode from 'vscode';
import { promptMagentoProjectSelection, showErrorMessage, activateExtension, isValidPath, deleteReportFile, clearFileContentCache, selectMagentoRootFolder, selectMagentoRootFolderDirect, getEffectiveMagentoRoot, selectMagentoRootFromSettings, autoCleanupOldLogFiles, stopPeriodicCleanup } from './helpers';
import { promptMagentoProjectSelection, showErrorMessage, activateExtension, isValidPath, deleteReportFile, clearFileContentCache, selectMagentoRootFolderDirect, getEffectiveMagentoRoot, selectMagentoRootFromSettings, autoCleanupOldLogFiles, stopPeriodicCleanup } from './helpers';
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

Unused import autoCleanupOldLogFiles.

Suggested change
import { promptMagentoProjectSelection, showErrorMessage, activateExtension, isValidPath, deleteReportFile, clearFileContentCache, selectMagentoRootFolderDirect, getEffectiveMagentoRoot, selectMagentoRootFromSettings, autoCleanupOldLogFiles, stopPeriodicCleanup } from './helpers';
import { promptMagentoProjectSelection, showErrorMessage, activateExtension, isValidPath, deleteReportFile, clearFileContentCache, selectMagentoRootFolderDirect, getEffectiveMagentoRoot, selectMagentoRootFromSettings, stopPeriodicCleanup } from './helpers';

Copilot uses AI. Check for mistakes.
if [ "$#" -eq 1 ] && [ "$1" = "download" ]; then
echo "Codacy cli v2 download succeeded"
else
eval "$run_command $*"
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

Using eval "$run_command $*" to invoke the Codacy CLI builds a shell command string from CLI arguments, which allows shell metacharacters in those arguments to inject additional commands. For example, calling the script with an argument like "analyze; rm -rf /" would cause rm -rf / to be executed as a separate shell command. Replace this with a direct invocation such as "$run_command" "$@" so arguments are passed as argv elements instead of being re-parsed by the shell.

Suggested change
eval "$run_command $*"
"$run_command" "$@"

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