Skip to content
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

refactor(fuzz): use mapsutil.Map type #5558

Merged

Conversation

dwisiswant0
Copy link
Member

@dwisiswant0 dwisiswant0 commented Aug 23, 2024

Proposed changes

Fix #5557

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Signed-off-by: Dwi Siswanto <git@dw1.io>
@auto-assign auto-assign bot requested a review from dogancanbakir August 23, 2024 08:38
@dwisiswant0 dwisiswant0 marked this pull request as draft August 24, 2024 02:10
Signed-off-by: Dwi Siswanto <git@dw1.io>
@dwisiswant0 dwisiswant0 marked this pull request as ready for review August 24, 2024 02:49
@dwisiswant0 dwisiswant0 linked an issue Aug 24, 2024 that may be closed by this pull request
@dwisiswant0 dwisiswant0 removed a link to an issue Aug 24, 2024
Copy link
Member

@Mzack9999 Mzack9999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking as request changes to review a potential suggestion

original := originalValues[key].(string)
new := q.value.parsed.Map[key].(string)

original := originalValues.GetOrDefault(key, "").(string)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we guard here using fmt.Sprint(..), anyway if it's a string we will get the same value of .(string)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we guard here using fmt.Sprint(..) [...]

If the values are always strings (or not?), sticking with the type assertion might be preferable for performance & type safety reasons.

[...] anyway if it's a string we will get the same value of .(string)?

Since the type of map is any, we still need to do a type assertion.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we should ensure that the assertion went correctly with:

a, ok := c.(string)
if !ok {
    continue 
}

what do you think?

Signed-off-by: Dwi Siswanto <git@dw1.io>
@dwisiswant0 dwisiswant0 requested a review from Mzack9999 August 26, 2024 08:47
@ehsandeep ehsandeep merged commit aac1af1 into dev Aug 28, 2024
12 checks passed
@ehsandeep ehsandeep deleted the dwisiswant0/refactor/fuzz/dataformat-use-mapsutil-types branch August 28, 2024 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Nuclei crashes when running in DAST mode with specific input
4 participants