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

Omit Empty Fields #3977

Merged
merged 6 commits into from
Jul 28, 2023
Merged

Conversation

kchason
Copy link
Contributor

@kchason kchason commented Jul 24, 2023

Proposed changes

Addresses #3892.

  • Adds the omitempty property to the Lines property
  • Switch the reference field to a pointer to a RawStringSlice since structs themselves (e.g. RawStringSlice) don't properly follow omitempty marshaling since they aren't nilable

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)

@kchason kchason marked this pull request as draft July 24, 2023 18:00
@kchason kchason marked this pull request as ready for review July 24, 2023 18:52
@tarunKoyalwar tarunKoyalwar linked an issue Jul 24, 2023 that may be closed by this pull request
Copy link
Member

@ehsandeep ehsandeep left a comment

Choose a reason for hiding this comment

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

echo https://projectdiscovery.io | ./nuclei -id tech-detect -j -or | jq .

                     __     _
   ____  __  _______/ /__  (_)
  / __ \/ / / / ___/ / _ \/ /
 / / / / /_/ / /__/ /  __/ /
/_/ /_/\__,_/\___/_/\___/_/   v2.9.9

		projectdiscovery.io

[INF] Current nuclei version: v2.9.9 (latest)
[INF] Current nuclei-templates version: v9.5.8 (latest)
[INF] New templates added in latest release: 113
[INF] Templates loaded for current scan: 1
[INF] Targets loaded for current scan: 1
{
  "template": "http/technologies/tech-detect.yaml",
  "template-url": "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/technologies/tech-detect.yaml",
  "template-id": "tech-detect",
  "template-path": "/Users/geekboy/nuclei-templates/http/technologies/tech-detect.yaml",
  "info": {
    "name": "Wappalyzer Technology Detection",
    "author": [
      "hakluke"
    ],
    "tags": [
      "tech"
    ],
    "severity": "info",
    "metadata": {
      "max-request": 1
    }
  },
  "matcher-name": "google-font-api",
  "type": "http",
  "host": "https://projectdiscovery.io",
  "matched-at": "https://projectdiscovery.io",
  "ip": "172.67.74.214",
  "timestamp": "2023-07-26T00:00:52.380353+05:30",
  "curl-command": "curl -X 'GET' -d '' -H 'Accept: */*' -H 'Accept-Language: en' -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686 on x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2820.59 Safari/537.36' 'https://projectdiscovery.io'",
  "matcher-status": true
}

@ehsandeep ehsandeep added the Type: Maintenance Updating phrasing or wording to make things clearer or removing ambiguity. label Jul 25, 2023
Copy link
Member

@tarunKoyalwar tarunKoyalwar left a comment

Choose a reason for hiding this comment

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

$ echo https://projectdiscovery.io | ./nuclei -id tech-detect -j -or | jq .

                     __     _
   ____  __  _______/ /__  (_)
  / __ \/ / / / ___/ / _ \/ /
 / / / / /_/ / /__/ /  __/ /
/_/ /_/\__,_/\___/_/\___/_/   v2.9.9

		projectdiscovery.io

[INF] Current nuclei version: v2.9.9 (latest)
[INF] Current nuclei-templates version: v9.5.8 (latest)
[INF] New templates added in latest release: 113
[INF] Templates loaded for current scan: 1
[INF] Targets loaded for current scan: 1
{
  "template": "http/technologies/tech-detect.yaml",
  "template-url": "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/technologies/tech-detect.yaml",
  "template-id": "tech-detect",
  "template-path": "/Users/tarun/nuclei-templates/http/technologies/tech-detect.yaml",
  "info": {
    "name": "Wappalyzer Technology Detection",
    "author": [
      "hakluke"
    ],
    "tags": [
      "tech"
    ],
    "severity": "info",
    "metadata": {
      "max-request": 1
    }
  },
  "matcher-name": "google-font-api",
  "type": "http",
  "host": "https://projectdiscovery.io",
  "matched-at": "https://projectdiscovery.io",
  "ip": "104.26.6.152",
  "timestamp": "2023-07-28T19:31:51.783437+05:30",
  "curl-command": "curl -X 'GET' -d '' -H 'Accept: */*' -H 'Accept-Language: en' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36' 'https://projectdiscovery.io'",
  "matcher-status": true
}
{
  "template": "http/technologies/tech-detect.yaml",
  "template-url": "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/technologies/tech-detect.yaml",
  "template-id": "tech-detect",
  "template-path": "/Users/tarun/nuclei-templates/http/technologies/tech-detect.yaml",
  "info": {
    "name": "Wappalyzer Technology Detection",
    "author": [
      "hakluke"
    ],
    "tags": [
      "tech"
    ],
    "severity": "info",
    "metadata": {
      "max-request": 1
    }
  },
  "matcher-name": "cloudflare",
  "type": "http",
  "host": "https://projectdiscovery.io",
  "matched-at": "https://projectdiscovery.io",
  "ip": "104.26.6.152",
  "timestamp": "2023-07-28T19:31:51.783831+05:30",
  "curl-command": "curl -X 'GET' -d '' -H 'Accept: */*' -H 'Accept-Language: en' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36' 'https://projectdiscovery.io'",
  "matcher-status": true
}

@ehsandeep ehsandeep merged commit fd13225 into projectdiscovery:dev Jul 28, 2023
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Maintenance Updating phrasing or wording to make things clearer or removing ambiguity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug in omitempty fields in output
3 participants