Skip to content

Add multi-arch release workflow, nillsec CLI, and encrypted vault#2

Merged
403-html merged 7 commits intomainfrom
copilot/create-command-line-tool-for-secrets
Mar 16, 2026
Merged

Add multi-arch release workflow, nillsec CLI, and encrypted vault#2
403-html merged 7 commits intomainfrom
copilot/create-command-line-tool-for-secrets

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 16, 2026

Introduces the nillsec encrypted secret vault CLI, its supporting vault package, a multi-arch GitHub Actions release workflow, and security hardening based on code review feedback.

vault package (vault/vault.go)

  • Implements Argon2id + AES-256-GCM encrypted secret storage and persistence
  • Public API (Init, Load, Save) accepts []byte for passwords, enabling proper in-memory wiping via wipeBytes with no leftover string copies
  • parseVaultFile validates salt length (16 bytes) and nonce length (12 bytes) after base64 decode, returning a clean error instead of panicking in cipher.NewGCM
  • parseVaultFile handles CRLF line endings (Windows / editor round-trips) by stripping \r from each line before header comparison and field parsing
  • Keys() uses sort.Strings from the standard library instead of a custom O(n²) helper

CLI (main.go)

  • Commands: init, add, set, get, list, remove, edit, env, version
  • NILLSEC_VAULT env var overrides the default secrets.vault path; NILLSEC_PASSWORD allows non-interactive use
  • promptPassword and promptPasswordConfirm return []byte directly — term.ReadPassword already returns []byte, so the TTY path has zero unnecessary copies; secrets are zeroed via defer wipeBytes(pw) at every call site
  • wipeString removed; password handling uses []byte throughout
  • Keys are validated as POSIX identifiers (^[A-Za-z_][A-Za-z0-9_]*$) at add/set time, preventing shell-unsafe names from being stored and making eval "$(nillsec env)" safe by construction
  • cmdEdit checks the os.Remove error on the plaintext temp file; on failure it truncates the file to eliminate plaintext before returning an error, ensuring the vault write is skipped while plaintext remains on disk

Release workflow (.github/workflows/release.yml)

  • Triggers on v* tags; gates all builds behind go test ./...
  • Matrix cross-compiles 7 targets: linux/{amd64,arm64,armv7}, darwin/{amd64,arm64}, windows/{amd64,arm64}
  • Version stamped at link time via -X main.version=<tag>
  • Publishes a GitHub Release with all binaries + checksums.txt (SHA-256)

Tests (vault/vault_test.go)

  • Full coverage of Init/Load/Save round-trips, Set/Get/Delete, key ordering, MarshalText/UnmarshalText
  • All errors from vault.Load and os.ReadFile are explicitly checked with t.Fatalf for clear failure attribution
  • File-permission assertion guarded by runtime.GOOS != "windows" for cross-platform portability
  • New tests: CRLF vault file loading, truncated-salt rejection, truncated-nonce rejection

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: 403-html <57900160+403-html@users.noreply.github.com>
Copilot AI changed the title [WIP] Add command-line tool for managing encrypted project secrets feat: implement nillsec encrypted secrets vault CLI Mar 16, 2026
Copilot AI requested a review from 403-html March 16, 2026 10:27
Co-authored-by: 403-html <57900160+403-html@users.noreply.github.com>
Copilot AI changed the title feat: implement nillsec encrypted secrets vault CLI Add multi-arch release workflow with SHA-256 verification Mar 16, 2026
@403-html 403-html requested a review from Copilot March 16, 2026 15:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces the nillsec Go CLI and its encrypted vault implementation, and adds a GitHub Actions workflow to build and publish multi-arch release binaries with SHA-256 checksums.

Changes:

  • Add vault package implementing Argon2id + AES-256-GCM encrypted secret storage and persistence.
  • Add nillsec CLI commands (init/add/set/get/list/remove/edit/env/version) and update docs/gitignore accordingly.
  • Add multi-arch release workflow that cross-compiles on tag pushes and publishes a GitHub Release with checksums.

Reviewed changes

Copilot reviewed 6 out of 9 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
.github/workflows/release.yml Builds/test/releases tagged versions across multiple GOOS/GOARCH targets and publishes release assets + checksums.
main.go Implements CLI commands, password prompting, edit flow, and env export.
vault/vault.go Adds encrypted vault format, KDF/encryption, and vault CRUD helpers.
vault/vault_test.go Adds tests for init/load/save, CRUD, marshaling, and ciphertext variability.
README.md Documents features, vault format, usage, and environment variables.
.gitignore Ignores build outputs and Go test cache.
go.mod / go.sum Adds module metadata and dependencies (x/crypto, x/term).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread vault/vault.go
Comment thread main.go
Comment thread main.go
Comment thread main.go Outdated
Comment thread .github/workflows/release.yml
Comment thread vault/vault_test.go Outdated
Comment thread vault/vault.go
Comment thread vault/vault.go Outdated
Comment thread main.go Outdated
Comment thread vault/vault_test.go Outdated
Copilot AI changed the title Add multi-arch release workflow with SHA-256 verification Add release workflow, icon embedding, and local build script Mar 16, 2026
@403-html 403-html force-pushed the copilot/create-command-line-tool-for-secrets branch from 4afae57 to 4acf64a Compare March 16, 2026 15:49
403-html and others added 2 commits March 16, 2026 16:53
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: 403-html <57900160+403-html@users.noreply.github.com>
Copilot AI changed the title Add release workflow, icon embedding, and local build script Add multi-arch release workflow, nillsec CLI, and encrypted vault Mar 16, 2026
…ngs, os.Remove error

Co-authored-by: 403-html <57900160+403-html@users.noreply.github.com>
@403-html 403-html marked this pull request as ready for review March 16, 2026 16:15
@403-html 403-html merged commit 23a7e94 into main Mar 16, 2026
@403-html 403-html deleted the copilot/create-command-line-tool-for-secrets branch March 17, 2026 11:24
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.

3 participants