GithubHelp home page GithubHelp logo

sourcefuse / loopback4-helmet Goto Github PK

View Code? Open in Web Editor NEW
27.0 14.0 3.0 2.51 MB

A loopback4 extension for helmetjs integration

License: MIT License

JavaScript 61.55% TypeScript 27.10% Shell 2.03% EJS 9.33%
loopback4 loopback4-extension loopback-next helmetjs security security-hardening security-tools arcbysf

loopback4-helmet's People

Contributors

akshatdubeysf avatar ankurbansalsf avatar arpit1503khanna avatar barleendhaliwal avatar dependabot[bot] avatar gautam23-sf avatar jyoti-13 avatar raghavarorasf avatar samarpan-b avatar semantic-release-bot avatar sf-kansara avatar sf-sahil-jassal avatar sfdevops avatar shubhamp-sf avatar surbhi-sharma1 avatar tyagi-sunny avatar yeshamavani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

loopback4-helmet's Issues

Cannot read property 'constructor' of null

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
    To reproduce,
    npm uninstall loopback4-helmet

Configure application, put this.component(Loopback4HelmetComponent);

Setup bind
this.bind(HelmetSecurityBindings.CONFIG).to({
referrerPolicy: {
policy: 'same-origin',
},
contentSecurityPolicy: {
directives: {
frameSrc: ["'self'"],
},
},
});

In a sequence constructor
@Inject(HelmetSecurityBindings.HELMET_SECURITY_ACTION)
protected helmetAction: HelmetAction,

Handle
await this.helmetAction(request, response);

When I try to request any endpoint I receive error:
GET /api/v1/animal/1/10?sort=order&direction=asc failed with status code 500. TypeError: Cannot read property 'constructor' of null

Expected behavior

The expectation is to intercept all requests and use this for security, mainly avoiding XSS attacks

Screenshots
image

@loopback/cli version: 3.0.0

semantic-release : patch release via chore

Describe the bug
Changes for semantic-release
when dependencies are updated with chore type new version is not released

To Reproduce
try updating the dependencies using chore(deps)

Expected behavior
when dependencies are updated with chore type new version must be released

Cross origin Error in Application, but api-explorer works fine

Describe the bug
Cross origin Error in Application, but api-explorer works fine

To Reproduce
Steps to reproduce the behavior:

  1. In application.ts file :-
    this.bind(HelmetSecurityBindings.CONFIG).to({
    referrerPolicy: {
    policy: 'same-origin',
    },
    contentSecurityPolicy: {
    directives: {
    frameSrc: ["'self'"],
    },
    },
    });

  2. Also throw has been blocked by CORS policy: Response header

Remove support for node v14

Is your feature request related to a problem? Please describe.
Node v14 reaching its end of life this month. Loopback removes support for node v14 in all of its packages we depend on.

Sourceloop packages/services also currently have v12 and v14 as the supported versions.

Describe the solution you'd like
Remove the support for node v14 and v12. And add the support for the latest LTS version v18.

Describe alternatives you've considered
__

Additional context
__

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two Factor Authentication for your account, set its level to "Authorization only" in your account settings. semantic-release cannot publish with the default "
Authorization and writes" level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot 📦🚀

Semantic Release

Is your feature request related to a problem? Please describe.
Adding semantic release for automatic release of packages.

Describe the solution you'd like
Using npm semantic-release

Describe alternatives you've considered

Additional context

Correct the changelog Format

Describe the bug
Right now Issue description is not visible in the changelog
To Reproduce
Steps to reproduce the behavior:

  1. Release a new version
  2. check the changelog
  3. Issue Description not visible
  4. Issue link not clickable

Setup Release Process via GH Actions

Is your feature request related to a problem? Please describe.
After the sourceloop release processes regression on jenkins the release of packages needs to be done locally.

Describe the solution you'd like
Set up a manually dispatch-able github action to publish releases.

Describe alternatives you've considered
The possible alternate is to publish packages locally but that requires keeping the credentials environment already setup.

Additional context
__

Update the docs: how to use this with LB4 Middleware Sequence?

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Your documentation is outdated. It still assumes people use the Action based sequence, but that's deprecated. The LB4 CLI generates Middleware sequences now, but you don't have instructions for that.

Describe the solution you'd like
A clear and concise description of what you want to happen.

Please provide up-to-date instruction on how to use this with Loopback 4. How to use this component in a Middleware sequence?
The LB4 documentation on this is insufficient and confusing.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

