Skip to content

applies_to_file_regex tag doesn't work propertly #588

@ganchix

Description

@ganchix

Describe the bug

The following regex in applies_to_file_regex doesn't work properly:

^(?!\/.configuration$)\/.+\/.configuration$

The regex search .configuration files in folders or subfolders but not in the root, using the following rule:

 {
    "name": "DES",
    "id": "DES1",
    "description": "This is a description",
    "applies_to_file_regex": [
      "^(?!\\/.configuration$)\\/.+\\/.configuration$"
    ],
    "tags": [
      "Configuration"
    ],
    "severity": "critical",
    "patterns": [
      {
        "pattern": "^",
        "type": "regex",
        "scopes": [
          "all"
        ],
        "modifiers": [],
        "confidence": "high"
      }
    ]
  }

Inspector detects the root file:

image

I tested the regex using an online regex tester and seems to be ok:

image

To Reproduce

  1. Create rule and folder with .configuration file
  2. Run inspector with analyze with HTML output

Expected behavior

The root file won't be detected by Inspector using the regex expression.

Operating Environment (please complete the following information):

  • Application Inspector Version: 1.9.22
  • OS: MacOS 14.5 using docker image mcr.microsoft.com/dotnet/sdk:8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions