Repository navigation
fix: stop logging env var values and throw ProcessException on failure - #33
Merged
Merged
Conversation
…n failure - The invocation log line now lists only the names of configured environment variables, never their values, so secrets passed via EnvironmentVariables no longer reach the log. Arguments are still logged in full (lower InvocationLogLevel to hide them); this is documented on the option and in docs/logging.md. - A non-zero exit now throws the new public ProcessException (derives from Exception, so existing catch blocks still work) exposing ExitCode and the full ProcessRunResult. The message text is unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jy23TCq1bZkdPV2GRWfspU
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The architecture guidance incorrectly includes an internal type in the public surface while omitting a public type.
1 open finding
What changed in this PR
Prevents environment-value leakage in invocation logs and adds typed process-failure handling.
Changes:
- Logs environment variable names without values.
- Introduces
ProcessExceptionwith exit code and result details. - Adds synchronous/asynchronous tests and updates documentation.
| File | Description |
|---|---|
src/Invex.Process/ProcessRunner.cs |
Redacts environment values and throws ProcessException. |
src/Invex.Process/ProcessException.cs |
Defines the new typed exception. |
src/Invex.Process/ProcessRunOptions.cs |
Documents logging and failure behavior. |
tests/Invex.Process.Tests/ProcessRunnerTests.cs |
Tests both new behaviors. |
tests/Invex.Process.Tests/PublicApiTests.VerifyPublicApiSurface.verified.txt |
Records the new public type. |
README.md |
Updates failure-handling features. |
docs/handling-failures.md |
Documents typed exceptions. |
docs/logging.md |
Documents environment-name-only logging. |
docs/transforming-output.md |
Clarifies invocation logging. |
docs/testing.md |
Updates failure-faking example. |
docs/introduction.md |
Names the failure exception. |
api/index.md |
Adds the exception to the API map. |
AGENTS.md |
Updates architecture and behavioral contracts. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jy23TCq1bZkdPV2GRWfspU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Requested by Dec · project thread
Before: the invocation log line printed every environment variable as
NAME=valueat Information level, so secrets passed that way (API keys, tokens) ended up in build logs. A non-zero exit threw a plainSystem.Exception, so callers couldn't catch it specifically or read the exit code.After: the log line lists variable names only (
with env CI, NUGET_API_KEY). A non-zero exit throws the newProcessException, which carries theProcessRunResult(exit code, output, options) and anExitCodeshortcut. It derives fromException, so existingcatch (Exception)blocks still work, and the message text is unchanged.How:
ProcessRunnerbuilds the env part of the log from names only. Arguments are still logged in full, and the docs now explain how to keep secrets out of them: pass them as environment variables, or lowerInvocationLogLevel.ProcessExceptiontype. RCS1194 is suppressed with a justification, because the standard constructors would makeResultnullable.ProcessException.api/index.mdand AGENTS.md.Local check: the build passes with no warnings. The net10.0 tests pass, except the two cancellation tests that also fail locally on unmodified
main.🤖 Generated with Claude Code
https://claude.ai/code/session_01Jy23TCq1bZkdPV2GRWfspU
Generated by Claude Code