Skip to content

Harden Secrets and Configuration Boundaries in faucet - #295

Open
localtrade1 wants to merge 2 commits into
0xMiden:nextfrom
localtrade1:localtrade1-patch-1
Open

Harden Secrets and Configuration Boundaries in faucet#295
localtrade1 wants to merge 2 commits into
0xMiden:nextfrom
localtrade1:localtrade1-patch-1

Conversation

@localtrade1

Copy link
Copy Markdown

Description

This pull request addresses a High severity configuration management finding from the workspace security audit targeting the faucet repository. Previously, a .env file was tracked in git, and Docker's root-anchored .dockerignore did not exclude it. This created a severe risk where a developer populating the environment variables would accidentally commit live secrets—such as the Proof-of-Work HMAC key—directly to the repository or bake them into published container images.

Key Changes & Remediations

1. Secrets Management & Repository Configuration (High)

  • Template Renaming: Renamed the tracked bin/faucet/.env file to bin/faucet/.env.example to serve purely as a template[cite: 28].
  • Strict Git Ignores: Updated .gitignore to explicitly ignore .env and .env.* files, while negating the template (!.env.example) so it remains tracked[cite: 27]. This structurally prevents MIDEN_FAUCET_POW_SECRET and operator account paths from being committed after a developer fills them in[cite: 27, 28].

2. Documentation Updates

  • Onboarding Instructions: Updated README.md to explicitly instruct contributors to copy .env.example to .env[cite: 26]. It also includes a clear security warning explaining that .env is ignored by git, but .env.example is not, ensuring real secrets stay out of the template[cite: 26].

(Note: The audit report also identified that the faucet container currently runs as root (CWE-250)[cite: 25]. Transitioning to a non-root USER is strongly recommended, but it has been left out of this PR as it requires coordinated ownership changes to the /faucet volume mount that must be tested against existing deployments.)

How to Review

  1. Gitignore Rules: Verify .gitignore correctly ignores .env files while preserving the template[cite: 27].
  2. Template Validation: Confirm that bin/faucet/.env.example contains only blank secret fields (e.g., MIDEN_FAUCET_POW_SECRET=)[cite: 28].
  3. Documentation: Review the updated Docker instructions in README.md to ensure the .env copying steps are clear[cite: 26].

### Description
This pull request addresses a High severity configuration management finding from the workspace security audit targeting the `faucet` repository. Previously, a `.env` file was tracked in git, and Docker's root-anchored `.dockerignore` did not exclude it. This created a severe risk where a developer populating the environment variables would accidentally commit live secrets—such as the Proof-of-Work HMAC key—directly to the repository or bake them into published container images.

### Key Changes & Remediations

#### 1. Secrets Management & Repository Configuration (High)
* **Template Renaming:** Renamed the tracked `bin/faucet/.env` file to `bin/faucet/.env.example` to serve purely as a template[cite: 28]. 
* **Strict Git Ignores:** Updated `.gitignore` to explicitly ignore `.env` and `.env.*` files, while negating the template (`!.env.example`) so it remains tracked[cite: 27]. This structurally prevents `MIDEN_FAUCET_POW_SECRET` and operator account paths from being committed after a developer fills them in[cite: 27, 28].

#### 2. Documentation Updates
* **Onboarding Instructions:** Updated `README.md` to explicitly instruct contributors to copy `.env.example` to `.env`[cite: 26]. It also includes a clear security warning explaining that `.env` is ignored by git, but `.env.example` is not, ensuring real secrets stay out of the template[cite: 26].

*(Note: The audit report also identified that the `faucet` container currently runs as root (CWE-250)[cite: 25]. Transitioning to a non-root `USER` is strongly recommended, but it has been left out of this PR as it requires coordinated ownership changes to the `/faucet` volume mount that must be tested against existing deployments.)*

### How to Review
1. **Gitignore Rules**: Verify `.gitignore` correctly ignores `.env` files while preserving the template[cite: 27].
2. **Template Validation**: Confirm that `bin/faucet/.env.example` contains only blank secret fields (e.g., `MIDEN_FAUCET_POW_SECRET=`)[cite: 28].
3. **Documentation**: Review the updated Docker instructions in `README.md` to ensure the `.env` copying steps are clear[cite: 26].
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.

1 participant