[JIRA] (JENKINS-55029) Allow target=_blank for links in OWASP Markup Formatter Plugin ("Safe HTML" formatter) under conditions

1 view
Skip to first unread message

jaroslaw@rencz.pl (JIRA)

unread,
Dec 5, 2018, 8:22:02 AM12/5/18
to jenkinsc...@googlegroups.com
Jarek Rencz created an issue
 
Jenkins / Improvement JENKINS-55029
Allow target=_blank for links in OWASP Markup Formatter Plugin ("Safe HTML" formatter) under conditions
Issue Type: Improvement Improvement
Assignee: Unassigned
Components: antisamy-markup-formatter-plugin
Created: 2018-12-05 13:21
Priority: Minor Minor
Reporter: Jarek Rencz

Purpose

As mentioned by Daniel Beck in a comment some years ago creating a feature request is a way to introduce support for target attribute in link elements if Safe HTML plugin is used. I create a feature request of altering the policy OWASP Markup Formatter uses in order to allow target attribute in a elements somehow.

Usage example

My use case is adding links to parametr documentation on a wiki.

Wiki, in my case is Confluence. I want those links to be there to allow 2 things:

  • discoverability of parameter meaning for team newcomers,
  • access to documentation by people with no access to Jenkins (I'm thinking POs and business people right now)

Security concerns

Opening a new window/tab allows reading who opened it. It's summarised in https://developers.google.com/web/tools/lighthouse/audits/noopener

To prevent security vulnerabilities I suggest only allowing target="_blank" (I assume the demand for other target values will be way lower than for _blank) and only if noopener is present in rel attribute unless it's a same-host link as recommended in the article above (think: a link to Jenkins itself).

This however may not be immediately understandable by people who are not accustomed to web security (i.e. those who won't understand why noopener is important or will just not remember to use it. Think: most of the people, actually). Those people will still get frustrated on why doesn't target="_blank" work. I suggest the following:

  • if target has other value than blank then remove it (as it works for all values now)
  • if link is a same-host link: allow target="_blank" in case it's present.
  • if it's not a same-host link, and there's no rel: add it. Set value to noopener.
  • if it's not as same-host link, and rel is present but it has no noopener, add it so it's "/previousValue/ noopener" (rel is a DOMTokenList so it can have more than one value, values are space-separated. See https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/relList)
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

jaroslaw@rencz.pl (JIRA)

unread,
Dec 6, 2018, 11:19:05 AM12/6/18
to jenkinsc...@googlegroups.com
Jarek Rencz commented on Improvement JENKINS-55029
 
Re: Allow target=_blank for links in OWASP Markup Formatter Plugin ("Safe HTML" formatter) under conditions

There's an initiative in WHATWG to make rel="noopener" an implicit default in case target="_blank": https://github.com/whatwg/html/issues/4078
This may simplify this feature to "just allow target="_blank"

jaroslaw@rencz.pl (JIRA)

unread,
Dec 6, 2018, 11:19:05 AM12/6/18
to jenkinsc...@googlegroups.com
Jarek Rencz edited a comment on Improvement JENKINS-55029

dbeck@cloudbees.com (JIRA)

unread,
Mar 22, 2020, 9:33:03 AM3/22/20
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages