Repository navigation
Add C# and ASP.NET Core - #16
Merged
Merged
Conversation
C# carries four checks that hold for any dotnet deployment: a release build rather than a debug one, package versions that cannot move between restores, a pinned framework and SDK, and vulnerable packages reviewed including transitive ones. ASP.NET Core carries seven, three of them critical, and all three are about what the framework does when nobody told it otherwise. The environment name decides whether the developer exception page is served, so an unset or Development value means full stack traces and source lines are returned to anyone who can make the application throw. The exception page itself is often called unconditionally rather than inside an environment check, which produces the same result on purpose. And a connection string with a password in a settings file is committed, published in the build output and copied into every image layer, which is the most common way a database credential leaves a dotnet repository. The rest: data protection keys persisted so a restart does not sign out every user, the generated API browser kept off the public internet, detailed errors off, and forwarded headers handled behind a proxy. All eleven commands were run against a throwaway project carrying each mistake and each surfaced it. learn.microsoft.com added to the reference allowlist; every reference resolves.
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.
Tier 1, item 4.
universal → csharp → web → csharp.aspnet-core, 19 composed.C# (4)
Release build rather than debug, package versions that cannot move between
restores, framework and SDK pinned, vulnerable packages reviewed including
transitive.
ASP.NET Core (7)
Three critical, and all three are about what the framework does when nobody
told it otherwise:
environment-is-production— the environment name decides which configwins and whether the developer exception page is served. Unset or left as
Development means stack traces and source lines returned to anyone who can
make it throw.
developer-exception-page-guarded— commonly called unconditionallyinstead of inside an environment check, which produces that outcome
deliberately.
no-secrets-in-appsettings— a connection string with a password iscommitted, published in build output, and copied into every image layer. The
most common way a database credential leaves a dotnet repo.
Then data protection keys persisted (default keys live in the container
filesystem, so a restart signs out every user and two instances cannot read each
other's cookies), the generated API browser kept private, detailed errors off,
forwarded headers handled behind a proxy.
Verification
All eleven commands run against a throwaway project carrying every mistake — a
Version="4.*",ASPNETCORE_ENVIRONMENT=Development, an unguardedUseDeveloperExceptionPage(), aPassword=inappsettings.json,"DetailedErrors": true,UseSwagger()with no guard, and no data protectionor forwarded headers config at all. Each surfaced its target, including the two
that had to correctly report nothing configured.
The
-B3context on the exception-page and Swagger checks is deliberate: itshows the agent whether an environment guard sits above the call, which is the
entire question.
learn.microsoft.comadded to the allowlist;--check-linkspasses.