mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
fix: prevent internal server endpoint leakage in openapi
This commit is contained in:
@@ -34,7 +34,17 @@ namespace SharpbinV3.Server
|
|||||||
JsonIgnoreCondition.WhenWritingNull;
|
JsonIgnoreCondition.WhenWritingNull;
|
||||||
});
|
});
|
||||||
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
|
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
|
||||||
builder.Services.AddOpenApi();
|
builder.Services.AddOpenApi(options =>
|
||||||
|
{
|
||||||
|
options.AddDocumentTransformer(
|
||||||
|
(document, context, cancellationToken) =>
|
||||||
|
{
|
||||||
|
document?.Servers?.Clear();
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
builder.Services.AddDbContext<AppDbContext>(opt =>
|
builder.Services.AddDbContext<AppDbContext>(opt =>
|
||||||
{
|
{
|
||||||
opt.UseSqlite(builder.Configuration.GetConnectionString("DefaultConnection"));
|
opt.UseSqlite(builder.Configuration.GetConnectionString("DefaultConnection"));
|
||||||
|
|||||||
Reference in New Issue
Block a user