חותמות שיח

Am I crazy here or is there no validation on the user input signature image URL at all?
Basically a user can input whatever they want and it will be pushed to other users?

Also, why is the URL signature db size set to 32_000?
Why would anyone need 32000 characters for a URL to an image?

Spooky :ghost:

I modified the css to this in order to hard code a max height and width;

.signature-img {
  max-width: 600px;
  max-height: 100px;
  width: auto;
  height: auto;
  display: block;
  margin: 5px 0;
}

I changed signature URL max size to 250 in plugin.rb

  register_user_custom_field_type("signature_url", :string, max_length: 250)
  register_user_custom_field_type("signature_raw", :string, max_length: 250)

I added this to the bottom of “on(:user_updated) do |user|” in plugin.rb (I won’t be using advanced mode)

    # Validate the URL if not in advanced mode
    if !SiteSetting.signatures_advanced_mode && user.custom_fields["signature_url"]
      url = user.custom_fields["signature_url"]

      # Strict validation: only HTTPS, only certain image file types
      unless url =~ /\Ahttps:\/\/[a-zA-Z0-9.\-\/_]+\.(png|jpe?g|gif|webp)(\?[a-zA-Z0-9=&]+)?\z/
        Rails.logger.warn("[discourse-signatures] Rejected invalid signature_url for user #{user.id}: #{url.inspect}")
        user.custom_fields["signature_url"] = nil
        user.save
      end
    end

If I’m doing anything wrong here (Never worked with Discourse before), please correct it and show me the right way to do it.

לייק 1

{“translation”: "[ציטוט=“bar10dr, פוסט:187, נושא:42263”]
גם, למה גודל מסמכי חתימת ה-URL מוגדר ל-32,000?
למה מישהו צריך 32,000 תווים ל-URL לתמונה?
[/ציטוט]

כי 250 זה לא מספיק…

[ציטוט=“bar10dr, פוסט:187, נושא:42263”]
בעקרון, משתמש יכול להכניס כל דבר שירצה והדבר ייתקן לשאר המשתמשים
[/ציטוט]
זו הרעיון כולו של חתימה. אותו דבר גם בפורום, אנשים מכניסים דברים ואחרים רואים את זה. עולם מטורף הא?"}

5 לייקים

כאשר Discourse משודרג לגרסה 3.5.0.beta8 (גם גרסה 3.5.0.beta9-dev מהווה בעיה), מתגלה שמשתמש שערך את חתימתו אינו יכול לשמור אותה (למרות שהיא מוצגת כשמורה, היא אינה נכנסת לתוקף). המצב תקין בגרסה 3.5.0.beta7. מקווים לתיקון מהיר, מכיוון שפלאגינים רבים מגרסה beta7 ל-beta8 מובנים.

2 לייקים

יש לנו מקרה שימוש ספציפי לחתימות ואני תוהה אם יהיה קל יחסית לבצע כמה שינויים.

  1. אני מסכים שהייתי רוצה לראות חתימות רק לקבוצות ספציפיות בממשק המשתמש, אני לא טוב ב-CSS.
  2. אנו משתמשים ב-Discourse שלנו גם כקהילה וגם כמערכת פניות תמיכה. האם יש דרך לקבל הגדרה ל"הצג חתימות רק בקטגוריות X בלבד"?

אנחנו באמת צריכים אותן רק במחלקת התמיכה שלנו, שם רוב האינטראקציות שלנו מתבצעות באמצעות דואר אלקטרוני.

2 לייקים

Turns out this plugin doesn’t work for our need.

The signatures are appended in the post just fine, but they’re not sent as part of an e-mail reply and that’s the whole point of using it in our case.

Is this something that the plugin can be altered to do?


לייק 1

I second that, Signatures are unable to be saved from user profile preferences in Discourse v.3.5.0. Does anyone experience the same behavior?

Do your emails send the full announcement or the truncated version?

Regardless, my hunch is that the signature injections are after the post is cooked, but the email only sends the raw content, so it doesn’t make it across.

Yes, the e-mails are the full posts.
I agree, the sig is outside of the post content itself.
That’s why when you change your sig it’s updated on existing posts.

I’d love it if that changed, but until then I just have to retype it on each post.

I can confirm we are experiencing the same issue on our instance as well. Users are unable to save changes to their signatures in Discourse v3.5.1
Looking forward to a resolution.

Related article:
Signature Changes Not Saving in Discourse