-
Notifications
You must be signed in to change notification settings - Fork 1k
[API Suggestion][Security] Add ExcludeFromScreenCapture API to Forms/Controls #13258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
What's the Windows 11 version 22H2 API for ScreenCaptureMode.Blur? |
@KlausLoeffelmann Please update the proposal to include namespaces and classes for each code segment, so we don't eat up meeting time by adding them live. Bitte, machen Sie diese Thema die Namespacennamen und die Classennamen zu haben, deshalb wir waehrend dem Treffen Mullzeit nicht machen werden. |
We had this as part of the initial discussions, but we are no longer considering this. |
Assuming "Müllzeit", I will definitely steal this word creation and use it from now on, when I speak German! 😄 |
IMO the documentation should clearly call out that this API simply makes a request of the OS. It's up to other agents -- either the OS itself or other applications running on the machine -- to enforce this request. Specifically, this flag will not prevent other applications running under your user session from capturing screen shots of your application. Yes, those other applications would have to jump through hoops to do so since the normal OS-provided screencap APIs will honor this flag, but it's critical to document that .NET does not itself provide any type of enforcement mechanism for this request. |
namespace System.Windows.Forms;
public partial class Control
{
public ScreenCaptureMode ScreenCaptureMode { get; set; }
}
public enum ScreenCaptureMode
{
Allow = 0,
HideContent = 1,
HideWindow = 2,
} |
@GrabYourPitchforks: Excellent point. I am even considering including a small warning-like remark directly in the XML Summary. |
FYI: This API doesn't affect AnyDesk. |
@bartonjs @KlausLoeffelmann We can reflect this restriction in the field name - HideTopLevelWindow |
@KlausLoeffelmann - you didn't reflect that in the API declaration in your proposal - category, explicit default value, property description.
What is the default value of this property? Anything other than Designer features take screen captures (drag and drop, wait while reloading) we should make sure to shadow this property in the ControlDesigner.
What was the conclusion on this? I wouldn't throw, it seems reasonable to make parent control "invisible" to capture because you don't want any children captured either. How do we handle running on a lower level OS? Fail silently? |
TL;DR
With the rise of continuous screen capture tools for AI analysis, sensitive LOB applications are at increased risk of data leakage. This proposal adds a simple API to WinForms that allows developers to prevent their forms and controls from being captured in screenshots, addressing a critical security concern for applications that handle sensitive data.
Rationale
Modern productivity tools increasingly use continuous screen capturing to feed content to LLMs for summarization, analysis, and automation. While this offers productivity benefits, it creates significant security risks for certain Line of Business (LOB) applications that handle sensitive data, or at least certain areas of those apps.
Here are a few thoughts, which types of applications might require protection against unauthorized screen captures:
Healthcare Applications: Applications displaying patient records, medical histories, test results, or other protected health information (PHI) covered under HIPAA regulations
Financial Applications: Banking software, investment platforms, or accounting systems showing account balances, transaction histories, credit card numbers, or tax information
Government Systems: Applications handling citizen data, social security numbers, tax records, or classified information
Legal Software: Case management systems containing privileged attorney-client communications, court filings, or sensitive legal strategies
Insurance Platforms: Systems displaying policy details, claims information, or personal policyholder data
HR Software: Applications showing employee records, salary information, performance reviews, or personal details
Educational Systems: Applications containing student records, grades, or other information protected under FERPA
Proposed API
Windows 10/11 provides the
SetWindowDisplayAffinity
API with the optionsWDA_NONE
,WDA_Monitor
andWDA_EXCLUDEFROMCAPTURE
that can block most software-based screen capture methods. This proposal wraps this functionality in a simple, easy-to-use WinForms API that raises awareness about this security concern and gives developers a straightforward way to protect sensitive information.New Property for
Form
ClassAlternatively: New Property for
Control
ClassI mention this, that we had this considered, but meanwhile with reservations. If we decided, to do it on control level, that would automatically include every control up the inheritance hierarchy.
But. This is subject to more testing, and there is a risk to make it work reliably and would then lull the developer into a false sense of security.
Additional Supporting APIs
New Form Configuration in Visual Studio Designer
Add a "Security" category in the Properties panel of the WinForms designer with the
ExcludeFromScreenCapture
property for easy discovery and configuration.Implementation Notes
ControlCollection
with its ScreenCaptureMode set to anything else thanAllow
.Limitations/Discussion points
Benefits
The text was updated successfully, but these errors were encountered: