Skip to content

Commit

Permalink
Restrict large file uploads to only the Lift Upload endpoint (#875)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnthagen authored Dec 18, 2020
1 parent baab15c commit dd7bd80
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
4 changes: 4 additions & 0 deletions Backend/Controllers/LiftController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ public LiftController(IWordRepository repo, IProjectService projServ, IPermissio
/// <remarks> POST: v1/projects/{projectId}/words/upload </remarks>
/// <returns> Number of words added </returns>
[HttpPost("upload")]
// Allow clients to POST large import files to the server (default limit is 28MB).
// Note: The HTTP Proxy in front, such as NGNIX, also needs to be configured
// to allow large requests through as well.
[RequestSizeLimit(250_000_000)] // 250MB.
public async Task<IActionResult> UploadLiftFile(string projectId, [FromForm] FileUpload fileUpload)
{
if (!_permissionService.HasProjectPermission(HttpContext, Permission.ImportExport))
Expand Down
8 changes: 0 additions & 8 deletions Backend/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ public static void Main(string[] args)

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureKestrel((context, options) =>
{
// Allow clients to POST large files to servers, such as project imports.
// Note: The HTTP Proxy in front, such as NGNIX, also needs to be configured
// to allow large requests through as well.
// 250MB.
options.Limits.MaxRequestBodySize = 250_000_000;
})
.UseStartup<Startup>();
}
}
8 changes: 7 additions & 1 deletion user_guide/docs/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ and associated with new data entries.

### Import and Export

Currently, only one LIFT file can be imported per project.
!!! note

Currently, the maximum size of Lift files supported for import is 250MB.

!!! note

Currently, only one LIFT file can be imported per project.

After clicking the Export button, you can navigate to other parts of the website. A notification will appear in the App
Bar when the export is ready for download. A project that has reached hundreds of MB is size may take tens of minutes to
Expand Down
2 changes: 2 additions & 0 deletions user_guide/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ nav:
- Data Entry: dataEntry.md
- Data Cleanup: goals.md
- Admin: admin.md
markdown_extensions:
- admonition

0 comments on commit dd7bd80

Please sign in to comment.