ResolutionError: The key 'sf.security.helmet.actions' is not bound to any value in context RequestContext-gY0uhFUWRMyqzs2bXcksWw-3

Describe the bug
While putting the following code in sequence.ts file

export class MySequence implements SequenceHandler {

@Inject(SequenceActions.INVOKE_MIDDLEWARE, {optional: true})
protected invokeMiddlewareN: InvokeMiddleware = () => false;

constructor(
@Inject(SequenceActions.FIND_ROUTE) protected findRoute: FindRoute,
@Inject(SequenceActions.PARSE_PARAMS) protected parseParams: ParseParams,
@Inject(SequenceActions.INVOKE_METHOD) protected invoke: InvokeMethod,
@Inject(SequenceActions.SEND) public send: Send,
@Inject(SequenceActions.REJECT) public reject: Reject,
@Inject(HelmetSecurityBindings.HELMET_SECURITY_ACTION)
protected helmetAction: HelmetAction,
) { }

async handle(context: RequestContext) {
const requestTime = Date.now();
try {
const {request, response} = context;
const route = this.findRoute(request);
const args = await this.parseParams(request, route);

  // Helmet Action here
  //await this.helmetAction(request, response);

  const result = await this.invoke(route, args);
  this.send(response, result);
} catch (err) {
  console.log();
} finally {
  console.log();
}

}
}

I am getting an error

"Resolution Error: The key 'sf.security.helmet.actions' is not bound to any value in context RequestContext-gY0uhFUWRMyqzs2bXcksWw-3"

I want to use helmet for Strict Transport Security Policy and Cross Origin Resource Sharing Configuration, but I am stuck here only.

Please help me, I am new to loop back. Thank you in advance.

Update all dependencies

  • update all dependencies ( including dev and peer dependencies)
  • use node version 16 for the same

Test case coverage lacking

Describe the bug
Test case coverage missing and not up to the mark

To Reproduce
We should have at least 75% unit test case coverage for this package.

Argument of type 'typeof Loopback4HelmetComponent' is not assignable to parameter of type 'Constructor<Component>'

Hi Team,
I am getting this error in application.ts while initialize the Loopback4HelmetComponent.
image

versions:
"@loopback/boot": "^3.4.2",
"@loopback/context": "^5.0.7",
"@loopback/core": "^2.16.2",
"@loopback/repository": "^3.7.1",
"@loopback/rest": "^10.0.0",
"@loopback/rest-explorer": "^3.3.2",
"@loopback/service-proxy": "^3.2.2",
"loopback4-helmet": "^4.2.0",

please help me on this issue.

Package Update : loopback4-helmet

Describe the bug
remove all current vulnerability of loopback4-helmet

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Regd error in request for : await this.helmetAction(request, response);

I am getting error in the following line

// Helmet Action here
await this.helmetAction(request, response);

Argument of type 'import("//node_modules/@types/express/index").Request<import("/home/surabhi/Documents/ /node_modules/@types/express-serve-static-core/index").ParamsDictionary, any, any, qs.ParsedQs, Record<string, any>>' is not assignable to parameter of type 'import /node_modules/@loopback/express/node_modules/@types/express/index").Request<import("//node_modules/@loopback/express/node_modules/@types/express-serve-static-core/index").ParamsDictionary, any, any, qs.ParsedQs, Record<...>>'.
The types of 'app.get' are incompatible between these types.
Type '((name: string) => any) & IRouterMatcher<Application, any>' is not assignable to type '((name: string) => any) & IRouterMatcher<Application<Record<string, any>>, any>'.
Type '((name: string) => any) & IRouterMatcher<Application, any>' is not assignable to type 'IRouterMatcher<Application<Record<string, any>>, any>'.
Types of parameters 'name' and 'path' are incompatible.
Type 'PathParams' is not assignable to type 'string'.
Type 'RegExp' is not assignable to type 'string'.ts(2345)

I appreciate your help.

Stale Bot missing in the repository

Describe the bug
Currently the issues and PR never closed even if inactive.
They should be closed automatically.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new issue/Pr
  2. Observe it.
  3. Even after no activity it stays open.

Expected behavior
Inactive issues/Pr should be closed automatically.

Request for more detailed and customizable changelog

Is your feature request related to a problem? Please describe.
Right now the changelog created for releases is not well in detail and informative.
Request to generate detailed changelog.

Describe the solution you'd like
Can use different npm packages available

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.