litespeedtech / litespeedtech/openlitespeed

HttpVHost::addRailsApp system default env can override custom env

Open
#409 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1.5k
Forks
233
Avg merge
2d 19h
Merged PRs (30d)
5

Description

As written, the HttpVHost::addRailsApp function attaches the environment variables defined by pAppDefault->getEnv after the ones set by the options it's called with (and the ones it sets internally), which can cause failures in programs like RackRunner.rb to respect the custom environment. In particular, pAppDefault will have PATH set which will override any custom path set in a Virtual Host context, if I'm getting this right.

https://github.com/litespeedtech/openlitespeed/blob/d9610258f5c76ca204e1fd7074c23297b96a64de/src/http/httpvhost.cpp#L1712

could be replaced with something like
```
Env *pDefaultEnv = pAppDefault->getEnv();
if (pDefaultEnv)
{
for (const auto &var : *pDefaultEnv)
{
config.addEnvIfNotExist(var.c_str(), var.c_str());
}
}
```

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 in src/http/httpvhost.cpp around line 1712 and trace how HttpVHost::addRailsApp combines default, option-provided, and internal environment variables. Verify the precedence for PATH and other custom variables, then confirm that defaults fill only variables not already configured. Done means a Virtual Host’s custom environment is preserved while system defaults remain available.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.