Skip to content

Commit 01a08d4

Browse files
Apply suggestions from code review
Co-authored-by: Felicity Chapman <[email protected]>
1 parent a540aaa commit 01a08d4

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

java/ql/src/Security/CWE/CWE-441/UnsafeContentUriResolution.qhelp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,19 @@
88
object. <code>ContentResolver</code>s communicate with an instance of a class that implements the
99
<code>ContentProvider</code> interface via URIs with the <code>content://</code> scheme.
1010

11-
The authority part (the first path segment) of the URI passed as parameter to the <code>ContentResolver</code>
11+
The authority part (the first path segment) of the URI, passed as parameter to the <code>ContentResolver</code>,
1212
determines which content provider is contacted for the operation. Specific operations that act on files also
1313
support the <code>file://</code> scheme, in which case the local filesystem is queried instead.
1414

15-
If an external component, like a malicious or compromised application, controls the URI that is used in a
15+
If an external component, like a malicious or compromised application, controls the URI for a
1616
<code>ContentResolver</code> operation, it can trick the vulnerable application into accessing its own private
17-
files or non-exported content providers. Depending on what the vulnerable application does after accessing the file,
18-
the attacking application might get access to the file by forcing it to be copied to a public directory like the
19-
external storage, or tamper with it by making the application overwrite it with unexpected data.
17+
files or non-exported content providers. The attacking application might be able to get access to the file by forcing it to be copied to a public directory, like
18+
external storage, or tamper with the contents by making the application overwrite the file with unexpected data.
2019
</p>
2120
</overview>
2221
<recommendation>
2322
<p>
24-
If possible, avoid using externally-provided data to determine URIs used by a <code>ContentResolver</code>.
23+
If possible, avoid using externally-provided data to determine the URI for a <code>ContentResolver</code> to use.
2524
If that is not an option, validate that the incoming URI can only reference trusted components, like an allow list
2625
of content providers and/or applications, or alternatively make sure that the URI does not reference private
2726
directories like <code>/data/</code>.

0 commit comments

Comments
 (0)