summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chih-Hung Hsieh <chh@google.com> 2018-05-16 11:44:50 -0700
committer Chih-Hung Hsieh <chh@google.com> 2018-05-16 11:44:50 -0700
commitc5c443c75679f4bc161096d9f1624325a34b6b6b (patch)
tree44848bcadb0456fe5560c521235fbed81c5e3c34
parentd350b16d507ca1fc2b758af51e34cbc0878969bb (diff)
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
-rwxr-xr-xtools/checkowners.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/tools/checkowners.py b/tools/checkowners.py
index 1190d30f2c..54198a7e96 100755
--- a/tools/checkowners.py
+++ b/tools/checkowners.py
@@ -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]