Coder Social home page Coder Social logo

Comments (8)

ismcagdas avatar ismcagdas commented on July 23, 2024

You may create a custom middleware and add this header. You can take a look at https://stackoverflow.com/a/37395430

from aspnetboilerplate.

frogerdevs avatar frogerdevs commented on July 23, 2024

You may create a custom middleware and add this header. You can take a look at https://stackoverflow.com/a/37395430

I have added middleware in my code but still didn't work.

here is my middleware:

app.Use(async (context, next) =>
{
    context.Response.GetTypedHeaders().CacheControl =
        new Microsoft.Net.Http.Headers.CacheControlHeaderValue()
        {
            NoStore = true,
            NoCache = true,
        };
    context.Response.Headers["Expires"] = "0";
    context.Response.Headers["Pragma"] = "no-cache";
    context.Response.Headers["Content-Security-Policy"] = "default-src 'self'; " +
    "script-src 'self' 'unsafe-inline' ; " +
    "style-src 'self' 'unsafe-inline' fonts.googleapis.com fonts.gstatic.com ;" +
    "font-src 'self' fonts.googleapis.com fonts.gstatic.com ; " +
    "img-src 'self' validator.swagger.io data:;" +
    "connect-src 'self' ws: wss:;";
    context.Response.Headers["Referrer-Policy"] = "no-referrer";
    context.Response.Headers["Permissions-Policy"] = "geolocation=(), camera=(), microphone=(), display-capture=(), fullscreen=(), web-share=()";
    context.Response.Headers["X-Frame-Options"] = "SAMEORIGIN";
    context.Response.Headers["X-Content-Type-Options"] = "nosniff";
    context.Response.Headers["Strict-Transport-Security"] = "max-age=31536000; includeSubDomains";
    await next();
});

from aspnetboilerplate.

ismcagdas avatar ismcagdas commented on July 23, 2024

Does this work on a raw ASP.NET Core project ?

from aspnetboilerplate.

frogerdevs avatar frogerdevs commented on July 23, 2024

Does this work on a raw ASP.NET Core project ?

Yes, When I create a new Project, from ASP.Net Core 7 no issue detected on snyk.

What makes me wonder is why this solution/project reads as ASP.NET Web API

from aspnetboilerplate.

ismcagdas avatar ismcagdas commented on July 23, 2024

Could you share the website URL of the tool you used ? I mean snyk.

from aspnetboilerplate.

frogerdevs avatar frogerdevs commented on July 23, 2024

Could you share the website URL of the tool you used ? I mean snyk.

Here's is the link https://snyk.io/
You can register and use for free,
And download and install extension for your IDE (in my case VS 2022) or use extension manager form VS 2022.

from aspnetboilerplate.

frogerdevs avatar frogerdevs commented on July 23, 2024

I think I have a Solution for this issue, but didn't know what the impacts are for the existing application.

Just Delete the file "app.config" on the ".Web.Host" Project.

Hope it's Help

from aspnetboilerplate.

ismcagdas avatar ismcagdas commented on July 23, 2024

@frogerdevs you are right, this file is not used anymore.

from aspnetboilerplate.

Related Issues (20)

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.