This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new c884ebbd Show PGP key statuses
c884ebbd is described below
commit c884ebbdcfb0b283bf3cb52f6879066b41192678
Author: Sebb <[email protected]>
AuthorDate: Sat Jul 12 23:51:49 2025 +0100
Show PGP key statuses
---
lib/whimsy/asf/ldap.rb | 14 ++++++++++++++
www/roster/models/committer.rb | 6 ++++++
www/roster/views/person/pgpkeys.js.rb | 5 ++++-
3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index aab78dec..a43014c2 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -5,6 +5,7 @@ require 'net/http'
require 'base64'
require 'securerandom'
require 'set'
+require 'whimsy/cache'
if __FILE__ == $0
$LOAD_PATH.unshift '/srv/whimsy/lib'
@@ -722,6 +723,10 @@ module ASF
class Person < Base
@base = 'ou=people,dc=apache,dc=org'
+ def self.cache
+ @cache ||= Cache.new(dir: 'key-status', minage: 3600, enabled: true) #
could be longer
+ end
+
# Obtain a list of people known to LDAP. LDAP filters may be used
# to retrieve only a subset.
def self.list(filter='uid=*')
@@ -855,6 +860,15 @@ module ASF
attrs['asf-pgpKeyFingerprint'] || []
end
+ # list pgp key status as per keys.json from people.apache.org
+ # This is intended for use on committer display pages only; do not include
it in public JSON output
+ def pgp_key_status
+ _uri, content, status =
Person.cache.get("https://people.apache.org/keys/committer/keys.json")
+ return 'error reading status' if status == 'error'
+ keys = JSON.parse(content, :encoding => 'utf-8')
+ (keys[id] || {}).map {|k,v|[k.gsub(' ', ''), v]}.to_h
+ end
+
# list all of the ssh public keys
def ssh_public_keys
attrs['sshPublicKey'] || []
diff --git a/www/roster/models/committer.rb b/www/roster/models/committer.rb
index c63a9833..e936c994 100644
--- a/www/roster/models/committer.rb
+++ b/www/roster/models/committer.rb
@@ -55,6 +55,7 @@ class Committer
unless person.pgp_key_fingerprints.empty?
response[:pgp] = person.pgp_key_fingerprints
+ response[:pgp_status] = person.pgp_key_status
end
unless person.ssh_public_keys.empty?
@@ -189,7 +190,12 @@ class Committer
end
if auth[:secretary]
+ begin
path, _name, _timestamp, epoch =
ASF::WithdrawalRequestFiles.findpath(person.id, env, true)
+ rescue Exception => e
+ Wunderbar.warn e
+ path = nil
+ end
if path
response[:forms][:withdrawal_request] = path
# Calculate the age in days
diff --git a/www/roster/views/person/pgpkeys.js.rb
b/www/roster/views/person/pgpkeys.js.rb
index 53730dc6..b321dbdb 100644
--- a/www/roster/views/person/pgpkeys.js.rb
+++ b/www/roster/views/person/pgpkeys.js.rb
@@ -44,7 +44,10 @@ class PersonPgpKeys < Vue
_samp style: 'font-family:Monospace' do
_a keynb, href: 'https://keyserver.ubuntu.com/pks/lookup?'
+
'op=index&fingerprint=on&search=0x' + keysq
- unless keysq.length == 40
+ if keysq.length == 40
+ _ ' '
+ _span committer.pgp_status[keysq] || 'status unknown'
+ else
_span.bg_danger ' ?? Expecting exactly 40 hex characters
(plus optional spaces)'
end
end