2017 © Pedro Peláez
 

cakephp-plugin cakephp-secure-target-blank

Adds noopener and noreferrer to target _blank in Html Helper.

image

mosaxiv/cakephp-secure-target-blank

Adds noopener and noreferrer to target _blank in Html Helper.

  • Thursday, January 25, 2018
  • by mosaxiv
  • Repository
  • 1 Watchers
  • 2 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

SecureTargetBlank plugin for CakePHP

MIT License Build Status, (*1)

If you use the target="_blank" attribute on a link, you are leaving your users open to a very simple phishing attack. Adding rel="noopener noreferrer" on those links will prevent this vulnerability. Further reading., (*2)

Requirements

  • PHP 7.0+
  • CakePHP 3.0.0+

Installation

You can install this plugin into your CakePHP application using composer., (*3)

The recommended way to install composer packages is:, (*4)

composer require mosaxiv/cakephp-secure-target-blank

Usage

AppView Setup

load Helper, (*5)

// src/View/AppView.php

namespace App\View;

use Cake\View\View;
use SecureTargetBlank\View\Helper\HtmlHelper;

class AppView extends View
{
    public function initialize()
    {
        $this->loadHelper('Html', [
            'className' => HtmlHelper::class
        ]);
    }
}

Helper Usage

Use the Html->link() with [target => "_blank"], rel="noopener noreferrer" will be added., (*6)

Basic

Html Helper:, (*7)

$this->Html->link('test', 'http://example.com', ['target' => '_blank'])

will render this HTML:, (*8)

'<a href="http://example.com" target="_blank" rel="noopener noreferrer">test</a>'

secureBlank Option

Html Helper:, (*9)

$this->Html->link('test_title', ['controller' => 'test'], ['target' => '_blank', 'secureBlank' => false]);

will render this HTML:, (*10)

<a href="/test/index" target="_blank">test_title</a>

The Versions

25/01 2018

dev-master

9999999-dev https://github.com/mosaxiv/cakephp-secure-target-blank

Adds noopener and noreferrer to target _blank in Html Helper.

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin cakephp secure

21/12 2017

1.0.2

1.0.2.0 https://github.com/mosaxiv/cakephp-secure-target-blank

Adds noopener and noreferrer to target _blank in Html Helper.

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin cakephp secure

20/12 2017

1.0.1

1.0.1.0 https://github.com/mosaxiv/cakephp-secure-target-blank

Adds noopener and noreferrer to target _blank in Html Helper.

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin cakephp secure

17/12 2017

1.0.0

1.0.0.0 https://github.com/mosaxiv/cakephp-secure-target-blank

Adds noopener and noreferrer to target _blank in Html Helper.

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin cakephp secure

16/12 2017

0.0.1

0.0.1.0

SecureTargetBlank plugin for CakePHP

  Sources   Download

MIT

The Requires

 

The Development Requires