Skip to content

Sanitize serialized library errors#441

Open
TsuyoshiUshio wants to merge 4 commits into
v4.xfrom
fix/sanitize-library-error-serialization
Open

Sanitize serialized library errors#441
TsuyoshiUshio wants to merge 4 commits into
v4.xfrom
fix/sanitize-library-error-serialization

Conversation

@TsuyoshiUshio
Copy link
Copy Markdown
Contributor

Summary

  • add credential-aware sanitization when serializing non-Error thrown values
  • redact credential-like property names and known credential tokens while preserving useful object context
  • handle circular references in thrown objects without throwing during error conversion
  • add tests for credential properties, credential tokens, URL credentials, and circular references

Notes

This is a first implementation intended to support review and discussion. The worker PR handles the primary invocation-failure path before errors are sent to the host; this library PR keeps @azure/functions behavior aligned for library-level conversions/logging.

Validation

  • npm test (378 passing)
  • npm run lint

Redact credential-like properties and known credential tokens when serializing non-Error values so thrown objects retain useful context without exposing obvious secrets.

Co-authored-by: Dobby <dobby@microsoft.com>
@TsuyoshiUshio TsuyoshiUshio requested a review from a team as a code owner May 19, 2026 21:18
Comment thread src/errors.ts
Comment thread src/errors.ts Outdated
Comment thread src/errors.ts Outdated
Comment thread src/errors.ts Outdated
Copy link
Copy Markdown
Contributor

@swapnil-nagar swapnil-nagar left a comment

Choose a reason for hiding this comment

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

Reverting accidental approavl

swapnil-nagar
swapnil-nagar previously approved these changes May 20, 2026
Comment thread src/utils/credentialSanitizer.ts
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