# all files / keystone/lib/security/ frameGuard.js

100% Statements 6/6
100% Branches 2/2
100% Functions 2/2
100% Lines 6/6

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23

    1×
    1×
    4×
    4×
    3×

    4×

     /**
     * Adds iframe protection headers to the response
     *
     * ####Example:
     *
     *     app.use(keystone.security.frameGuard(keystone));
     *
     * @param {app.request} req
     * @param {app.response} res
     * @param {function} next
     * @api public
     */

    module.exports = function (keystone) {
    	return function frameGuard (req, res, next) {
    		var options = keystone.get('frame guard');
    		if (options) {
    			res.header('x-frame-options', options);
    		}
    		next();
    	};
    };