Skip to content

[2.4.x] Backport mod_env SetEnvFromFile - #934

Open
cisbiceanu wants to merge 4 commits into
apache:2.4.xfrom
cisbiceanu:backport-setenvfromfile
Open

cisbiceanu wants to merge 4 commits into
apache:2.4.xfrom
cisbiceanu:backport-setenvfromfile

Conversation

@cisbiceanu

@cisbiceanu cisbiceanu commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

This PR proposes backporting the SetEnvFromFile directive from trunk to the stable 2.4.x branch.

The implementation was accepted in 837965fd1e (r1938506), following discussion in #750.

Motivation

SetEnvFromFile allows administrators to populate httpd’s internal environment from a file of name=value entries, read at configuration time. This keeps variable values separate from the main configuration while preserving the behavior of SetEnv for CGI, SSI, and other consumers.

Changes

  • Backport the accepted mod_env implementation without functional changes.
  • Include the directive documentation and changelog entry.
  • Enable the existing regression tests for versions starting with the proposed target, 2.4.72, while retaining their skip behavior on older releases.

As in trunk, the directive is not permitted in .htaccess, to prevent untrusted configuration authors from exposing files readable by the server.

Validation

Built and tested locally on macOS against Apache 2.4.70-dev. All four directive regression tests passed: file parsing, malformed-line handling, .htaccess rejection, and missing-file configuration failure. Documentation DTD validation also passed.

The release number is provisional and can be adjusted to the version selected for the backport. The corresponding backported_in test marker should also be mirrored to trunk when the backport is accepted.

Backport trunk commit 837965f (r1938506). Include the stable-branch documentation, changelog, and test availability marker for 2.4.70.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@notroj notroj left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for filing the backport PR.

Apache 2.4.70 has already been released, and the 2.4.71-rc1 candidate does not contain SetEnvFromFile. Update the directive's documented availability and regression-test release threshold to the proposed 2.4.72 release.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@cisbiceanu

Copy link
Copy Markdown
Contributor Author

Thanks @notroj for reviewing and approving this backport!
I’ve updated the documented availability and test release threshold to 2.4.72, since the 2.4.71-rc1 candidate has already been cut without this change. The implementation is unchanged, and the updated release-gating checks and documentation validation passed.
Is there anything else needed from me before this can be merged into 2.4.x? I’m happy to address any concerns and help test a release candidate containing the change on macOS Sequoia 15.7.9, which is the platform I have available.

@notroj

notroj commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Thanks @notroj for reviewing and approving this backport! I’ve updated the documented availability and test release threshold to 2.4.72, since the 2.4.71-rc1 candidate has already been cut without this change. The implementation is unchanged, and the updated release-gating checks and documentation validation passed. Is there anything else needed from me before this can be merged into 2.4.x? I’m happy to address any concerns and help test a release candidate containing the change on macOS Sequoia 15.7.9, which is the platform I have available.

Thanks for doing that adjustment, LGTM. With passing CI, you'll need two committers to review and then we can merge for the next release.

@cisbiceanu

Copy link
Copy Markdown
Contributor Author

Thanks @notroj for clarifying the next steps. All CI checks are now passing in my fork, including Linux, Windows, and Sanity: cisbiceanu#3
These checks ran against 492f342, the same commit as this PR. The Windows job passed on rerun without any code changes.
The upstream workflow runs are still awaiting maintainer approval. Could you approve them for the latest commit so the checks can run here too?
I’ll follow up on the dev mailing list tomorrow to request the two additional committer reviews.

@cisbiceanu

Copy link
Copy Markdown
Contributor Author

Hi @covener and @rpluem — thanks again for your feedback during the original SetEnvFromFile discussion on dev@, particularly around the .htaccess security concerns.
Would you be available to review this backport to 2.4.x, targeting 2.4.72? It preserves the accepted trunk implementation, including the prohibition on use in .htaccess.
Joe Orton has already approved it and confirmed that two additional committer reviews are needed before merging.
All 34 CI checks pass against the same commit in my fork: cisbiceanu#3. Windows passed on rerun without code changes.
I’m happy to address any feedback. Thanks for your time!

Comment thread modules/metadata/mod_env.c Resolved
Comment thread modules/metadata/mod_env.c Resolved
@cisbiceanu
cisbiceanu requested a review from rpluem November 11, 2026 14:06
qabasel and others added 2 commits November 16, 2026 13:31
Keep the existing backport review history while updating to the current stable development branch.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Backport trunk commit 784e454 (apache#1004), addressing the review requests on apache#934.

Reject non-EOF read failures with file and line diagnostics. Support SetEnv-style single- and double-quoted values, preserve quoted whitespace, and reject malformed quoting. Carry all accepted regression cases and XML guidance while retaining the 2.4.72 availability marker and stable-branch documentation formatting.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@cisbiceanu

Copy link
Copy Markdown
Contributor Author

Hi @rpluem,

It looks like all the checks are passing now: https://github.com/cisbiceanu/httpd/pull/3/checks

Whenever you have some time, I’d really appreciate it if you could have a look and approve the PR. In parallel, I’m trying to secure the remaining approval out of the three required. Hopefully, I can get everything lined up before the end of the year. Thanks a lot!

@cisbiceanu

Copy link
Copy Markdown
Contributor Author

Hi @rpluem, thanks for approving the backport.

The Windows CI job failed in test_h2_600_32[0], receiving HTTP 200 instead of the expected 502/503. I’ve seen this test fail intermittently in my own runs too.

The upstream 2.4.x baseline shows the identical failure, while the same backport commit passed Windows CI in my fork. This appears unrelated to the SetEnvFromFile changes.

Could you rerun the failed Windows job when you have a chance?

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.

3 participants