Hide signature file reference if not used

Created on 24 November 2022, almost 2 years ago
Updated 9 August 2023, over 1 year ago

Problem/Motivation

If the 'Sign' tab is not used to generate a /.well-known/security.txt.sig file, it should not be reference in the parent /.well-known/security.txt file.

Steps to reproduce

Complete items under the 'Configure' tab only.
Do not add a 'signature' value (leave blank).

Proposed resolution

The /.well-known/security.txt file should not output a reference to the /.well-known/security.txt.sig file if one is not generated and configured under the 'Sign' tab.

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇦🇺Australia Stephen Ollman Canberra

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇦🇺Australia klonos 90% Melbourne, Australia - 10% Larissa, Greece
  • Status changed to Needs work over 1 year ago
  • 🇺🇸United States kmonty San Francisco, CA

    Here is a small patch we wrote to add a setting to enable the display of the signature file.

    There are probably more elegant ways to write this, such as:

    1. Doing a file_exists check.
    2. Changing the logic to be disable_signature instead of enable_signature. As this patch is written now, a database update hook would be required before merging this into the branch. That said, it was a quick way for our team to solve this.

    Hoping this helps folks for now. We might pick this back up to improve the patch if the maintainers seem interested in merging at some point + offer up guidance as to what their preferred implementation is. Cheers!

  • 🇺🇸United States Kristen Pol Santa Cruz, CA, USA

    Thanks! I haven't tested but I took a quick look and it seems fine other than this minor nitpick below. Note that you should move the issue to "Needs review" after providing a patch/MR so that people know to review the code and manual test.

    1. +++ b/src/Form/SecuritytxtConfigureForm.php
      @@ -178,6 +186,7 @@ class SecuritytxtConfigureForm extends ConfigFormBase {
             ->set('enabled', $enabled)
      +      ->set('enabled_signature', $enabled_signature)    ¶
      

      Extraneous spaces at the end of the line

    2. +++ b/src/SecuritytxtSerializer.php
      @@ -27,6 +27,7 @@ class SecuritytxtSerializer {
           $contact_email = $settings->get('contact_email');
      

      Extraneous spaces at the end of the line

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India subhashuyadav Mumbai

    Here is the updated patch along with few other phpcs fixes.

  • Status changed to RTBC over 1 year ago
  • 🇳🇱Netherlands Lendude Amsterdam

    The additional phpcs fixes make this a little harder to review, but code looks good and works for me.

  • Status changed to Fixed over 1 year ago
  • 🇦🇺Australia VladimirAus Brisbane, Australia

    Thank you! Committed! 🍻

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024