Skip to content

Commit 1b920e6

Browse files
authored
Merge pull request #2182 from BEXIS2/rc
Test Pull Request for code scanner
2 parents 7f07112 + 14fe78f commit 1b920e6

File tree

32 files changed

+2267
-569
lines changed

32 files changed

+2267
-569
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using BExIS.Security.Entities.Requests;
2+
using System.Web.Helpers;
3+
using System.Web.Mvc;
4+
5+
namespace BExIS.App.Bootstrap.Attributes
6+
{
7+
public class ValidateAntiForgeryTokenOnPost: ActionFilterAttribute
8+
{
9+
public void OnAuthorization(AuthorizationContext filterContext)
10+
{
11+
var request = filterContext.HttpContext.Request;
12+
13+
if (filterContext.HttpContext.Request.HttpMethod == "POST")
14+
{
15+
var cookieToken = request.Cookies[AntiForgeryConfig.CookieName]?.Value;
16+
17+
// check for token in form data
18+
var formToken = request.Form["__RequestVerificationToken"];
19+
20+
// check header for post from javascript
21+
if (formToken==null)
22+
{
23+
formToken = request.Headers["__RequestVerificationToken"];
24+
}
25+
26+
AntiForgery.Validate(cookieToken, formToken);
27+
//AntiForgery.Validate();
28+
}
29+
}
30+
}
31+
}

Components/App/BExIS.App.Bootstrap/BExIS.App.Bootstrap.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
<Compile Include="Attributes\MinCapacityAttribute.cs" />
113113
<Compile Include="Attributes\NoNullOrEmptyItemsAttribute.cs" />
114114
<Compile Include="Attributes\ThrottlingFilterAttribute.cs" />
115+
<Compile Include="Attributes\ValidateAntiForgeryTokenOnPost.cs" />
115116
<Compile Include="Extensions\AuthorizationContextExtensions.cs" />
116117
<Compile Include="Helpers\BExISAuthorizeHelper.cs" />
117118
<Compile Include="Helpers\JwtHelper.cs" />

Console/BExIS.Web.Shell.Svelte/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Console/BExIS.Web.Shell.Svelte/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
},
5353
"type": "module",
5454
"dependencies": {
55-
"@bexis2/bexis2-core-ui": "0.4.47",
55+
"@bexis2/bexis2-core-ui": "0.4.49",
5656
"@sveltejs/adapter-static": "3.0.2",
5757
"buffer": "6.0.3",
5858
"gray-matter": "4.0.3",

Console/BExIS.Web.Shell/Areas/DCM/BExIS.Modules.Dcm.UI.Svelte/package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Console/BExIS.Web.Shell/Areas/DCM/BExIS.Modules.Dcm.UI.Svelte/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
},
5151
"type": "module",
5252
"dependencies": {
53-
"@bexis2/bexis2-core-ui": "0.4.47",
53+
"@bexis2/bexis2-core-ui": "0.4.49",
5454
"@bexis2/bexis2-rpm-ui": "0.2.11",
5555
"@floating-ui/dom": "1.6.8",
5656
"@fortawesome/free-solid-svg-icons": "6.6.0",

Console/BExIS.Web.Shell/Areas/DCM/BExIS.Modules.Dcm.UI/BExIS.Modules.Dcm.UI.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@
7272
<Compile Include="Controllers\Legacy\ImportMetadataStructureSetParametersController.cs" />
7373
<Compile Include="Controllers\Legacy\ImportMetadataStructureSummaryController.cs" />
7474
<Compile Include="Controllers\Legacy\ManageMetadataStructureController.cs" />
75-
<Compile Include="Controllers\Legacy\PushController.cs" />
76-
<Compile Include="Controllers\Legacy\OldSubmitController.cs" />
7775
<Compile Include="Controllers\Hooks\MetadataController.cs" />
7876
<Compile Include="Controllers\API\LinkController.cs" />
7977
<Compile Include="Controllers\Views\MessagesController.cs" />

Console/BExIS.Web.Shell/Areas/DCM/BExIS.Modules.Dcm.UI/Controllers/CreateController.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ public JsonResult Get(long id)
244244

245245
[JsonNetFilter]
246246
[HttpPost]
247+
[ValidateAntiForgeryTokenOnPost]
247248
public JsonResult Create(CreateModel data)
248249
{
249250
if (data == null) return Json(false);

Console/BExIS.Web.Shell/Areas/DCM/BExIS.Modules.Dcm.UI/Controllers/EntityTemplatesController.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ public JsonResult Delete(long id)
7777

7878
[JsonNetFilter]
7979
[HttpPost]
80+
[ValidateAntiForgeryTokenOnPost]
8081
public JsonResult Update(EntityTemplateModel entityTemplate)
8182
{
8283
using (var entityTemplateManager = new EntityTemplateManager())

Console/BExIS.Web.Shell/Areas/DCM/BExIS.Modules.Dcm.UI/Controllers/FormController.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2764,6 +2764,7 @@ private string storeGeneratedFilePathToContentDiscriptor(long datasetId, Dataset
27642764
/// Is called when the user write a letter in Autocomplete User Component
27652765
/// </summary>
27662766
[HttpPost]
2767+
[ValidateAntiForgeryTokenOnPost]
27672768
public ActionResult _AutoCompleteAjaxLoading(string text, long id, string type)
27682769
{
27692770
// if mapping with etities exits
@@ -3238,6 +3239,7 @@ private void validationAgainstJsonSchema()
32383239

32393240
//XX number of index des values nötig
32403241
[HttpPost]
3242+
[ValidateAntiForgeryTokenOnPost]
32413243
public ActionResult ValidateMetadataAttributeUsage(string value, int id, int parentid, string parentname, int number, int parentModelNumber, int parentStepId, long entityId)
32423244
{
32433245
//delete all white spaces from start and end
@@ -3327,6 +3329,7 @@ public ActionResult ValidateMetadataAttributeUsage(string value, int id, int par
33273329
}
33283330

33293331
[HttpPost]
3332+
[ValidateAntiForgeryTokenOnPost]
33303333
public ActionResult ValidateMetadataParameterUsage(string value, int id, long attrUsageId, int number, int parentModelNumber, int parentStepId, long entityId)
33313334
{
33323335
//delete all white spaces from start and end

0 commit comments

Comments
 (0)