Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwstubbs committed Dec 14, 2024
1 parent 7e2b831 commit 2a4ed45
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 31 deletions.
2 changes: 0 additions & 2 deletions csharp/ql/src/experimental/CWE-942/CorsMisconfiguration.ql
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
*/

import csharp
private import DataFlow
import semmle.code.csharp.frameworks.system.Web
import CorsMisconfigurationLib

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@
*/

import csharp
private import DataFlow
import semmle.code.csharp.frameworks.system.Web
import CorsMisconfigurationLib

/**
* Holds if credentials are allowed
*/
/** A call to `CorsPolicyBuilder.AllowCredentials`. */
class AllowsCredentials extends MethodCall {
AllowsCredentials() {
this.getTarget()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,23 @@
using System;
using Microsoft.Extensions.DependencyInjection;

public class Startup {
public void ConfigureServices(string[] args) {
var builder = WebApplication.CreateBuilder(args);
var MyAllowSpecificOrigins = "_myAllowSpecificOrigins";

builder.Services.AddCors(options => {
options.AddPolicy(MyAllowSpecificOrigins,
policy => {
policy.SetIsOriginAllowed(test => true).AllowCredentials().AllowAnyHeader().AllowAnyMethod();
});
});

public class Startup
{
    public void ConfigureServices(string[] args)
    {
var builder = WebApplication.CreateBuilder(args);
var MyAllowSpecificOrigins = "_myAllowSpecificOrigins";
var app = builder.Build();

app.MapGet("/", () => "Hello World!");
app.UseCors(MyAllowSpecificOrigins);

builder.Services.AddCors(options =>
{
    options.AddPolicy(MyAllowSpecificOrigins,
                      policy =>
                      {
                          policy.SetIsOriginAllowed(test => true).AllowCredentials().AllowAnyHeader().AllowAnyMethod();
                      });
});

var app = builder.Build();



app.MapGet("/", () => "Hello World!");
app.UseCors(MyAllowSpecificOrigins);

app.Run();
    }
app.Run();
}
}

0 comments on commit 2a4ed45

Please sign in to comment.