Skip to content

config: support Ubuntu — distro-agnostic scripts#10

Closed
benvinegar wants to merge 1 commit into
mainfrom
support-ubuntu
Closed

config: support Ubuntu — distro-agnostic scripts#10
benvinegar wants to merge 1 commit into
mainfrom
support-ubuntu

Conversation

@benvinegar
Copy link
Copy Markdown
Member

@benvinegar benvinegar commented Feb 17, 2026

Support Ubuntu and add integration CI on ephemeral DigitalOcean droplets.

Changes

Ubuntu compatibility fixes

  • bin/hornet-safe-bash: replace grep -P (Perl regex) with grep -E (POSIX extended)
  • setup.sh: fix CWD inheritance (cd /tmp), use deployed harden-permissions, run git config as admin user
  • bin/harden-permissions.sh: guard sessions dir find for fresh installs
  • AGENTS.md: add distro-agnostic coding guideline

Integration CI

  • bin/ci/droplet.sh: reusable DO droplet lifecycle (create/destroy/wait-ssh/run)
  • bin/ci/setup-ubuntu.sh: Ubuntu prereqs → setup.sh → test suite
  • .github/workflows/integration.yml: matrix workflow (Ubuntu now, extensible to Arch etc)
  • Ephemeral everything: fresh droplet + SSH key per run, destroyed on cleanup
  • Single secret: DO_API_TOKEN (already set)

Tested

  • 3 full local cycles on fresh Ubuntu 24.04 droplets — all 5 test suites pass
  • Integration workflow will trigger on the next PR after merge (GH Actions limitation: new workflow files must exist on base branch first)

All 207 tests pass.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Feb 17, 2026

Greptile Summary

This PR contains two separate improvements: Ubuntu compatibility for shell scripts and environment validation via varlock.

Ubuntu Compatibility:

  • Replaced all grep -P (Perl regex) with grep -E (extended regex) in bin/hornet-safe-bash for POSIX compliance
  • Converted \s+ to [[:space:]]+ character classes throughout security checks
  • Rewrote SSH key injection check from negative lookahead to two-step validation (match broadly, then exclude hornet_agent)
  • Added distro-agnostic coding guideline to AGENTS.md
  • Updated setup.sh comment from "Arch Linux" to "Linux (tested on Arch and Ubuntu)"

Environment Validation (varlock):

  • Introduced .env.schema defining types, validation rules, and sensitivity for all env vars
  • Updated start.sh to validate env with varlock load before agent startup (fail-fast on errors)
  • Migrated all tmux launch commands from set -a && source ~/.config/.env to varlock run --path ~/.config/
  • Removed dotenv dependency from slack-bridge/package.json
  • Updated bin/deploy.sh to deploy .env.schema to agent's ~/.config/
  • Added varlock installation to setup.sh

Testing:
All 207 tests pass (per PR description). The safe-bash wrapper tests (24 tests) passed successfully during this review.

Confidence Score: 5/5

  • Safe to merge - well-tested compatibility improvements with comprehensive documentation updates
  • Both changes are defensive improvements. The Ubuntu compatibility changes maintain identical security behavior (all tests pass) while increasing portability. The varlock migration adds validation without changing functionality. All documentation was updated per project conventions. No security regressions or breaking changes detected.
  • No files require special attention

Important Files Changed

Filename Overview
bin/hornet-safe-bash Replaced grep -P with grep -E and [[:space:]] character class for POSIX compatibility
AGENTS.md Added distro-agnostic guideline and documentation update convention
setup.sh Updated comment to reflect Arch + Ubuntu support, added varlock installation
.env.schema New file defining environment variable schema for varlock validation
pi/skills/control-agent/startup-cleanup.sh Updated bridge launch to use varlock run and corrected path from ~/hornet/ to ~/runtime/
start.sh Added varlock validation with fail-fast error handling before agent startup
slack-bridge/bridge.mjs Removed dotenv/config import, env now loaded by varlock externally

Last reviewed commit: d973c1f

Comment thread bin/hornet-safe-bash
@benvinegar benvinegar force-pushed the support-ubuntu branch 5 times, most recently from 531bcfe to 55ab39b Compare February 17, 2026 02:44
Comment thread bin/harden-permissions.sh
Comment on lines +54 to +58
if [ -d "$HOME/.pi/agent/sessions" ]; then
find "$HOME/.pi/agent/sessions" -name '*.jsonl' -not -perm 600 -exec chmod 600 {} + 2>/dev/null || true
count=$(find "$HOME/.pi/agent/sessions" -name '*.jsonl' 2>/dev/null | wc -l)
[ "$count" -gt 0 ] && echo " ✓ $count session log(s) → 600"
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The use of || true in harden-permissions.sh silences errors from the chmod command, potentially leaving sensitive session logs with incorrect permissions without any failure indication.
Severity: HIGH

Suggested Fix

Remove the || true to allow the script to fail correctly if the chmod command returns a non-zero exit code. The script should exit with an error if it cannot successfully harden the permissions on the session log files, ensuring that failures are not silent.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: bin/harden-permissions.sh#L54-L58

Potential issue: The `harden-permissions.sh` script uses `|| true` after a `find ...
-exec chmod 600 {} +` command. This masks any failure from the `chmod` operation. If
`chmod` fails to set the correct permissions on sensitive session logs (e.g., due to
ownership or permission errors), the script will not report an error and will continue
execution. This can lead to a silent security failure where session logs containing full
conversation histories remain group-readable, despite the script appearing to have
succeeded. The subsequent log message "✓ $count session log(s) → 600" can give a false
sense of security.

@benvinegar benvinegar closed this Feb 17, 2026
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