# Permissive Screenshot option set

## Overview

* **Rule ID**: `java_android_prevent_screenshot`
* **Applicable Languages**: Java
* **Weakness ID**: CWE-200

## Description

The Android operating system has the capability to capture screenshots of the current application view, even when the app is minimized. This capability is governed by the FLAG\_SECURE option. If FLAG\_SECURE is not enabled, Android allows screenshots to capture potentially sensitive information.

## Risks

Android apps without **FLAG\_SECURE** enabled can inadvertently capture and expose sensitive user data through screenshots, potentially compromising privacy and security.

## Remediation Guidelines

Ensure the **FLAG\_SECURE** option is set to `true` in your Android application to prevent the system from capturing screenshots of your app's activities. This is essential for safeguarding potentially sensitive information from being captured and stored in screenshots.

`getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);`

## References

* [**CWE-200: Exposure of Sensitive Information to an Unauthorized Actor**](https://cwe.mitre.org/data/definitions/200.html)
* [**A01:2021 - Broken Access Control**](https://owasp.org/Top10/A01_2021-Broken_Access_Control/)

## Configuration

To omit this rule during a scan, and to provide you with continuous 24/7 code-level scanning, you can employ our [**SAST TOOL**](https://scopy.sec1.io/login)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sec1.io/user-docs/4-sast/2-java/permissive-screenshot-option-set.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
