Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/smoke-copilot.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions actions/setup/js/merge_remote_agent_github_folder.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -146,23 +146,23 @@ function validateGitParameter(value, name) {
*/
function validateSafePath(userPath, basePath, name) {
// Reject paths with null bytes
if (userPath.includes('\0')) {
if (userPath.includes("\0")) {
throw new Error(`Invalid ${name}: contains null bytes`);
}

// Reject paths that attempt to traverse up (..)
if (userPath.includes('..')) {
if (userPath.includes("..")) {
throw new Error(`Invalid ${name}: path traversal detected`);
}

// Resolve the full path and ensure it's within the base path
const resolvedPath = path.resolve(basePath, userPath);
const resolvedBase = path.resolve(basePath);

if (!resolvedPath.startsWith(resolvedBase + path.sep) && resolvedPath !== resolvedBase) {
throw new Error(`Invalid ${name}: path escapes base directory`);
}

return resolvedPath;
}

Expand Down Expand Up @@ -239,7 +239,7 @@ function mergeGithubFolder(sourcePath, destPath) {
for (const relativePath of sourceFiles) {
// Validate relative path to prevent path traversal
validateSafePath(relativePath, sourcePath, "relative file path");

// Check if the file is in one of the allowed subfolders
const pathParts = relativePath.split(path.sep);
const topLevelFolder = pathParts[0];
Expand Down
3 changes: 2 additions & 1 deletion actions/setup/js/safe_output_handler_manager.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,8 @@ async function main() {
core.warning(`✗ Failed to submit PR review: ${reviewResult.error}`);
}
} catch (reviewError) {
core.warning(`✗ Exception while submitting PR review: ${reviewError.message || reviewError}`);
const errorMessage = reviewError instanceof Error ? reviewError.message : String(reviewError);
Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot use helper to get error message

Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

This changes behavior compared to the previous reviewError.message || reviewError: if something throws a non-Error object that has a message field (common in some libraries), instanceof Error will be false and the log will become "[object Object]" instead of the actual message. Also, for Error instances with an empty message, this will log an empty string.

Consider extracting via the existing getErrorMessage(reviewError) helper (already used throughout this file), and preserve a fallback to String(reviewError) when the extracted message is empty.

Suggested change
const errorMessage = reviewError instanceof Error ? reviewError.message : String(reviewError);
const errorMessage = getErrorMessage(reviewError) || String(reviewError);

Copilot uses AI. Check for mistakes.
core.warning(`✗ Exception while submitting PR review: ${errorMessage}`);
}
}

Expand Down
3 changes: 2 additions & 1 deletion actions/setup/js/safe_output_unified_handler_manager.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,8 @@ async function main() {
core.warning(`✗ Failed to submit PR review: ${reviewResult.error}`);
}
} catch (reviewError) {
core.warning(`✗ Exception while submitting PR review: ${reviewError.message || reviewError}`);
const errorMessage = reviewError instanceof Error ? reviewError.message : String(reviewError);
Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot use helper to get error message

Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

This changes behavior compared to the previous reviewError.message || reviewError: if something throws a non-Error object that has a message field, instanceof Error will be false and the log will become "[object Object]" instead of the message. Also, for Error instances with an empty message, this will log an empty string.

Consider using the existing getErrorMessage(reviewError) helper (already imported/used in this file) and keep a fallback to String(reviewError) when the extracted message is empty.

Suggested change
const errorMessage = reviewError instanceof Error ? reviewError.message : String(reviewError);
const errorMessage = getErrorMessage(reviewError) || String(reviewError);

Copilot uses AI. Check for mistakes.
core.warning(`✗ Exception while submitting PR review: ${errorMessage}`);
}
}

Expand Down
Loading