Commit Graph

58419 Commits

Author SHA1 Message Date
Tony Mak
73f398d306 RESTRICT AUTOMERGE Do not linkify text with RLO/LRO characters.
Also don't show smart actions for selections in text with unsupported
characters.

Bug: 116321860
Test: runtest -x cts/tests/tests/text/src/android/text/util/cts/LinkifyTest.java

Change-Id: Id271cab8aef6b9b13ef17f1a8654c7616f75cf13
2019-01-03 14:07:30 +00:00
Jeff Sharkey
301d17e4dd RESTRICT AUTOMERGE: Recover shady content:// paths.
The path-permission element offers prefix or regex style matching of
paths, but most providers internally use UriMatcher to decide what
to do with an incoming Uri.

This causes trouble because UriMatcher uses Uri.getPathSegments(),
which quietly ignores "empty" paths.  Consider this example:

    <path-permission android:pathPrefix="/private" ... />

    uriMatcher.addURI("com.example", "/private", CODE_PRIVATE);

    content://com.example//private

The Uri above will pass the security check, since it's not
technically a prefix match.  But the UriMatcher will then match it
as CODE_PRIVATE, since it ignores the "//" zero-length path.

Since we can't safely change the behavior of either path-permission
or UriMatcher, we're left with recovering these shady paths by
trimming away zero-length paths.

Bug: 112555574
Test: cts-tradefed run cts -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AppSecurityTests
Change-Id: Ibadbfa4fc904ec54780c8102958735b03293fb9a
2018-10-05 00:19:08 +00:00
Michael Wachenschwanz
057a01d1f3 Verify number of Map entries written to Parcel
Make sure the number of entries written by Parcel#writeMapInternal
matches the size written. If a mismatch were allowed, an exploitable
scenario could occur where the data read from the Parcel would not
match the data written.

Fixes: 112859604
Test: cts-tradefed run cts -m CtsOsTestCases -t android.os.cts.ParcelTest

Change-Id: I325d08a8b66b6e80fe76501359c41b6656848607
Merged-In: I325d08a8b66b6e80fe76501359c41b6656848607
2018-08-30 13:40:44 -07:00
Seigo Nonaka
82c84d5fbb Fix crash during cursor moving on BiDi text
The crash was introduced by Ib66ef392c19c937718e7101f6d48fac3abe51ad0
The root cause of the crashing is requesting out-of-line access for the
horizontal width. This invalid access is silently ignored by
TextLine#measure() method but new implementation end up with out of
bounds access.

To makes behavior as old implementation, calling getHorizontal instead
of accessing measured result array.

Bug: 78464361, 111580019
Test: Manually done
Change-Id: I5c5778718f6b397adbb1e4f2cf95e9f635f6e5c8
(cherry picked from commit 960647d582)
Merged-In: I5c5778718f6b397adbb1e4f2cf95e9f635f6e5c8
2018-08-15 19:12:50 +00:00
Jeff Sharkey
8e95967f09 DO NOT MERGE. Extend SQLiteQueryBuilder for update and delete.
Developers often accept selection clauses from untrusted code, and
SQLiteQueryBuilder already supports a "strict" mode to help catch
SQL injection attacks.  This change extends the builder to support
update() and delete() calls, so that we can help secure those
selection clauses too.

Bug: 111085900
Test: atest packages/providers/DownloadProvider/tests/
Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java
Test: atest cts/tests/tests/database/src/android/database/sqlite/cts/SQLiteQueryBuilderTest.java
Change-Id: Ib4fc8400f184755ee7e971ab5f2095186341730c
Merged-In: Ib4fc8400f184755ee7e971ab5f2095186341730c
2018-08-03 13:42:35 -06:00
Jeff Sharkey
286fd5652a DO NOT MERGE. Execute "strict" queries with extra parentheses.
SQLiteQueryBuilder has a setStrict() mode which can be used to
detect SQL attacks from untrusted sources, which it does by running
each query twice: once with an extra set of parentheses, and if that
succeeds, it runs the original query verbatim.

This sadly doesn't catch inputs of the type "1=1) OR (1=1", which
creates valid statements for both tests above, but the final executed
query ends up leaking data due to SQLite operator precedence.

