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

jimpex

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jimpex - npm Package Compare versions

Comparing version 5.0.1 to 5.1.0

src/middlewares/common/hsts.js

53

documents/middlewares.md

@@ -105,3 +105,3 @@ # Built-in Middlewares

// Add the middleware first.
this.use(errorHandler);
this.use(forceHTTPS);
}

@@ -134,2 +134,53 @@ }

## HSTS
It configures a `Strict-Transport-Security` header and includes it on every response.
- Module: `common`
```js
const {
Jimpex,
middlewares: {
common: { hsts },
},
};
class App extends Jimpex {
boot() {
// Add the middleware first.
this.use(hsts);
}
}
```
You can also use it as a function and send the following options:
- `maxAge`: The time, in seconds, that the browser should remember that a site is only to be accessed using HTTPS. The default value is `31536000` (one year).
- `includeSubDomains`: Whether or not the rule should apply to all sub domains. The default value is `true`.
- `preload`: Whether or not to include on the major browsers' preload list. This directive is not part of the specification, for more information about it, you should check the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security) for the header. The default value is `false`.
```js
const {
Jimpex,
middlewares: {
common: { hsts },
},
};
class App extends Jimpex {
boot() {
// Add the middleware first.
this.use(hsts({
maxAge: 5,
includeSubDomains: false,
}));
}
}
```
> You can also send an `enabled` option, set to `false`, in case you want to disable the middleware.
If you don't send options, before using the defaults, it will first try to obtain them for a `hsts` key on the `appConfiguration` service, so you can also manage how the feature works from your project configuration.
## Fast HTML

@@ -136,0 +187,0 @@

14

package.json

@@ -5,3 +5,3 @@ {

"homepage": "https://homer0.github.io/jimpex/",
"version": "5.0.1",
"version": "5.1.0",
"repository": "homer0/jimpex",

@@ -11,3 +11,3 @@ "author": "Leonardo Apiwan (@homer0) <me@homer0.com>",

"dependencies": {
"wootils": "^3.0.2",
"wootils": "^3.0.3",
"jimple": "^1.5.0",

@@ -26,5 +26,5 @@ "express": "^4.17.1",

"eslint": "^6.8.0",
"eslint-plugin-homer0": "^3.0.2",
"jest-ex": "^8.0.0",
"jest-cli": "^25.1.0",
"eslint-plugin-homer0": "^3.0.3",
"jest-ex": "^8.0.1",
"jest-cli": "^25.3.0",
"jasmine-expect": "^4.0.3",

@@ -34,5 +34,5 @@ "esdoc": "^1.1.0",

"esdoc-node": "1.0.4",
"leasot": "^10.1.0",
"leasot": "^10.2.0",
"coveralls": "^3.0.11",
"husky": "^4.2.3"
"husky": "^4.2.5"
},

@@ -39,0 +39,0 @@ "engine-strict": true,

@@ -381,2 +381,3 @@ # Jimpex

- **Force HTTPS:** Redirect all incoming traffic from HTTP to HTTPS. It also allows you to set routes to ignore the redirection.
- **HSTS header:** It configures a `Strict-Transport-Security` header and includes it on every response.
- **Fast HTML:** Allows your app to skip unnecessary processing by showing an specific HTML when a requested route doesn't have a controller for it or is not on a "whitelist".

@@ -383,0 +384,0 @@ - **Show HTML:** A really simple middleware to serve an HTML file. Its true feature is that it can be hooked up to the **HTML Generator** service.

@@ -381,2 +381,3 @@ # Jimpex

- **Force HTTPS:** Redirect all incoming traffic from HTTP to HTTPS. It also allows you to set routes to ignore the redirection.
- **HSTS header:** It configures a `Strict-Transport-Security` header and includes it on every response.
- **Fast HTML:** Allows your app to skip unnecessary processing by showing an specific HTML when a requested route doesn't have a controller for it or is not on a "whitelist".

@@ -383,0 +384,0 @@ - **Show HTML:** A really simple middleware to serve an HTML file. Its true feature is that it can be hooked up to the **HTML Generator** service.

const { errorHandler } = require('./errorHandler');
const { forceHTTPS } = require('./forceHTTPS');
const { hsts } = require('./hsts');

@@ -7,2 +8,3 @@ module.exports = {

forceHTTPS,
hsts,
};
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