fix: tighten file permissions for config writes#1021
Merged
Conversation
.shopware-project.local.yml contains secrets (Blackfire/Tideways API keys), so write it with 0o600. Regular config files (.shopware-project.yml, compose.yaml) use 0o644 instead of os.ModePerm (0o777). Refs #1020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.shopware-project.local.ymlcontains secrets (Blackfire/Tideways API keys) — write with0o600so it isn't world-readable..shopware-project.ymlandcompose.yamlnow use0o644instead ofos.ModePerm(0o777).os.ModePermis0o777(world-writable, executable bits set), which is the wrong default for config files. Linters like gosec flag it as G306.This addresses item #1 in the post-merge review of
next. Remainingos.ModePermcall sites across the codebase are tracked in #1020.Test plan
go build ./...go test ./internal/shop/... ./internal/docker/....shopware-project.local.ymlhas mode-rw-------aftershopware-cli project createwith a profiler enabled