Instead, we need to continue compiling both variants, but we need
to execute the query with the additional parentheses to ensure
data won't be leaked.

Test: atest cts/tests/tests/database/src/android/database/sqlite/cts/SQLiteQueryBuilderTest.java
Bug: 111085900
Change-Id: I6e8746fa48f9de13adae37d2990de11c9c585381
Merged-In: I6e8746fa48f9de13adae37d2990de11c9c585381
2018-08-03 13:38:31 -06:00
Arthur Ishiguro
abe5a73a4a Resolve inconsistent parcel read in NanoAppFilter
Bug: 77599679
Test: Compile only
Change-Id: Ib417a5cb4d51744442d2fb14437cabbe5fd1c266
2018-07-06 22:54:52 +00:00
Mihai Popa
fd730b82f4 Merge "Optimise the hit test algorithm" into nyc-dev 2018-06-06 16:21:21 +00:00
Mihai Popa
71ecf5bd5c Optimise the hit test algorithm
Layout#getOffsetForHorizontal was running in O(n^2) time, where n is the
length of the current line. The method is used when a touch event
happens on a text line, to compute the cursor offset (and the character)
where it happened. Although this is not an issue in common usecases,
where the number of characters on a line is relatively small, this can
be very inefficient as a consequence of Unicode containing 0-width
(invisible) characters. Specifically, there are characters defining the
text direction (LTR or RTL), which cause our algorithm to touch the
worst case quadratic runtime. For example, a person is able to send a
message containing a few visible characters, and also a lot of these
direction changing invisible ones. When the receiver touches the message
(causing the Layout#getOffsetForHorizontal method to be called), the
receiver's application would become not responsive.

This CL optimizes the method to run in O(n) worst case. This is achieved
by computing the measurements of all line prefixes at first, which can
be done in a single pass. Then, all the prefix measurement queries will
be answered in O(1), rather than O(n) as it was happening before.

Bug: 79215201
Test: manual testing
Change-Id: Ib66ef392c19c937718e7101f6d48fac3abe51ad0
Merged-In: Ib66ef392c19c937718e7101f6d48fac3abe51ad0
2018-05-31 17:45:42 +01:00
Todd Kennedy
2263da9539 Make safe label more safe
* limit the absolute maximum size of the label to 50000 characters
[which is probably far more than necessary, but, can be dialed down]

* use a string buffer while processing the string [instead of creating
multiple string objects]

Bug: 62537081
Test: Manual. Install APK in bug and see that it can be uninstalled
Change-Id: Ibf63c2691ad7438a123e92110d95b1f50050f8b1
Merged-In: Ibf63c2691ad7438a123e92110d95b1f50050f8b1
2018-05-22 21:59:22 +00:00
Android Build Merger (Role)
9e291fe8c2 [automerger] Nullcheck to fix Autofill CTS am: 6c68a69288 am: 743abb939a am: a99414f51f am: 6b95503960
Change-Id: Ia3658c17dc890ca2de951da5c701e953ce8c969b
2018-05-09 17:19:18 +00:00
Android Build Merger (Role)
6b95503960 [automerger] Nullcheck to fix Autofill CTS am: 6c68a69288 am: 743abb939a am: a99414f51f
Change-Id: I7aaceff0646a5e738ed862c34645e548aabf62f1
2018-05-09 17:19:12 +00:00
Android Build Merger (Role)
a99414f51f [automerger] Nullcheck to fix Autofill CTS am: 6c68a69288 am: 743abb939a
Change-Id: Ia89ea1adb47be3b70f5db292677c4c19194a04db
2018-05-09 17:19:07 +00:00
Android Build Merger (Role)
743abb939a [automerger] Nullcheck to fix Autofill CTS am: 6c68a69288
Change-Id: I379d54d926e01da53b637bba6b3b1ee8577cbdbb
2018-05-09 17:19:02 +00:00
Eugene Susla
6c68a69288 Nullcheck to fix Autofill CTS
Test: presubmit
Fixes: 70506475
Bug: 69981755
Change-Id: I187bed4889a4901a7137a2995178ea651ed09186
2018-05-09 17:18:59 +00:00
Hansong Zhang
b6cde9ecc1 DO NOT MERGE Truncate newline and tab characters in BluetoothDevice name
Test: manual
Bug: 73173182
Change-Id: I3c25af233742e63351a68e8c5a279b51a94e49e2
2018-04-26 21:18:46 +00:00
Android Build Merger (Role)
365fb1c844 [automerger] DO NOT MERGE Truncate newline and tab characters in BluetoothDevice name am: 984dfe074c am: 8fbe4bce1e am: 0cd0cef08f
Change-Id: I937e2d9a676b38f6a18cda70f42d06eaa22ce051
2018-04-26 21:18:27 +00:00
Android Build Merger (Role)
0cd0cef08f [automerger] DO NOT MERGE Truncate newline and tab characters in BluetoothDevice name am: 984dfe074c am: 8fbe4bce1e
Change-Id: If7693b2ff5785a1a09920061b318aaac33f5d6b6
2018-04-26 21:18:21 +00:00
Android Build Merger (Role)
8fbe4bce1e [automerger] DO NOT MERGE Truncate newline and tab characters in BluetoothDevice name am: 984dfe074c
Change-Id: Iac403f5118d55d9919745d98eba260dd2929d56c
2018-04-26 21:18:14 +00:00
Hansong Zhang
984dfe074c DO NOT MERGE Truncate newline and tab characters in BluetoothDevice name
Test: manual
Bug: 73173182
Change-Id: I3c25af233742e63351a68e8c5a279b51a94e49e2
2018-04-26 14:17:52 -07:00
akirilov
33c37cb37c RESTRICT AUTOMERGE: Prevent reporting fake package name - framework (backport to nyc-dev)
Test: added AccessibilityEndToEndTest#testPackageNameCannotBeFaked
      cts-tradefed run cts -m CtsAccessibilityServiceTestCases
      cts-tradefed run cts -m CtsAccessibilityTestCases

Bug: 69981755
Change-Id: I187e3e9839f654cea9e06e5de93e10e4d1de3109
2018-04-09 22:24:05 +00:00
Android Build Merger (Role)
0df0b30be9 [automerger] RESTRICT AUTOMERGE: Prevent reporting fake package name - framework (backport to mnc-dev) am: de71ee469a am: d672eef559 am: 86f5488521
Change-Id: I9f6c6fedfdc987a2acf1978a71fb0bdcd034e9e0
2018-04-09 21:00:20 +00:00
Android Build Merger (Role)
86f5488521 [automerger] RESTRICT AUTOMERGE: Prevent reporting fake package name - framework (backport to mnc-dev) am: de71ee469a am: d672eef559
Change-Id: Ib50692050fd4e62ad80f24531818a378c75dfe25
2018-04-09 21:00:15 +00:00
Android Build Merger (Role)
d672eef559 [automerger] RESTRICT AUTOMERGE: Prevent reporting fake package name - framework (backport to mnc-dev) am: de71ee469a
Change-Id: I000fae45e723679ba44b378a36a85daef20ae96d
2018-04-09 21:00:08 +00:00
akirilov
de71ee469a RESTRICT AUTOMERGE: Prevent reporting fake package name - framework (backport to mnc-dev)
Test: added AccessibilityEndToEndTest#testPackageNameCannotBeFaked
      cts-tradefed run cts --package android.accessibilityservice
      cts-tradefed run cts --package android.accessibility

BUG:69981755

Change-Id: Id9990ccf1e88cea441f9b8927e849e67a059cfe4
2018-04-09 21:00:05 +00:00
Android Build Merger (Role)
9d13b0f6ca [automerger] DO NOT MERGE Rework thumbnail cleanup am: b514ce9b38 am: b8dad6c644 am: 019eec3923
Change-Id: I9f69b090824a6c91bf11dbc0929ba5988a06af52
2018-03-15 19:59:37 +00:00
Android Build Merger (Role)
019eec3923 [automerger] DO NOT MERGE Rework thumbnail cleanup am: b514ce9b38 am: b8dad6c644
Change-Id: I8539a02510ed9a61b683c66c66de7d1b319c2603
2018-03-15 19:59:32 +00:00
Android Build Merger (Role)
b8dad6c644 [automerger] DO NOT MERGE Rework thumbnail cleanup am: b514ce9b38
Change-Id: I5cb1316547ced23a1259e068d1ea34631d105608
2018-03-15 19:59:26 +00:00
Marco Nelissen
b514ce9b38 DO NOT MERGE Rework thumbnail cleanup
Bug: 63766886
Test: ran CTS tests
Change-Id: I1f92bb014e275eafe3f42aef1f8c817f187c6608
Merged-In: I1f92bb014e275eafe3f42aef1f8c817f187c6608
2018-03-15 19:58:42 +00:00
Marco Nelissen
0dc23f95a1 Rework thumbnail cleanup
Bug: 63766886
Test: ran CTS tests
Change-Id: I1f92bb014e275eafe3f42aef1f8c817f187c6608
Merged-In: I1f92bb014e275eafe3f42aef1f8c817f187c6608
2018-03-13 00:23:51 +00:00
Android Build Merger (Role)
a1ad0de1f7 [automerger] [DO NOT MERGE] Copy PermissionChecker from support lib and use in RcognitionService am: 5a28e533fe am: b91acca082 am: 26aaadd3b5
Change-Id: Icf7b82e7dfbdebeb382c56e2c1db061abd87a3e9
2018-03-09 00:35:53 +00:00
Android Build Merger (Role)
26aaadd3b5 [automerger] [DO NOT MERGE] Copy PermissionChecker from support lib and use in RcognitionService am: 5a28e533fe am: b91acca082
Change-Id: I0cbca14aed609ab81556ee1deb72ef1e0e294256
2018-03-09 00:35:48 +00:00
Android Build Merger (Role)
b91acca082 [automerger] [DO NOT MERGE] Copy PermissionChecker from support lib and use in RcognitionService am: 5a28e533fe
Change-Id: I09ac593ade4e725b560384042304f93f451b5be5
2018-03-09 00:35:42 +00:00
Eugene Susla
5a28e533fe [DO NOT MERGE] Copy PermissionChecker from support lib and use in RcognitionService
Fixes: 73511076, 73311729
Test: presubmit
Change-Id: Ie98f67ffee4744050ac85d8b229370a16a76a194
(cherry picked from commit 726b51a26e)
2018-03-09 00:35:39 +00:00
Siyamed Sinir
eaa093272e Merge "DO NOT MERGE Fix mTrustManager NPE" into mnc-dev 2018-02-15 00:14:36 +00:00
Android Build Merger (Role)
15a3e59d35 [automerger] DO NOT MERGE Fix mTrustManager NPE am: a381c4ced3 am: 30a705874a am: 85727109f0
Change-Id: I80463ee5315c2672e812659192b227c8271e9113
2018-02-15 00:05:49 +00:00
Android Build Merger (Role)
85727109f0 [automerger] DO NOT MERGE Fix mTrustManager NPE am: a381c4ced3 am: 30a705874a
Change-Id: Ic83a666bae330bea031b95233079e1493c02c9b3
2018-02-15 00:05:43 +00:00
Android Build Merger (Role)
30a705874a [automerger] DO NOT MERGE Fix mTrustManager NPE am: a381c4ced3
Change-Id: Ib622af453781a1769e820c10d6ab46c140809c57
2018-02-15 00:05:38 +00:00
Android Build Merger (Role)
bdff04aba3 [automerger] Adjust URI host parsing to stop on \ character. am: fa3afbd0e7 am: 97668ae137 am: fddbf1b6b2 am: d3c0db66b9 am: 373cfa75c0
Change-Id: Ia7b1157fb7f2066e26dc82ec703f39cd9fa69fd7
2018-01-31 11:20:28 +00:00
Android Build Merger (Role)
373cfa75c0 [automerger] Adjust URI host parsing to stop on \ character. am: fa3afbd0e7 am: 97668ae137 am: fddbf1b6b2 am: d3c0db66b9
Change-Id: If07298bb4ecf8a55391a014568a3ea264358b0e9
2018-01-31 11:20:21 +00:00
Android Build Merger (Role)
d3c0db66b9 [automerger] Adjust URI host parsing to stop on \ character. am: fa3afbd0e7 am: 97668ae137 am: fddbf1b6b2
Change-Id: I3fd20a3ee5eaa6be1c1989f13d40aed34136557e
2018-01-31 11:20:15 +00:00
Android Build Merger (Role)
fddbf1b6b2 [automerger] Adjust URI host parsing to stop on \ character. am: fa3afbd0e7 am: 97668ae137
Change-Id: Ic336b5fafebabdd4a5ad4d775a96d76739189a09
2018-01-31 11:20:08 +00:00
Android Build Merger (Role)
97668ae137 [automerger] Adjust URI host parsing to stop on \ character. am: fa3afbd0e7
Change-Id: I20336a5786e753e6941b9a784068480475415110
2018-01-31 11:19:56 +00:00
Adam Vartanian
fa3afbd0e7 Adjust URI host parsing to stop on \ character.
The WHATWG URL parsing algorithm [1] used by browsers says that for
"special" URL schemes (which is basically all commonly-used
hierarchical schemes, including http, https, ftp, and file), the host
portion ends if a \ character is seen, whereas this class previously
continued to consider characters part of the hostname.  This meant
that a malicious URL could be seen as having a "safe" host when viewed
by an app but navigate to a different host when passed to a browser.

[1] https://url.spec.whatwg.org/#host-state

Bug: 71360761
Test: vogar frameworks/base/core/tests/coretests/src/android/net/UriTest.java (on NYC branch)
Test: cts -m CtsNetTestCases (on NYC branch)
Change-Id: Id53f7054d1be8d59bbcc7e219159e59a2425106e
2018-01-31 11:14:45 +00:00
Siyamed Sinir
a381c4ced3 DO NOT MERGE Fix mTrustManager NPE
When isDeviceLocked function is called in KeyguardManager, mTrustManager
can be null. To prevent NPE during this call, moved the mTrustManager
access to a synchronized getter.

Test: run cts -c android.print.cts.PageRangeAdjustmentTest -m testWantedPagesAlreadyWrittenForPreview
Test: run cts -c android.accessibilityservice.cts.AccessibilityEndToEndTest -m testTypeViewTextChangedAccessibilityEvent
Test: run cts -c com.android.cts.appsecurity.DocumentsTest -m testCreateExisting
Test: run cts -c com.android.cts.devicepolicy.ManagedProfileTest -m testCrossProfileCopyPaste
Test: run cts -c android.text.method.cts.PasswordTransformationMethodTest

Bug: 69471788
Change-Id: I4b4a0bb3b127424fecdad85ba559ce861af165e4
2017-12-22 21:09:39 +00:00
Adam Vartanian
3ac5dabc21 Adjust Uri host parsing to use last instead of first @. am: cd6228dd37 am: 6a9c7c4814 am: 4158c9fbf3 am: eee677386e am: 49e5fca362
am: 240b55de2c

Change-Id: Ie3d378e8d9aeaff6f45838ebe988a5799f6acf3b
2017-11-07 21:56:10 +00:00
Adam Vartanian
240b55de2c Adjust Uri host parsing to use last instead of first @. am: cd6228dd37 am: 6a9c7c4814 am: 4158c9fbf3 am: eee677386e
am: 49e5fca362

Change-Id: Id6f38542623d768bebcfae7e79e8e49450329037
2017-11-07 21:41:55 +00:00
Adam Vartanian
49e5fca362 Adjust Uri host parsing to use last instead of first @. am: cd6228dd37 am: 6a9c7c4814 am: 4158c9fbf3
am: eee677386e

Change-Id: Ifd94d94c5376a6b4f1174aa7c2c8bb6d40199d89
2017-11-07 21:29:27 +00:00
Adam Vartanian
eee677386e Adjust Uri host parsing to use last instead of first @. am: cd6228dd37 am: 6a9c7c4814
am: 4158c9fbf3

Change-Id: I61bc0f5471d8f7a9a59136f320d465f2ee81b518
2017-11-07 21:02:07 +00:00
Adam Vartanian
4158c9fbf3 Adjust Uri host parsing to use last instead of first @. am: cd6228dd37
am: 6a9c7c4814

Change-Id: I80bedf58833511d336839df9f17daf65cfebfacf
2017-11-07 20:51:02 +00:00