In-box secret files written before their chmod: lc-creds, stacks tee, and the workspace token

Open Beginner friendly
#3,671 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go, python, shell
Domain
backend, security

Research direction

Read the three write sites in pkg/core/recipes/recipes.yaml (around lines 1008–1014 and the agent-workspace step) and pkg/core/stacks/stacks.yaml (around lines 326–331), then inspect workspace_caddyfile_mode_test.go for the test pattern. Add the restrictive creation mode at each write and keep the trailing chmod 600; add a test that runs the real step lines under umask 022 without that chmod. Done when the test confirms each file is mode 0600.

Written by the indexing model from the issue text.

Description

model:sonnet runtime:claude security size:S

Finding (from the #3633 scan, plus the #3656 follow-up)

Secret-bearing files are created at the default umask and tightened only afterwards, so they are briefly readable by other in-box users:

  • pkg/core/recipes/recipes.yaml (~1008-1014): lc-creds written by python open, chmod after.
  • pkg/core/stacks/stacks.yaml (~326-331): tee then chmod 600.
  • pkg/core/recipes/recipes.yaml agent-workspace step: printf ... > /opt/wsauth/token then chmod 600. The sibling Caddyfile was fixed in #3656; this one was left out of that scope.

The fix is the same as #3656: umask 077 before the write, chmod 600 after, or a create-with-mode write.

Acceptance criteria

  • Each of the three writes is preceded by umask 077 (or created with mode 0600), with chmod 600 after.
  • Test in the recipes package, in the style of workspace_caddyfile_mode_test.go: the real step lines run under umask 022 with the trailing chmod removed produce a 0600 file.
  • Fails on main before the change.

Follow-up to #3633 and #3656.

Dominant language
Go
Stars
296
Forks
38
Avg merge
7h 34m
Merged PRs (30d)
648

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from FootprintAI/Containarium

All issues in FootprintAI/Containarium

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.