Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5c443c7 authored by Chih-Hung Hsieh's avatar Chih-Hung Hsieh
Browse files

Do not use o=ALL_EMAILS parameter.

For security reason, this REST API parameter needs account modification
permission to get all email addresses. Now changed to ask only account
number to verify an email address.

Bug: 79863374
Test: test with existing OWNERS
Change-Id: Ic913b7ad96a69c35d1d91e5871f4c5636e73533d
parent d350b16d
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -30,12 +30,11 @@ def echo(msg):

def find_address(address):
  if address not in checked_addresses:
    request = (gerrit_server + '/accounts/?n=1&o=ALL_EMAILS&q=email:'
    request = (gerrit_server + '/accounts/?n=1&q=email:'
               + urllib.quote(address))
    echo('Checking email address: ' + address)
    result = urllib2.urlopen(request).read()
    checked_addresses[address] = (
        result.find('"email":') >= 0 and result.find('"_account_id":') >= 0)
    checked_addresses[address] = result.find('"_account_id":') >= 0
  return checked_addresses[address]