Skip to content

security: strip Axios config/request objects from serialized error re…#653

Open
Nareshkumawat-star wants to merge 1 commit into
vijaypatil477:mainfrom
Nareshkumawat-star:fix/error-handler-security
Open

security: strip Axios config/request objects from serialized error re…#653
Nareshkumawat-star wants to merge 1 commit into
vijaypatil477:mainfrom
Nareshkumawat-star:fix/error-handler-security

Conversation

@Nareshkumawat-star
Copy link
Copy Markdown

✦ Description

Fixes a security concern where sensitive credentials (such as the server-side GROQ_API_KEY) were leaked inside Axios error objects/stack traces when the Express server encountered an HTTP error during requests to third-party endpoints (e.g. Groq AI API) in development mode (NODE_ENV=development).

**##Fixes #652 **

Cause:

When Axios requests fail, they throw an AxiosError containing config and request properties. If NODE_ENV=development is active, the centralized error handler would return the error, exposing config.headers.Authorization containing the raw API key in the response body.

Fix:

Updated the error handler middleware in server/middleware/errorHandler.js to explicitly strip err.config and err.request from the error object before serializing or logging:

  // Strip sensitive request config and request objects from Axios/HTTP errors to prevent leaking keys/headers
  if (err.config) {
    delete err.config;
  }
  if (err.request) {
    delete err.request;
  }
Fixes # [Insert Issue Number Here]

 Type of Change
 Bug fix (non-breaking change which fixes an issue)
 Checklist
 My code follows the style guidelines of this project.
 I have performed a self-review of my code.
 My changes generate no new warnings or console errors.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 4, 2026

Someone is attempting to deploy a commit to the omkh4242g-1671's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc Official GSSoC '26 issue tag level:beginner GSSoC '26 Beginner difficulty issue labels Jun 4, 2026
@github-actions github-actions Bot added quality:clean Clean code structure standards gssoc:approved GSSoC '26 Approved issue labels Jun 4, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

Hi @Nareshkumawat-star, thanks for contributing to Debugra! 🎉

I have automatically:

  • 👤 Assigned this PR to you.
  • 🏷️ Applied the gssoc:approved label.

Our workflows will now analyze your changes to classify:

  • 📈 PR Difficulty: level:*
  • 🧩 PR Type: type:*
  • 🌟 PR Quality: quality:*

Tip

Ensure your PR description references the issue it resolves (e.g. Closes #123). This allows the bot to inherit any additional labels from that issue!

Happy coding! 🚀

@github-actions github-actions Bot added type:bug Vulnerability or logical bug fixes type:devops CI/CD, infrastructure, or tooling changes type:security Security patches and threat fixes labels Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved GSSoC '26 Approved issue gssoc Official GSSoC '26 issue tag level:beginner GSSoC '26 Beginner difficulty issue quality:clean Clean code structure standards type:bug Vulnerability or logical bug fixes type:devops CI/CD, infrastructure, or tooling changes type:security Security patches and threat fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SEC] Groq API key exposed in client-side network requests when VITE_API_URL points to localhost

1 participant