Compare commits

..

No commits in common. "c374bcd3bcb181e5b7e89e22bf62cf19b71c45a6" and "7b0ebb761f44937c0ae7fa9d82735a9fce3e64f8" have entirely different histories.

3 changed files with 2 additions and 19 deletions

View File

@ -1,16 +1,8 @@
class WebKeyDirectoryController < WellKnownController
before_action :allow_cross_origin_requests
# /.well-known/openpgpkey/hu/:hashed_username(.txt)?l=username
# /.well-known/openpgpkey/hu/:hashed_username(.txt)
def show
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? ||

View File

@ -52,11 +52,9 @@
<section class="!pt-8 sm:!pt-12">
<h3>OpenPGP</h3>
<ul role="list">
<% example_link = link_to "example", "https://accounts.kosmos.org/.well-known/openpgpkey/hu/yuca4ky39mhwkjo78qb8zjgbfj1hg3yf.txt?l=jimmy",
target: "_blank", class: "text-gray-500 underline" %>
<%= render FormElements::FieldsetComponent.new(
title: "Public key",
description: raw("Your OpenPGP public key in ASCII Armor format (#{example_link})")
description: "Your OpenPGP public key in ASCII Armor format"
) do %>
<%= f.text_area :pgp_pubkey,
value: @user.pgp_pubkey,

View File

@ -9,13 +9,6 @@ RSpec.describe "OpenPGP Web Key Directory", type: :request do
end
end
describe "omitted 'l' param" do
it "returns a 400 status" do
get "/.well-known/openpgpkey/hu/fmb8gw3n4zdj4xpwaziki4mwcxr1368i"
expect(response).to have_http_status(:bad_request)
end
end
describe "non-existent user" do
it "returns a 404 status" do
get "/.well-known/openpgpkey/hu/fmb8gw3n4zdj4xpwaziki4mwcxr1368i?l=aristotle"