Skip to content

πŸš€ Release: beta β†’ master#86

Merged
rajashish147 merged 3 commits into
masterfrom
beta
Apr 4, 2026
Merged

πŸš€ Release: beta β†’ master#86
rajashish147 merged 3 commits into
masterfrom
beta

Conversation

@rajashish147
Copy link
Copy Markdown
Collaborator

@rajashish147 rajashish147 commented Apr 4, 2026

πŸš€ Automated Release PR

This PR contains all changes from beta to master.


πŸ“¦ Latest Changes

  • fix: ESM healthcheck + CI exec validation
  • fix(docker): align HEALTHCHECK timing with liveness; robust healthcheck.js; deploy health debug

🧠 Notes

  • Auto-managed PR
  • Do not edit manually

@rajashish147 rajashish147 enabled auto-merge (squash) April 4, 2026 13:16
Comment thread healthcheck.js
},
);
function logErr(prefix, err) {
console.error(`[healthcheck] ${prefix}`, err);

Check warning

Code scanning / CodeQL

Log injection Medium

Log entry depends on a
user-provided value
.

Copilot Autofix

AI about 2 months ago

In general, to fix log injection in plain-text logs, remove or encode line breaks and other control characters from user-controlled data before logging them, and keep log format clearly delineated so injected text cannot masquerade as separate log entries.

For this specific code, the cleanest fix without changing observable functionality is:

  • Add a small helper that converts any error-like value into a safe, single-line string: it will stringify the error (using stack or message or String(err)), then strip \r and \n so the log output remains on one line.
  • Update logErr to log this sanitized string instead of the raw err argument. This preserves the information content (message/stack) while preventing an attacker from injecting extra log lines.

Concretely:

  • In healthcheck.js, define a helper function (e.g., formatErrorForLog) above logErr.
  • Modify logErr(prefix, err) so that instead of console.error('[healthcheck] ${prefix}', err); it builds a single string combining the prefix and a sanitized representation of err, and passes that to console.error. No new imports are required; we can use basic string methods and regex replacement.

Suggested changeset 1
healthcheck.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/healthcheck.js b/healthcheck.js
--- a/healthcheck.js
+++ b/healthcheck.js
@@ -17,8 +17,30 @@
   process.exit(code);
 }
 
+function formatErrorForLog(err) {
+  let msg;
+  if (err && typeof err === 'object') {
+    if (typeof err.stack === 'string') {
+      msg = err.stack;
+    } else if (typeof err.message === 'string') {
+      msg = err.message;
+    } else {
+      try {
+        msg = JSON.stringify(err);
+      } catch {
+        msg = String(err);
+      }
+    }
+  } else {
+    msg = String(err);
+  }
+  // Remove newline characters to prevent log injection via line breaks.
+  return msg.replace(/[\r\n]+/g, ' ');
+}
+
 function logErr(prefix, err) {
-  console.error(`[healthcheck] ${prefix}`, err);
+  const safeErr = formatErrorForLog(err);
+  console.error(`[healthcheck] ${prefix}: ${safeErr}`);
 }
 
 process.on('uncaughtException', (err) => {
EOF
@@ -17,8 +17,30 @@
process.exit(code);
}

function formatErrorForLog(err) {
let msg;
if (err && typeof err === 'object') {
if (typeof err.stack === 'string') {
msg = err.stack;
} else if (typeof err.message === 'string') {
msg = err.message;
} else {
try {
msg = JSON.stringify(err);
} catch {
msg = String(err);
}
}
} else {
msg = String(err);
}
// Remove newline characters to prevent log injection via line breaks.
return msg.replace(/[\r\n]+/g, ' ');
}

function logErr(prefix, err) {
console.error(`[healthcheck] ${prefix}`, err);
const safeErr = formatErrorForLog(err);
console.error(`[healthcheck] ${prefix}: ${safeErr}`);
}

process.on('uncaughtException', (err) => {
Copilot is powered by AI and may make mistakes. Always verify output.
@rajashish147 rajashish147 merged commit fa4c62f into master Apr 4, 2026
7 checks passed
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