Forbid tasks.json modification on production env
This commit is contained in:
parent
20f7bb3e59
commit
a2797cabc2
1 changed files with 4 additions and 0 deletions
|
@ -5,6 +5,7 @@ using System.Linq;
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Ksp.WebServer.Controllers
|
||||
|
@ -33,6 +34,9 @@ namespace Ksp.WebServer.Controllers
|
|||
[HttpPost]
|
||||
public async Task<IActionResult> Post()
|
||||
{
|
||||
if (env.IsProduction())
|
||||
return this.Forbid();
|
||||
|
||||
// TODO: auth org
|
||||
using var rdr = new StreamReader(HttpContext.Request.Body);
|
||||
await System.IO.File.WriteAllTextAsync(TasksJsonFile, await rdr.ReadToEndAsync());
|
||||
|
|
Reference in a new issue