Skip to content

Commit

Permalink
Merge pull request #53 from WSE-research/52-swagger-doesnt-support-bo…
Browse files Browse the repository at this point in the history
…dy-in-get-methods

Body to Query change in Get-Methods
  • Loading branch information
KnYL3R authored May 21, 2024
2 parents c56e4a4 + 6f855dd commit 9614f31
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions code/AmIVulnerable/AmIVulnerable/Controllers/DbController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,14 @@ public IActionResult GetFullTextCve([FromQuery] string? cve_number) {
/// <returns>Ok with result. NoContent if empty.</returns>
[HttpGet]
[Route("checkSinglePackage")]
public IActionResult CheckSinglePackage([FromBody] PackageForApi packageName) {
public IActionResult CheckSinglePackage([FromQuery] string PackageName,
[FromQuery] string? PackageVersion) {
if (!(this.Request.Headers.Accept.Equals("application/json") || this.Request.Headers.Accept.Equals("*/*"))) {
return StatusCode(406);
}
using (Operation.Time($"Complete Time for Query-SingleSearch after Package \"{packageName}\"")) {
using (Operation.Time($"Complete Time for Query-SingleSearch after Package \"{PackageName}\"")) {
List<CveResult> results = [];
DataTable dtResult = SearchInMySql(packageName.PackageName);
DataTable dtResult = SearchInMySql(PackageName);
// convert the result
foreach (DataRow x in dtResult.Rows) {
CveResult y = new CveResult() {
Expand Down Expand Up @@ -240,7 +241,8 @@ public IActionResult CheckSinglePackage([FromBody] PackageForApi packageName) {
}

/// <summary>
/// Search for a list of packages
/// Search for a list of packages.
/// Not useable in swagger because of body - but curl works fine.
/// </summary>
/// <param name="packages">List of tuple: package, version</param>
/// <returns>OK, if exists. OK, if no package list searched. NoContent if not found.</returns>
Expand Down

0 comments on commit 9614f31

Please sign in to comment.