View Issue Details

IDProjectCategoryView StatusLast Update
0005271mantisbtotherpublic2025-01-06 07:59
Reportervboctor Assigned Tocommunity  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Target Version2.28.0Fixed in Version2.28.0 
Summary0005271: Support NoFollow hyperlinks for external urls
Description

This is an addition to html that provides a way to stop search engines from following URLs. It discourages spammers from adding urls to their websites (automatically or manually), since they won't get any benefit from doing that. This is useful for installations where it is allowed for anonymous users to add comments or submit issues.

See the following article for more details:
http://googleblog.blogspot.com/2005/01/preventing-comment-spam.html

More thought is needed before this issue is implemented. For example, should this be configurable? Should it apply for all links that start with http? ...etc.

TagsNo tags attached.

Relationships

related to 0035210 resolveddregad Incorrect handling of relative URLs in helper_get_root_domain() function and caller one 

Activities

giallu

giallu

2007-08-23 04:43

reporter   ~0015492

Is this inteded to be applied to links autogenerated in notes and such?

vboctor

vboctor

2007-08-23 12:13

manager   ~0015498

I am thinking there is no harm in applying it to all links within Mantis. Independent of whether they are typed by anonymous user, developer, they are hyperlinked issue numbers, etc. I also don't think it should be configurable at this stage.

jreese

jreese

2007-08-23 14:45

reporter   ~0015501

This should only apply to external URLs. You don't want to put nofollow on your internal links, because then your site will not get indexed properly and/or your site will not be easily found by those searching about their problems. Because it would be a smaller subset of links being processed to only add nofollow to external links, it could easily be configured to the site maintainer's benefit:

  • Notes created by DEVELOPER access or higher should not be set to nofollow, so that valid reference locations can still be indexed accordingly. The threat of spam from users with this access level should be below negligible.
  • Notes to a certain list of domains (listed in config_inc.php methinks) should not have nofollow added. This will allow sister sites (wikis, manuals, etc) to be properly indexed even in unprivileged users' comments, while thwarting spam attempts to unrelated websites.

By restricting the application of nofollow to links to untrusted sites by untrusted users, you can still help to stop spam without preventing Google et al from properly indexing links to valid reference sites and materials. It would be worse to blindly apply nofollow to every link on Mantis than it would be to not apply it at all.

vboctor

vboctor

2007-08-24 03:08

manager   ~0015505

I agree with jreese's comments. The trusted threshold and sites should be configurable.

giallu

giallu

2007-08-24 03:34

reporter   ~0015509

Ok, let's see if we can sort this out without YACP (Yet Another Configuration Parameter) :)

About the threshold, the point of the rel="nofollow" property is to avoid comment spam by removing the gain spammers get on thir page ranks.

Spammers will (eventaully) try to use:

  1. the anonymous login
  2. a newly created account

I think it is unlikely that a spammer will ever get an access level above 2, otherwise you have bigger problems to worry about...

For this reason, I think we should add the nofollow tag to links cretated by users below $g_default_new_account_access_level

I am not sure about "whitelisting" links because, as the googleblog says, the nofollow tag will affect only the target page rank in searches, not the indexing phase that will be performed as usual.

If you really want to whitelist something, I'd propose to use the installation domain, but I believe this is marginal gain

jreese

jreese

2007-08-24 21:59

reporter   ~0015529

If you're dead set against adding configuration parameters, then I think a good baseline would be to do this:

  • Place the nofollow attribute on all links except:
    -- Links to the same parent domain running the Mantis installation, including other subdomains.
    -- Links posted by users above default_new_account_access_level.

I would still prefer to give the user the ability to whitelist other sites, but as you've said, it's not truly devastating to leave that out of the picture.

atrol

atrol

2013-08-16 12:46

developer   ~0037890

Removed assignment. giallu will not contribute to this issue in near future.

c_schmitz

c_schmitz

2013-11-21 03:40

reporter   ~0038608

Last edited: 2013-11-21 03:41

I can see the HTML-ization of links in user content is currently done in the function 'string_insert_hrefs' in /core/string_api.php

Would a plugin be able to do this?

atrol

atrol

2013-11-21 06:20

developer   ~0038612

Last edited: 2024-10-26 05:02

Would a plugin be able to do this?

The implementation in MantisBT is a plugin.
Have a look at plugins/MantisCoreFormatting

c_schmitz

c_schmitz

2024-10-25 10:35

reporter   ~0069394

I would like to take a shot at this. Will submit a PR soon.

dregad

dregad

2024-10-26 05:03

developer   ~0069400

Thanks @c_schmitz, do not hesitate to ask if you need help.

c_schmitz

c_schmitz

2024-10-29 09:05

reporter   ~0069417

See https://github.com/mantisbt/mantisbt/pull/2044

dregad

dregad

2024-11-21 12:38

developer   ~0069482

Thank you @c_schmitz for your contribution !

Related Changesets

MantisBT: master 9f4ccf15

2024-11-10 11:51

dregad


Details Diff
Document LINKS_NOFOLLOW_EXTERNAL constant

Issue 0005271
Affected Issues
0005271
mod - config_defaults_inc.php Diff File
mod - docbook/Admin_Guide/en-US/config/html.xml Diff File

MantisBT: master cfe18445

2024-11-21 12:30

c_schmitz

Committer: community


Details Diff
Support NoFollow hyperlinks for external urls

Introduces new constant LINKS_NOFOLLOW_EXTERNAL to set `nofollow` link
attributes on external links.

Fixes 0005271, PR https://github.com/mantisbt/mantisbt/pull/2044

Signed-off-by: Damien Regad <dregad@mantisbt.org>
Affected Issues
0005271
mod - config_defaults_inc.php Diff File
mod - core/constant_inc.php Diff File
mod - core/helper_api.php Diff File
mod - core/string_api.php Diff File
mod - plugins/MantisCoreFormatting/core/MantisMarkdown.php Diff File

MantisBT: master 59283d84

2024-11-21 12:34

dregad


Details Diff
Set LINKS_NOFOLLOW_EXTERNAL as default

Fixes 0005271
Affected Issues
0005271
mod - config_defaults_inc.php Diff File
mod - docbook/Admin_Guide/en-US/config/html.xml Diff File

MantisBT: master 40f71cf3

2024-12-29 08:49

dregad


Details Diff
Fix nofollow attribute for relative URLs

Extract duplicated code in MantisMarkdown::processUrl() and the callback
in string_insert_hrefs() into a new helper_is_link_external() function.

Add logic to treat relative URLs as internal.

Fixes 0035210
Follow-up on issue 0005271, PR https://github.com/mantisbt/mantisbt/pull/2044
Affected Issues
0005271, 0035210
mod - core/helper_api.php Diff File
mod - core/string_api.php Diff File
mod - plugins/MantisCoreFormatting/core/MantisMarkdown.php Diff File