Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

frameguard

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

frameguard

Middleware to set X-Frame-Options headers

  • 4.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
151K
decreased by-8.07%
Maintainers
1
Weekly downloads
 
Created

What is frameguard?

The frameguard npm package is used to help secure your web applications by setting the X-Frame-Options header. This header is used to control whether a browser should be allowed to render a page in a <frame>, <iframe>, <embed>, or <object>. This can help prevent clickjacking attacks.

What are frameguard's main functionalities?

Deny

This feature sets the X-Frame-Options header to 'DENY', which means the page cannot be displayed in a frame, regardless of the site attempting to do so.

const frameguard = require('frameguard');
const express = require('express');
const app = express();

app.use(frameguard({ action: 'deny' }));

app.get('/', (req, res) => {
  res.send('X-Frame-Options set to DENY');
});

app.listen(3000, () => {
  console.log('Server running on port 3000');
});

SameOrigin

This feature sets the X-Frame-Options header to 'SAMEORIGIN', which means the page can only be displayed in a frame on the same origin as the page itself.

const frameguard = require('frameguard');
const express = require('express');
const app = express();

app.use(frameguard({ action: 'sameorigin' }));

app.get('/', (req, res) => {
  res.send('X-Frame-Options set to SAMEORIGIN');
});

app.listen(3000, () => {
  console.log('Server running on port 3000');
});

AllowFrom

This feature sets the X-Frame-Options header to 'ALLOW-FROM https://example.com', which means the page can only be displayed in a frame on the specified origin.

const frameguard = require('frameguard');
const express = require('express');
const app = express();

app.use(frameguard({ action: 'allow-from', domain: 'https://example.com' }));

app.get('/', (req, res) => {
  res.send('X-Frame-Options set to ALLOW-FROM https://example.com');
});

app.listen(3000, () => {
  console.log('Server running on port 3000');
});

Other packages similar to frameguard

Keywords

FAQs

Package last updated on 21 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc