Skip to content

fix(config): handle os.userInfo() failure in container/sandbox environments#29289

Closed
LifeJiggy wants to merge 1 commit into
anomalyco:devfrom
LifeJiggy:fix/os-userinfo-crash
Closed

fix(config): handle os.userInfo() failure in container/sandbox environments#29289
LifeJiggy wants to merge 1 commit into
anomalyco:devfrom
LifeJiggy:fix/os-userinfo-crash

Conversation

@LifeJiggy
Copy link
Copy Markdown

@LifeJiggy LifeJiggy commented May 26, 2026

Issue for this PR

Closes #29292

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The loadInstanceState() function in config.ts calls os.userInfo().username to set a default username when none is configured. In minimal Docker/OCI containers where the passwd entry is unavailable, os.userInfo() throws an error, causing config initialization failure. The fix wraps the call in try/catch with a "user" fallback.

How did you verify your code works?

  • Added a test that mocks os.userInfo() to throw ENOENT and verifies config loads with username = "user"
  • Full config test suite passes (92/92)

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

…nments

The loadInstanceState function calls os.userInfo().username to set
a default username when none is configured. In minimal Docker/OCI
containers or sandboxed environments where the passwd entry is
unavailable, os.userInfo() throws an error. Wrap in try/catch with
user fallback to prevent config initialization failure.
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels May 26, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions Bot removed needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels May 26, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

Config initialization crashes when os.userInfo() fails in containers

2 participants