Skip to content

Commit

Permalink
fix(bug): cannot use [GUID] in flag template
Browse files Browse the repository at this point in the history
  • Loading branch information
GZTimeWalker committed Jul 18, 2023
1 parent 1215995 commit ab5677a
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 87 deletions.
12 changes: 6 additions & 6 deletions src/GZCTF/ClientApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@mdi/react": "^1.6.1",
"@microsoft/signalr": "^7.0.9",
"dayjs": "^1.11.9",
"echarts": "^5.4.2",
"echarts": "^5.4.3",
"echarts-for-react": "^3.0.2",
"embla-carousel": "^7.1.0",
"embla-carousel-autoplay": "^7.1.0",
Expand All @@ -38,8 +38,8 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-pdf": "^7.1.3",
"react-router": "^6.14.1",
"react-router-dom": "^6.14.1",
"react-router": "^6.14.2",
"react-router-dom": "^6.14.2",
"swr": "^2.2.0",
"vite-tsconfig-paths": "^4.2.0"
},
Expand All @@ -53,8 +53,8 @@
"@types/prismjs": "^1.26.0",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@typescript-eslint/eslint-plugin": "^6.1.0",
"@typescript-eslint/parser": "^6.1.0",
"@vitejs/plugin-react": "^4.0.3",
"axios": "^1.4.0",
"babel-plugin-prismjs": "^2.1.0",
Expand All @@ -63,7 +63,7 @@
"form-data": "~4.0.0",
"lodash": "^4.17.21",
"prettier": "~3.0.0",
"rollup": "^3.26.2",
"rollup": "^3.26.3",
"swagger-typescript-api": "^13.0.0",
"tslib": "^2.6.0",
"typescript": "5.1.6",
Expand Down
140 changes: 67 additions & 73 deletions src/GZCTF/ClientApp/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions src/GZCTF/Controllers/EditController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -517,14 +517,9 @@ public async Task<IActionResult> UpdateGameChallenge([FromRoute] int id, [FromRo
if (model.FileName is not null && string.IsNullOrWhiteSpace(model.FileName))
return BadRequest(new RequestResponse("动态附件名不可为空"));

bool hintUpdated = model.Hints is not null &&
model.Hints.Count > 0 &&
model.Hints.GetSetHashCode() != res.Hints?.GetSetHashCode();

if (!string.IsNullOrWhiteSpace(model.FlagTemplate)
&& res.Type == ChallengeType.DynamicContainer
&& !model.FlagTemplate.Contains("[TEAM_HASH]")
&& Codec.Leet.LeetEntropy(model.FlagTemplate) < 32.0)
bool hintUpdated = model.IsHintUpdated(res.Hints?.GetSetHashCode());

if (res.Type == ChallengeType.DynamicContainer && !model.IsValidFlagTemplate())
return BadRequest(new RequestResponse("flag 复杂度不足,请考虑添加队伍哈希或增加长度"));

res.Update(model);
Expand Down
Loading

0 comments on commit ab5677a

Please sign in to comment.