Log missing l param for WKD requests, return 400
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -3,8 +3,15 @@ class WebKeyDirectoryController < WellKnownController
|
||||
|
||||
# /.well-known/openpgpkey/hu/:hashed_username(.txt)?l=username
|
||||
def show
|
||||
username = params[:l] || ""
|
||||
@user = User.find_by(cn: username.downcase)
|
||||
if params[:l].blank?
|
||||
# TODO store hashed username in db if existing implementations trigger
|
||||
# this a lot
|
||||
msg = "WKD request with \"l\" param omitted for hu: #{params[:hashed_username]})"
|
||||
Sentry.capture_message(msg) if Setting.sentry_enabled?
|
||||
http_status :bad_request and return
|
||||
end
|
||||
|
||||
@user = User.find_by(cn: params[:l].downcase)
|
||||
|
||||
if @user.nil? ||
|
||||
@user.pgp_pubkey.blank? ||
|
||||
|
||||
Reference in New Issue
Block a user