Security package SA: startup hooks off, inherited .NET settings named, launch-path variables from trusted sources - #48
Merged
Conversation
… and stop reading launch-path variables from our own environment An elevated process inherits the environment of the account that started it, and that environment can be written by a process of the same account without elevation. Three consequences of that are closed or made visible here. - StartupHookSupport is false for every project in Directory.Build.props. StartupHookGuards asks the running test host for System.StartupHookProvider.IsSupported rather than reading the property back, and refuses a project that overrides it. - Profiler, trace, dump and diagnostic-port settings cannot be switched off from inside a .NET program, so an elevated session now names any it finds: the command line on the error channel before it reads anything, the window in the line under the list. Without administrator rights nothing changes. - ManagerEnvironment no longer falls back to this process's environment. Injected names such as ProgramFiles and ProgramData come from sources measured not to follow it, and the machine block is read as written, because the framework's own reading expands it with this process's variables. A name nothing here can answer for stays as written, and a file not found under it is reported as not read rather than missing. - README, the FAQ pages and SECURITY.md describe what is not closed: the window unpacks its native libraries to the account's temporary folder, and same-account code is handled as defence in depth rather than as a boundary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
First package of the security review: what an elevated process inherits from the account that started it.
What changes
StartupHookSupportinDirectory.Build.props).StartupHookGuardsasks the running test host whetherSystem.StartupHookProvider.IsSupportedis on, and refuses any project that sets the property itself. The published single-filebws.execarriesfalsein its embedded runtimeconfig.ProgramFiles,ProgramData,PUBLIC,SystemDriveand the x86 variants) come from sources measured not to follow the environment, and the machine block is read raw from the registry becauseEnvironment.GetEnvironmentVariables(Machine)expands it with this process's variables. A name nothing here knows stays as written, and a file not found under it is "not read" rather than "missing".SECURITY.md).No contract change: no JSON field, switch, exit code or snapshot schema.
How it was checked
tools/compatagainst the previous CLI build: 801 entries, identical field for field on an ordinary environment.Not checked
🤖 Generated with Claude Code