Skip to content

fix(HTTP): prevent false positive header matches in Cors::hasResponseHeaders() - #10731

Merged
michalsn merged 1 commit into
codeigniter4:developfrom
gr8man:fix/cors-has-response-headers
Nov 12, 2026
Merged

michalsn merged 1 commit into
codeigniter4:developfrom
gr8man:fix/cors-has-response-headers

Conversation

@gr8man

@gr8man gr8man commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Description
Cors::hasResponseHeaders() used str_contains() to check for exposed headers, which produced false positives when an existing header was a prefix/substring of the configured header (e.g. X-Custom matched in X-Custom-Header). It now parses the header list and performs exact, case-insensitive comparisons for each configured header.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@carson-codeigniter4 carson-codeigniter4 Bot added the bug Verified issues on the current code behavior or pull requests that will fix them label Nov 5, 2026
@gr8man
gr8man force-pushed the fix/cors-has-response-headers branch from d5df9b7 to 3b1860e Compare November 5, 2026 20:31
@gr8man
gr8man force-pushed the fix/cors-has-response-headers branch from 3b1860e to ebaca13 Compare November 9, 2026 18:22
@michalsn
michalsn merged commit c54c65e into codeigniter4:develop Nov 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Verified issues on the current code behavior or pull requests that will fix them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants