-
-
Notifications
You must be signed in to change notification settings - Fork 26
Description
Summary
When analyzing configs that use set directive to define variables in one block and reference them in another, gixy produces INFO messages like:
[variable] INFO Can't find variable 'Root_Path' in script '$Root_Path/server-error-pages/_site' inside block 'location @error {'.
The variable is actually defined via set $Root_Path /path/... in the parent server block, but gixy's static analysis doesn't trace it across block scopes.
Example Config
server {
set $Root_Path /usr/share/nginx/html/www/vhosts_dir/example.com;
root $Root_Path;
location @error {
# gixy can't find $Root_Path here
root $Root_Path/server-error-pages/_site;
}
}Current Behavior
Gixy logs INFO messages about not finding the variable, even though:
- The variable IS defined in the config
- The config is valid and works at runtime
- nginx correctly resolves the variable
Expected Behavior
Gixy should trace set directive variables through the config tree and recognize that variables defined in a server block are available in nested location blocks.
Technical Notes
The variable tracking in gixy/core/context.py and gixy/core/manager.py currently:
- Pushes/pops context for blocks with
self_context=True - Adds variables from directives with
provide_variables=True
The set directive defines named variables that should persist through child blocks, but the current scoping logic may not properly inherit these across all block types.
Impact
This is an INFO-level message, not a security finding. The analysis still works, but users may be confused by messages about undefined variables that are actually valid.