Skip to content

Fix recursive script no-cacheable flushing#36

Open
xintenseapple wants to merge 1 commit into
freenginx:defaultfrom
xintenseapple:fix/issue-27-script-nocacheable-freeze
Open

Fix recursive script no-cacheable flushing#36
xintenseapple wants to merge 1 commit into
freenginx:defaultfrom
xintenseapple:fix/issue-27-script-nocacheable-freeze

Conversation

@xintenseapple

Copy link
Copy Markdown

Summary:

  • Track request-local script evaluation depth so nested script evaluation cannot recursively invalidate no-cacheable variables consumed by an outer script pass.

Verification:

  • git diff --check; ./auto/configure --without-http_rewrite_module; make -f objs/Makefile -j2

Fixes #27

@mdounin

mdounin commented Jun 8, 2026

Copy link
Copy Markdown
Member

Suggested change looks wrong to me. In particular:

  • It fails to address the test case provided in the issue comments (here, with volatile map and set).
  • It breaks recursive flushing when it is needed. E.g., when a volatile map is derived from non-cacheable variables, such as in the following configuration:
    map $args $map_flush {
        volatile;
        default wrong;
        secret  good;
    }
    ...
    server {
        location /map_flush {
            set $args "wrong";
            set $temp "$map_flush";
            set $args "secret";
            set $temp "$temp:$map_flush";
            return 200 "X${temp}X";
        }

Overall, it looks like there is no easy solution for this problem. As a first step to address this and other issues in script evaluation, I've implemented a patch series which introduces script buffer overrun protection, so such issues, if any, won't cause buffer overflows, but will result in request processing errors. See issue comments for more details.

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.

Script no-cacheable variable re-evaluation can overflow generated buffers

2 participants