Skip to content

bug(linux): nginx.conf file scanning error out for "=" and ":" characters #7474

Open
@bsangwan

Description

@bsangwan

Found a bug? You're welcome to GitHub Discussions

  • Please make sure to:
    • Describe in details what the problem is
      When I scan nginx.conf file following 2 lines creates parsing error
      add_header X-XSS-Protection "1; mode=block" always; << in Server block
      proxy_pass http://localhost:8080/; << in Location block

    • Attach a log file with relevant data preferably in DEBUG level (--log-level=DEBUG)

7:47PM INF Scanning with Keeping Infrastructure as Code Secure v2.1.7
7:47PM INF Operating system: linux
7:47PM INF Total memory: 1.9G
7:47PM INF CPU: 12.0
7:47PM INF Max file size permitted for scanning: 5 MB
7:47PM INF Max resolver depth permitted for resolving files: 15
7:47PM INF Total files in the project: 1
7:47PM INF Loading queries of type: ansible
7:47PM INF Inspector initialized, number of queries=285
7:47PM INF Query execution timeout=1m0s
Preparing Scan Assets: Done
7:47PM ERR failed to parse file content: /tmp/templates/nginx.conf error="missing section header: 68 proxy_pass http://localhost8080/;"
Executing queries: [---------------------------------------------------] 100.00%

  • Attach the scanned sample files, anonymize the data if the original file cannot be provided
  • When attaching files to the issue make sure they are properly formatted

Expected Behavior

Scan should succeed

(Which results are expected from KICS?)

Actual Behavior

(Formatted logs and samples helps us to better understand the issue)

Err => failed to parse file contents

Steps to Reproduce the Problem

(Command line arguments and flags used)

  1. Scan any nginx conf file by adding
    add_header X-XSS-Protection "1; mode=block" always; << in Server block
    proxy_pass http://localhost:8080/; << in Location block
  2. Kicks will fail to parse.
  3. Remove "=" and ":" characters from these lines. Scanning will succeed.

Specifications

(N/A if not applicable)

  • Version: 2.1.7
  • Platform: Linux
  • Subsystem: Docker image

Metadata

Metadata

Assignees

No one assigned

    Labels

    ansibleAnsible querybugSomething isn't workingcommunityCommunity contributiondockerDocker queryqueryNew query feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions