mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-05 18:48:41 +00:00
fix: prevent internal server endpoint leakage in openapi
This commit is contained in:
@@ -34,7 +34,17 @@ namespace SharpbinV3.Server
|
||||
JsonIgnoreCondition.WhenWritingNull;
|
||||
});
|
||||
// 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 =>
|
||||
{
|
||||
opt.UseSqlite(builder.Configuration.GetConnectionString("DefaultConnection"));
|
||||
|
||||
Reference in New Issue
Block a user