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

fixing Access-Control-Allow-Origin rule for response headers #68

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

sekharbr
Copy link
Contributor

Check for Access-Control-Allow-Origin doesn't need to check all the headers, it only need to check the response headers. Otherwise it will show the error for header schema defined in components.

Motivation and Context

The rule is creating false error, it says headers in components are missing Access-Control-Allow-Origin. This check should check only response headers, not header schema defined under components. header ref schema defined in components may have different name (for ex: '#/components/headers/AccessControlAllowOrigin'
RateLimit-Limit:)

#InsertIssueNumberHere

Description

Updated the rule given to only check response headers
given: $..[responses][*].headers

How Has This Been Tested?

This is tested locally in locally test environments and test and production grade API contracts (Open API specification)

Screenshot(s)/recordings(s)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

Check for Access-Control-Allow-Origin doesn't need to check all the headers, it only need to check the response headers. Otherwise it will show the error for header schema defined in components.
@sekharbr sekharbr changed the title Update ruleset.ts fixing Access-Control-Allow-Origin rule for response headers Aug 13, 2024
@mnaumanali94 mnaumanali94 self-requested a review September 13, 2024 19:05
@mnaumanali94 mnaumanali94 enabled auto-merge (squash) September 13, 2024 19:05
@mnaumanali94 mnaumanali94 merged commit 4d934c1 into stoplightio:main Sep 13, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants