-
Notifications
You must be signed in to change notification settings - Fork 11
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
owasp:api7:2019-security-hosts-https-oas3 has incorrect validation per OAS 3.x #27
Comments
I hear what you're saying, but if a relative path is being used how can you programatically ensure it's using HTTPS? That's the whole point of this rule afterall. |
I'd argue that the rule should be interpreted as "if a server path is a fully qualified URI, ensure that it uses HTTPS". If it's a relative path, a warning could be given instead to inform the usage of HTTPS, but forcing usage of a fully qualified URI seems to be an overstep. Another compromise would be explicitly that none of the server paths start with Consider the example of having dynamically named host environments where the API is deployed. A relative server path might be the only option for documentation, but the current implementation of this rule will throw an error (thereby causing the linting process to exit) and force an override to either convert it to a warning or turn it off, potentially causing other API definitions in a monorepo using a shared configuration to miss the validation. Not everything can be covered in an automated process; API3 and API6 (as examples) are subjective in their methodology and have limited coverage programatically. The ruleset for each ensures that what can be validated is covered but doesn't validate what can't be. |
If you're trying to support that use case then warnings don't mean warnings they mean info, "hey did you know" and I've been trying to avoid clutting the messages with loads of warnings for people doing something valid. Maybe blocking |
Thanks @philsturgeon |
I've been given some time to work on this, yaaaay, so I've popped this change into #51 |
Thanks @philsturgeon! Much appreciated! |
The ruleset does not align with allowed server hosts that are valid per OAS 3.x.
Documentation
Context
It is firing a false negative with a severity of
error
.Current Behavior
A server path starting with a relative path fails linting with a severity of
error
.Expected Behavior
No errors or warnings are thrown for the rule when a server path starts with a relative path.
Possible Workaround/Solution
/^https:/
to/^((?:https:)|(?!\/\/)(?:\/))/
Steps to Reproduce
spectral lint {doc}
Environment
The text was updated successfully, but these errors were encountered: