Skip to content

Commit

Permalink
Add #949 - Add support for inline PGP signatures in RPSL update form
Browse files Browse the repository at this point in the history
  • Loading branch information
mxsasha committed Nov 28, 2024
1 parent eef1470 commit 8be6560
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions irrd/webui/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from irrd.storage.orm_provider import ORMSessionProvider, session_provider_manager
from irrd.storage.queries import RPSLDatabaseQuery
from irrd.updates.handler import ChangeSubmissionHandler
from irrd.utils.pgp import validate_pgp_signature
from irrd.webui.auth.decorators import authentication_required, mark_user_mfa_incomplete
from irrd.webui.helpers import filter_auth_hash_non_mntner
from irrd.webui.rendering import template_context_render
Expand Down Expand Up @@ -101,7 +102,6 @@ async def rpsl_detail(request: Request, user_mfa_incomplete: bool, session_provi
)


@csrf_protect
@mark_user_mfa_incomplete
@session_provider_manager
async def rpsl_update(
Expand Down Expand Up @@ -147,6 +147,7 @@ async def rpsl_update(

elif request.method == "POST":
form_data = await request.form()
submission = form_data.get("data", form_data.get("DATA"))
request_meta = {
META_KEY_HTTP_CLIENT_IP: request.client.host if request.client else "",
"HTTP-User-Agent": request.headers.get("User-Agent"),
Expand All @@ -160,8 +161,10 @@ async def rpsl_update(
# and therefore needs wrapping in a thread
@sync_to_async
def save():
signed_submission, pgp_fingerprint = validate_pgp_signature(submission)
return ChangeSubmissionHandler().load_text_blob(
object_texts_blob=form_data["data"],
object_texts_blob=signed_submission if signed_submission else submission,
pgp_fingerprint=pgp_fingerprint,
origin=AuthoritativeChangeOrigin.webui,
request_meta=request_meta,
internal_authenticated_user=active_user,
Expand All @@ -172,7 +175,7 @@ def save():
"rpsl_form.html",
request,
{
"existing_data": form_data["data"],
"existing_data": submission,
"status": handler.status(),
"report": handler.submitter_report_human(),
"mntner_perms": mntner_perms,
Expand Down
4 changes: 2 additions & 2 deletions irrd/webui/templates/rpsl_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ <h2>Change/create/delete object(s){% if status %}: {{ status }}{% endif %}</h2>
This form is identical to email submissions, which means you
can use the pseudo-attributes <code>delete</code> for deletions
or <code>password</code> for password authentication.
PGP is not supported.
See the <a href="TODO">IRRD documentation</a> for more details.
PGP inline signatures are supported.
See the <a href="https://irrd.readthedocs.io/">IRRD documentation</a> for more details.
</p>
{% if user and user.override %}
<p>
Expand Down

0 comments on commit 8be6560

Please sign in to comment.