Skip to content

security: resolve Oneleet gosec findings - #694

Merged
BSick7 merged 4 commits into
masterfrom
security/oneleet-gosec
Oct 7, 2026
Merged

BSick7 merged 4 commits into
masterfrom
security/oneleet-gosec

Conversation

@BSick7

@BSick7 BSick7 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Part of the Oneleet code-security sweep (plan: design-documents/oneleet-code-security-remediation.md in the monorepo root). Clears all 29 open findings in this repo.

Behaviour changes

  • Secrets are no longer world-readable. The profile directory is created 0700; the profile config, API key, org file and the Terraform credentials.tfrc are written 0600. Files created by older CLI versions are tightened in place on next load via config.TightenPerms (best-effort, silent). CHANGELOG 0.0.208 entry added.
  • Module hash cap. HashArchiveContents stops after 512 MiB of uncompressed content (CWE-409). The pinned digest test is unchanged; oracle carries the identical change so the two stay byte-for-byte in sync.
  • Manifest/backend dirs created 0750, generated files 0600. .gitignore append deliberately stays 0644.

Annotations (no behaviour change)

  • G204 x4: session-manager-plugin, az, terraform resolved from PATH with CLI-built args; mcp/executor.go re-executes os.Args[0].
  • G304 x12: every path is one the user handed the CLI (module dir, tarball, IaC file, .gitignore) or a well-known config file.
  • io/ioutil swapped for os in the touched files.

Deps

Verification

  • go build ./..., go vet and tests on the touched packages pass with GOTOOLCHAIN=go1.26.6.
  • TestGenerate_App was failing on master: it expected the scaffold to pin ns to ~> 0.13.0, but generated modules deliberately leave the provider unpinned. The test now asserts the provider source is present and no version = is emitted; go test ./modules/ is green. No generator change.

BSick7 added 2 commits October 7, 2026 09:51
- Profile dir, config, API key, org file and the Terraform credentials
  file are now created 0700/0600; existing files from older versions are
  tightened on next load (config.TightenPerms)
- HashArchiveContents caps the uncompressed bytes it will read at 512 MiB
  (identical change in oracle/manifest/checksum.go; pinned digest unchanged)
- Manifest and backend dirs created 0750; generated files 0600
- G204/G304 sites annotated with why the binary or path is trusted;
  .gitignore append stays 0644 by design
- io/ioutil replaced with os in the touched files
Picks up deployment-sdk#172 (cd49c268).
@BSick7
BSick7 requested a review from ssickles October 7, 2026 15:18
ssickles
ssickles previously approved these changes Oct 7, 2026
Generated app modules use the ns_env_layout, ns_env_values and
ns_env_platform_data data sources, which shipped in provider 0.13.0.
TestGenerate_App already asserted the pin; the scaffold never emitted it.
Generated modules deliberately leave the ns provider unpinned. The test
now asserts the provider source is present and no version constraint is
emitted, which is what the generator has produced since #693.
@BSick7
BSick7 merged commit 97190cc into master Oct 7, 2026
@BSick7
BSick7 deleted the security/oneleet-gosec branch October 7, 2026 17:23
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.

2 participants