openresty / openresty/headers-more-nginx-module

more_clear_input_header and more_set_input_header on subrequest will result in assert

Open
#19 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
1.8k
Forks
236
Avg merge
1h 34m
Merged PRs (30d)
2

Description

In https://github.com/agentzh/headers-more-nginx-module/commit/1caf5cc413d0d0196eff2c550f2fcc6a710e180e

an assert was added to catch headers_in linked list corruption.

However, look at http://hg.nginx.org/nginx/file/4a71ef1aa36d/src/http/ngx_http_core_module.c#l2476

this means the assert will always trigger when operating on subrequests.

It seems to me use of more_XX_input_headers on a subrequest is fundamentally unsafe unless we copy all the input headers to a new array when the more_XXX_input_headers is invoked.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with commit 1caf5cc413d0d0196eff2c550f2fcc6a710e180e and inspect the assert added for headers_in linked-list corruption. Compare the subrequest handling in nginx's src/http/ngx_http_core_module.c near line 2476 with more_clear_input_header and more_set_input_header. Determine how subrequests can safely use these directives, then add coverage demonstrating that the assert no longer triggers.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, nginx
Domain
backend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.