Skip to content

Commit

Permalink
fix security issue caused by passing the project file name directly i…
Browse files Browse the repository at this point in the history
…nstead of looking up the project in the project list.
  • Loading branch information
hahn-kev committed Jun 14, 2024
1 parent 386af71 commit 64c53e7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions backend/LocalWebApp/Services/ImportFwdataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ public class ImportFwdataService(ProjectsService projectsService, ILogger<Import
{
public async Task<CrdtProject> Import(string projectName)
{
using var fwDataApi = fwDataFactory.GetFwDataMiniLcmApi(projectName, false);
var project = await projectsService.CreateProject(Path.GetFileNameWithoutExtension(projectName),
var fwDataProject = FieldWorksProjectList.GetProject(projectName);
if (fwDataProject is null)
{
throw new InvalidOperationException($"Project {projectName} not found.");
}
using var fwDataApi = fwDataFactory.GetFwDataMiniLcmApi(fwDataProject, false);
var project = await projectsService.CreateProject(fwDataProject.Name,
afterCreate: async (provider, project) =>
{
var crdtApi = provider.GetRequiredService<ILexboxApi>();
Expand Down

0 comments on commit 64c53e7

Please sign in to comment.