Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Security Policy

## Reporting a Vulnerability

If you discover a security vulnerability in React Native, please report it responsibly.

**Please do NOT report security vulnerabilities through public GitHub issues.**

Instead, please report them through [Facebook's Bug Bounty program](https://www.facebook.com/whitehat) or via [GitHub Security Advisories](https://github.com/facebook/react-native/security/advisories/new).

Please include:
- Type of issue
- Steps to reproduce
- Impact assessment
30 changes: 30 additions & 0 deletions packages/react-native/Libraries/Blob/FileReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ class FileReader extends EventTarget {
}

readAsArrayBuffer(blob: ?Blob): void {
if (this._readyState === LOADING) {
throw new DOMException(
'The object is in an invalid state.',
'InvalidStateError',
);
}

this._aborted = false;

if (blob == null) {
Expand All @@ -80,6 +87,9 @@ class FileReader extends EventTarget {
);
}

this._readyState = LOADING;
this.dispatchEvent(new Event('loadstart'));

NativeFileReaderModule.readAsDataURL(blob.data).then(
(text: string) => {
if (this._aborted) {
Expand All @@ -103,6 +113,13 @@ class FileReader extends EventTarget {
}

readAsDataURL(blob: ?Blob): void {
if (this._readyState === LOADING) {
throw new DOMException(
'The object is in an invalid state.',
'InvalidStateError',
);
}

this._aborted = false;

if (blob == null) {
Expand All @@ -111,6 +128,9 @@ class FileReader extends EventTarget {
);
}

this._readyState = LOADING;
this.dispatchEvent(new Event('loadstart'));

NativeFileReaderModule.readAsDataURL(blob.data).then(
(text: string) => {
if (this._aborted) {
Expand All @@ -130,6 +150,13 @@ class FileReader extends EventTarget {
}

readAsText(blob: ?Blob, encoding: string = 'UTF-8'): void {
if (this._readyState === LOADING) {
throw new DOMException(
'The object is in an invalid state.',
'InvalidStateError',
);
}

this._aborted = false;

if (blob == null) {
Expand All @@ -138,6 +165,9 @@ class FileReader extends EventTarget {
);
}

this._readyState = LOADING;
this.dispatchEvent(new Event('loadstart'));

NativeFileReaderModule.readAsText(blob.data, encoding).then(
(text: string) => {
if (this._aborted) {
Expand Down
Loading
Loading