Skip to content

fix(service): preserve explicit env_file and stop implicit .env injection#8494

Closed
1312e wants to merge 6 commits intocoollabsio:nextfrom
1312e:algora-issue-7655
Closed

fix(service): preserve explicit env_file and stop implicit .env injection#8494
1312e wants to merge 6 commits intocoollabsio:nextfrom
1312e:algora-issue-7655

Conversation

@1312e
Copy link
Copy Markdown

@1312e 1312e commented Feb 20, 2026

Summary

  • stop auto-injecting .env into env_file for parsed compose services/applications
  • preserve only explicitly defined env_file entries from user compose
  • refactor env_file normalization into a shared helper for both parser flows
  • add regression coverage for env_file normalization + structure guards

Why

Docker Compose semantics treat .env as interpolation input, not implicit runtime env injection for every service. Auto-injecting .env can leak variables into containers that never opted in.

Scope

This PR is intentionally minimal and only contains #7655-related parser/test changes.

Tests

  • php -l bootstrap/helpers/parsers.php
  • php -l tests/Unit/ComposeEnvFileSemanticsTest.php
  • tests/Unit/ComposeEnvFileSemanticsTest.php covers:
    • normalization + trim + dedupe behavior
    • missing env_file behavior
    • invalid non-string filtering
    • helper usage in both parser flows + no implicit ->push('.env')

Docs

N/A - internal parser behavior change; no user-facing service template/docs page changes.

Bounty

/claim #7655

@algora-pbc algora-pbc bot added the 🙋 Bounty claim Issues or PRs that have a Bounty ready to be claimed. label Feb 20, 2026
@1312e
Copy link
Copy Markdown
Author

1312e commented Feb 20, 2026

Validation run (local):

php -l bootstrap/helpers/parsers.php
# No syntax errors detected in bootstrap/helpers/parsers.php

php -l tests/Unit/ComposeEnvFileSemanticsTest.php
# No syntax errors detected in tests/Unit/ComposeEnvFileSemanticsTest.php

Regression guard added in tests/Unit/ComposeEnvFileSemanticsTest.php to ensure implicit ->push('.env') is not reintroduced in either parser path.

@1312e
Copy link
Copy Markdown
Author

1312e commented Feb 20, 2026

@ShadowArcanist could you please take a look when you have time? This PR is scoped only to remove implicit .env runtime injection and keep explicit env_file behavior for compose semantics.

@Cinzya
Copy link
Copy Markdown
Member

Cinzya commented Feb 20, 2026

@1312e bountys require a video demo, please provide. Also you aren't following our Contribution Guidelines.

@Cinzya Cinzya added the 💤 Waiting for changes PRs awaiting changes from the author. label Feb 20, 2026
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

🙋 Bounty claim Issues or PRs that have a Bounty ready to be claimed. 💤 Waiting for changes PRs awaiting changes from the author.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants