Merge lp:~cjwatson/launchpad/openpgp-show-fingerprint into lp:launchpad

Proposed by Colin Watson on 2015-06-24
Status: Merged
Merged at revision: 17577
Proposed branch: lp:~cjwatson/launchpad/openpgp-show-fingerprint
Merge into: lp:launchpad
Diff against target: 116 lines (+14/-12)
5 files modified
lib/lp/registry/stories/person/xx-person-rdf.txt (+1/-1)
lib/lp/services/gpg/doc/gpghandler.txt (+3/-3)
lib/lp/services/gpg/handler.py (+5/-3)
lib/lp/soyuz/stories/ppa/xx-ubuntu-ppas.txt (+1/-1)
lib/lp/testing/keyserver/tests/test_web.py (+4/-4)
To merge this branch: bzr merge lp:~cjwatson/launchpad/openpgp-show-fingerprint
Reviewer Review Type Date Requested Status
William Grant code 2015-06-24 Approve on 2015-06-24
Review via email: mp+262803@code.launchpad.net

This proposal supersedes a proposal from 2014-12-12.

Commit Message

Launchpad uses the full fingerprints during initial search, but from there 0xlong is used. Show fingerprints which is the default for SKS.

Description of the Change

Launchpad uses the key fingerprint for the initial search, but from there SKS defaults to using 0xlong (16-character key ID). This MP enables showing the key fingerprint as that's the SKS default; http://keyserver.ubuntu.com:11371/ has that enabled by default.

Current: http://keyserver.ubuntu.com:11371/pks/lookup?search=0x2C5CBE094DF8E590E57A8460B294FF6EFA5C7D29&op=index
With fingerprint: http://keyserver.ubuntu.com:11371/pks/lookup?search=0x2C5CBE094DF8E590E57A8460B294FF6EFA5C7D29&op=index&fingerprint=on

Also small OCD reordering of "op=index" as per web form.

(Resubmission by cjwatson after merging current devel and fixing tests.)

To post a comment you must log in.
William Grant (wgrant) wrote : Posted in a previous version of this proposal

This will probably break at least xx-person-rdf.txt, gpghandler.txt, xx-ubuntu-ppas.txt and test_web.py. Otherwise it looks sensible.

