Skip to content

owasp:api2:2023-no-credentials-in-url throws error when @.in.match is undefined #76

@baumac

Description

@baumac

Context

Running v2.0.1 of the ruleset results in a scope.sandbox.at(...).value.in.match is not a function error when @.in.match is undefined. For an example see the "Steps to Reproduce section".

Current Behavior

Spectral crashes with a scope.sandbox.at(...).value.in.match is not a function error when @.in.match is undefined.

Expected Behavior

Spectral should not crash and should report the linting results.

Possible Workaround/Solution

Potential fix in #75

Steps to Reproduce

  1. Create a .spectral.yaml file with the below contents
extends: ["@stoplight/spectral-owasp-ruleset"]
  1. Create an openapi-spec.json file with the below contents
{
  "openapi": "3.1.0",
  "servers": [],
  "paths": {},
  "components": {
    "schemas": {
      "testSchema": {
        "paths": {
          "type": "object",
          "properties": {
            "parameters": {
              "type": "array",
              "description": "",
              "items": {
                "type": "object",
                "description": "",
                "properties": {
                  "in": {
                    "type": "string",
                    "description": ""
                  },
                  "name": {
                    "type": "string",
                    "description": ""
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "info": {
    "title": "",
    "version": ""
  },
  "webhooks": {}
}


  1. Run spectral:
spectral lint openapi-spec.json

Environment

  • Version used: spectral cli 6.11.0
  • Environment name and version (e.g. Chrome 39, node.js 5.4): n/a
  • Operating System and version (desktop or mobile): MacOs 15.6.1
  • Link to your environment/workspace/project:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions