Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make response security headers built-in #140

Open
ceilfors opened this issue Jun 29, 2019 · 0 comments
Open

Make response security headers built-in #140

ceilfors opened this issue Jun 29, 2019 · 0 comments

Comments

@ceilfors
Copy link
Collaborator

ceilfors commented Jun 29, 2019

Is your feature request related to a problem? Please describe.
It's common to configure security headers in API endpoints. See: https://github.com/helmetjs/helmet. We needed to configure this manually in most of our projects after we got a penetration testing report.

The one that always come back to us is:
'Strict-Transport-Security': 'max-age=.....; includeSubdomains;'

Describe the solution you'd like
Something like this:

const adapterApi = require("@laconia/adapter-api");

const apigateway = adapterApi.apigateway({
  responseSecurityHeaders: true // Should `true` be default? Is this a breaking change?
})

exports.handler = laconia(apigateway(app)).register(instances);

In our first iteration, we can support only all the sensible defaults, and support customisation in the next iteration like:

const apigateway = adapterApi.apigateway({
  responseSecurityHeaders: {
    // options
  }
})

See middy middleware for better inspiration too: https://github.com/middyjs/middy/blob/master/docs/middlewares.md#httpsecurityheaders

@ceilfors ceilfors changed the title Make security headers middleware built-in Make response security headers built-in Jul 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant