Skip to content

C#: Document custom redaction barriers - #23201

Merged
michaelnebel merged 2 commits into
github:mainfrom
SkyCipherr:codex/document-csharp-redaction-model
Dec 4, 2026
Merged

michaelnebel merged 2 commits into
github:mainfrom
SkyCipherr:codex/document-csharp-redaction-model

Conversation

@SkyCipherr

@SkyCipherr SkyCipherr commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Document that custom C# redaction methods can be modeled as barriers for cs/exposure-of-sensitive-information using the file-content-store kind. The query help links to the public C# model customization documentation for details on defining these models.

Rendered the revised query help with codeql generate query-help --format=markdown --warnings=error and checked the resulting recommendation and reference link. Verified that the linked documentation returns HTTP 200 and covers barrier models. git diff --check passes.

Fixes #23160.

@SkyCipherr
SkyCipherr requested a review from a team as a code owner November 23, 2026 05:35
Copilot AI adaptive review requested due to automatic review settings November 23, 2026 05:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The review evidence identifies no active issues, and the change is limited to documenting custom redaction barrier modeling and its relevant CodeQL guidance.

No open issues 🎉

What changed in this PR

Documents how C# users can model custom redaction methods as barriers for cs/exposure-of-sensitive-information, preventing alerts on redacted values while preserving alerts for raw sensitive data.

Changes:

  • Adds a YAML barrierModel example targeting the file-content-store barrier kind.
  • Explains the ReturnValue access path and links to the C# library-model customization documentation.
File Description
csharp/​ql/​src/​Security Features/​CWE-359/​ExposureOfPrivateInformation.qhelp Documents custom redaction barrier modeling and provides a relevant CodeQL documentation link.

Review effort: Lite (adaptive)

@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

QHelp previews:

csharp/ql/src/Security Features/CWE-359/ExposureOfPrivateInformation.qhelp

Exposure of private information

Private information that is stored in an external location may be more vulnerable because that location may not be protected by the same access controls as other parts of the system.

Examples include log files, cookies and plain text storage on disk.

Recommendation

Ensure that private information is only stored in secure data locations.

Custom methods that redact private information can be modeled as barriers for this query using the file-content-store kind. See the references below for details on defining these models.

Example

The following example shows some private data - an address - being passed to a HTTP handler. This private information is then stored in a log file. This log file on disk may be accessible to users that do not normally have access to this private data.

using System.Text;
using System.Web;
using System.Web.Security;

public class PrivateInformationHandler : IHttpHandler
{

    public void ProcessRequest(HttpContext ctx)
    {
        string address = ctx.Request.QueryString["Address1"];
        logger.Info("User has address: " + address);
    }
}

References

@michaelnebel michaelnebel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!
Thank you!

@michaelnebel
michaelnebel merged commit b8f19a1 into github:main Dec 4, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

C#: cs/exposure-of-sensitive-information has no documented way to mark a custom masking function as a sanitizer

3 participants