review: Needs Fixing
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/stories/person/xx-person-rdf.txt'
2--- lib/lp/registry/stories/person/xx-person-rdf.txt 2011-12-23 23:44:59 +0000
3+++ lib/lp/registry/stories/person/xx-person-rdf.txt 2015-06-24 00:36:50 +0000
4@@ -33,7 +33,7 @@
5 <wot:hex_id>12345678</wot:hex_id>
6 <wot:length>1024</wot:length>
7 <wot:fingerprint>ABCDEF0123456789ABCDDCBA0000111112345678</wot:fingerprint>
8- <wot:pubkeyAddress rdf:resource="http://keyserver.ubuntu.com:11371/pks/lookup?search=0xABCDEF0123456789ABCDDCBA0000111112345678&amp;op=index"/>
9+ <wot:pubkeyAddress rdf:resource="http://keyserver.ubuntu.com:11371/pks/lookup?fingerprint=on&amp;op=index&amp;search=0xABCDEF0123456789ABCDDCBA0000111112345678"/>
10 </wot:PubKey>
11 </wot:hasKey>
12 </foaf:Person>
13
14=== modified file 'lib/lp/services/gpg/doc/gpghandler.txt'
15--- lib/lp/services/gpg/doc/gpghandler.txt 2012-12-26 01:32:19 +0000
16+++ lib/lp/services/gpg/doc/gpghandler.txt 2015-06-24 00:36:50 +0000
17@@ -269,18 +269,18 @@
18
19 >>> fingerprint = "A419AE861E88BC9E04B9C26FBA2B9389DFD20543"
20 >>> gpghandler.getURLForKeyInServer(fingerprint)
21- 'http://localhost:11371/pks/lookup?search=0xA419AE861E88BC9E04B9C26FBA2B9389DFD20543&op=index'
22+ 'http://localhost:11371/pks/lookup?fingerprint=on&op=index&search=0xA419AE861E88BC9E04B9C26FBA2B9389DFD20543'
23
24 But you can also specify your own action:
25
26 >>> gpghandler.getURLForKeyInServer(fingerprint, action="get")
27- 'http://localhost:11371/pks/lookup?search=0xA419AE861E88BC9E04B9C26FBA2B9389DFD20543&op=get'
28+ 'http://localhost:11371/pks/lookup?fingerprint=on&op=get&search=0xA419AE861E88BC9E04B9C26FBA2B9389DFD20543'
29
30 The method accepts a flag to retrieve a link to ubuntu's public
31 keyserver web interface.
32
33 >>> gpghandler.getURLForKeyInServer(fingerprint, public=True)
34- 'http://keyserver.ubuntu.com:11371/pks/lookup?search=0xA419AE861E88BC9E04B9C26FBA2B9389DFD20543&op=index'
35+ 'http://keyserver.ubuntu.com:11371/pks/lookup?fingerprint=on&op=index&search=0xA419AE861E88BC9E04B9C26FBA2B9389DFD20543'
36
37
38 == Keyserver uploads ==
39
40=== modified file 'lib/lp/services/gpg/handler.py'
41--- lib/lp/services/gpg/handler.py 2014-03-11 03:30:54 +0000
42+++ lib/lp/services/gpg/handler.py 2015-06-24 00:36:50 +0000
43@@ -462,15 +462,17 @@
44 def getURLForKeyInServer(self, fingerprint, action='index', public=False):
45 """See IGPGHandler"""
46 params = {
47+ 'op': action,
48 'search': '0x%s' % fingerprint,
49- 'op': action,
50+ 'fingerprint': 'on',
51 }
52 if public:
53 host = config.gpghandler.public_host
54 else:
55 host = config.gpghandler.host
56- return 'http://%s:%s/pks/lookup?%s' % (host, config.gpghandler.port,
57- urllib.urlencode(params))
58+ return 'http://%s:%s/pks/lookup?%s' % (
59+ host, config.gpghandler.port,
60+ urllib.urlencode(sorted(params.items())))
61
62 def _getPubKey(self, fingerprint):
63 """See IGPGHandler for further information."""
64
65=== modified file 'lib/lp/soyuz/stories/ppa/xx-ubuntu-ppas.txt'
66--- lib/lp/soyuz/stories/ppa/xx-ubuntu-ppas.txt 2015-02-19 01:35:33 +0000
67+++ lib/lp/soyuz/stories/ppa/xx-ubuntu-ppas.txt 2015-06-24 00:36:50 +0000
68@@ -567,7 +567,7 @@
69
70 >>> print anon_browser.getLink(
71 ... '1024D/12345678').url
72- http://keyserver.ubuntu.com:11371/pks/lookup?search=0xABCDEF0123456789ABCDDCBA0000111112345678&op=index
73+ http://keyserver.ubuntu.com:11371/pks/lookup?fingerprint=on&op=index&search=0xABCDEF0123456789ABCDDCBA0000111112345678
74
75 Using software from a PPA can be hard for novices. We offer two
76 links to the same help pop-up that describes how to add a PPA and
77
78=== modified file 'lib/lp/testing/keyserver/tests/test_web.py'
79--- lib/lp/testing/keyserver/tests/test_web.py 2013-03-27 02:12:19 +0000
80+++ lib/lp/testing/keyserver/tests/test_web.py 2015-06-24 00:36:50 +0000
81@@ -107,7 +107,7 @@
82 def test_index_lookup(self):
83 # A key index lookup form via GET.
84 return self.assertContentMatches(
85- '/pks/lookup?op=index&search=0xDFD20543',
86+ '/pks/lookup?fingerprint=on&op=index&search=0xDFD20543',
87 '''\
88 <html>
89 ...
90@@ -120,7 +120,7 @@
91 def test_content_lookup(self):
92 # A key content lookup form via GET.
93 return self.assertContentMatches(
94- '/pks/lookup?op=get&'
95+ '/pks/lookup?fingerprint=on&op=get&'
96 'search=0xA419AE861E88BC9E04B9C26FBA2B9389DFD20543',
97 '''\
98 <html>
99@@ -138,7 +138,7 @@
100 # We can also request a key ID instead of a fingerprint, and it will
101 # glob for the fingerprint.
102 return self.assertContentMatches(
103- '/pks/lookup?op=get&search=0xDFD20543',
104+ '/pks/lookup?fingerprint=on&op=get&search=0xDFD20543',
105 '''\
106 <html>
107 ...
108@@ -154,7 +154,7 @@
109 def test_nonexistent_key(self):
110 # If we request a nonexistent key, we get a nice error.
111 return self.assertRaises404ErrorForKeyNotFound(
112- '/pks/lookup?op=get&search=0xDFD20544')
113+ '/pks/lookup?fingerprint=on&op=get&search=0xDFD20544')
114
115 def test_add_key(self):
116 # A key submit form via POST (see doc/gpghandler.txt for more