-
-
Notifications
You must be signed in to change notification settings - Fork 408
Fixes Issue 915 #924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes Issue 915 #924
Changes from all commits
2810613
1302899
e71b0c5
f31bf52
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3784,4 +3784,27 @@ public void TestIssue888_ShouldIgnoreFrame() | |
| Assert.Equal(dataInSheet, dataRead); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void TestIssue915() | ||
| { | ||
| var templatePath = PathHelper.GetFile("xlsx/TestIssue915.xlsx"); | ||
| var value = new Dictionary<string,object> | ||
| { | ||
| ["Data"] = new[] | ||
| { | ||
| new { Name = "Hill", Altitude = 6m }, | ||
| new { Name = "Mount", Altitude = 7.4m }, | ||
| new { Name = "Peak", Altitude = 8.6m } | ||
| } | ||
| }; | ||
|
|
||
| using var path = AutoDeletingPath.Create(); | ||
| _excelTemplater.ApplyTemplate(path.ToString(), templatePath, value); | ||
|
|
||
| var result = _excelImporter.Query(path.ToString(), true).ToList(); | ||
|
|
||
| Assert.Equal(6, result[0].Altitude); | ||
| Assert.Equal(7.4, result[1].Altitude); | ||
| Assert.Equal(8.6, result[2].Altitude); | ||
|
Comment on lines
+3806
to
+3808
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency and clarity in the test, it would be better to use floating-point literals for all assertions. The values read from Excel numeric cells are of type Assert.Equal(6.0, result[0].Altitude);
Assert.Equal(7.4, result[1].Altitude);
Assert.Equal(8.6, result[2].Altitude); |
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line retrieves user-provided values for template replacement. If these values start with
$=, they will be interpreted as formulas in the resulting Excel file, leading to Formula Injection. See the comment on line 800 for more details and remediation steps.