Commit Graph
326 Commits
Author SHA1 Message Date
branderson 07926638d4 Add ulogd user 2026-07-19 17:58:24 -07:00
branderson 04c1b1e1f4 Add DNS allowlisting, IPv6 block, and network logging to sandbox
DNS resolution was previously unrestricted - only the resulting IP
connections were firewalled - so a compromised session could still
exfiltrate data by encoding it into query names to an attacker-controlled
domain. dns-proxy.sh now runs a local dnsmasq with no fallback resolver;
only allowlisted names (shared with init-firewall.sh via fixed-domains.sh)
get forwarded, everything else is refused outright.

IPv6 is blocked outright via ip6tables DROP-all, since there was no IPv6
equivalent of the IPv4 allowlist.

If LOKI_URL is set, every DNS query and every new outbound connection
attempt (allowed or rejected, via NFLOG + ulogd2) ships to Loki as JSON,
for visibility in the existing Grafana/Prometheus setup.

Also fixes two bugs found along the way:
- init-firewall.sh's script-wide IFS (set for stricter splitting elsewhere)
  silently broke EXTRA_ALLOWED_DOMAINS whenever it held more than one
  space-separated entry, collapsing it into a single bogus token.
- bin/claude-sandbox-allow interpolated the domain argument directly into a
  bash -c string executed via docker exec - a command injection path,
  since sandbox-context.sh tells a sandboxed agent to hand this exact
  command to the user to copy-paste. Fixed with upfront domain validation
  and positional-argument passing instead of string interpolation.
2026-07-19 17:16:55 -07:00
branderson b4d22b97c0 Add quick allowlist for domains in sandbox 2026-07-19 16:26:58 -07:00
branderson 4551dc5a59 Limit push privileges 2026-07-19 16:10:47 -07:00
branderson ca76b46750 Lock down .claude in sandbox 2026-07-19 13:45:35 -07:00
branderson 373655963a Merge branch 'master' of gitbox.bradina.localdomain:branderson/dotfiles 2026-07-19 13:07:03 -07:00
branderson fae504043e Merge branch 'master' of gitbox.bradina.localdomain:branderson/dotfiles 2026-07-19 13:03:55 -07:00
branderson bdb8c8b149 Fix profile scope issue 2026-07-19 13:03:32 -07:00
branderson d76d2f4b3a Fix clipboard OSC 52 fallback: walk past nvim's tty-less embed process
Nvim isn't a single process attached to the terminal: the process that
actually spawns jobs (clipboard-copy included) is a separate `nvim --embed`
core process with no tty of its own (ps shows `?`); the real pty belongs to
a distinct parent UI process. Checking only the immediate parent's tty (as
the previous fix did) found the embed process's `?` and fell through to the
broken /dev/tty path every time in real interactive use, even though it
looked fine in headless testing. Walk up the process tree past any tty-less
ancestors instead.

Verified against the real docker-compose path in actual (non-headless) TUI
mode, with real keystrokes fed through a pty: the OSC 52 sequence now
reaches the terminal with no error, where it previously still failed.
2026-07-19 11:46:31 -07:00
branderson 08a2ae52f1 Fix clipboard OSC 52 write and mason registry access in the sandbox
- clipboard-copy: nvim's job-spawned clipboard provider process doesn't get
  its own controlling terminal, so /dev/tty (ENXIO) fails. Resolve the real
  tty from the parent (nvim)'s recorded tty via ps instead.
- entrypoint.sh: chown the allocated pty to node before dropping privileges.
  A normal login/ssh session always does this; this entrypoint skipped it,
  leaving the tty root-owned so node couldn't write to it directly even
  after resolving the right path.
- init-firewall.sh/README: allow release-assets.githubusercontent.com.
  GitHub release assets (e.g. mason-registry's own index) redirect here,
  a separate CDN from github.com's published IP ranges - without it mason
  can't even look up a package's install spec, regardless of PyPI access.

All three verified against a rebuilt image: OSC 52 write reaches the real
pty with no error, and mason's registry refresh succeeds through the
firewall.
2026-07-19 04:08:14 -07:00
branderson 718f6b7600 Fix firewall init crash on overlapping IPs across allowlisted domains
pypi.org and files.pythonhosted.org share Fastly edge IPs, so the second
domain's ipset add hit a duplicate-element error. Without -exist, that
error plus set -e killed the whole firewall init (and thus the container)
before nvim ever started. Reported by the user as a silent hang after a
successful build.
2026-07-19 03:31:50 -07:00
branderson 18e111b00c Fix sandbox dotfiles path, terminal type, and PyPI access
- Bind-mount dotfiles at node's own $HOME/dotfiles too, not just the
  host-path mount needed for the ~/.claude/hooks symlink: node's $HOME is
  /home/node, which broke clipboard-copy and anything else in this repo
  assuming ~/dotfiles.
- Forward the host's real TERM into the container instead of letting
  Docker's tty allocation default to a generic xterm, which was breaking
  the Ctrl-H/Backspace disambiguation the tmux config sets up.
- Add pypi.org/files.pythonhosted.org to the firewall's default allowlist
  so mason's pip-installed Python tools (ruff, basedpyright, debugpy) can
  actually install; verified with a real venv pip install.
2026-07-19 03:23:11 -07:00
branderson a2be0e5678 Sandbox hardening 2026-07-19 02:43:17 -07:00
branderson b5e18a1b29 Fix mount path 2026-07-19 01:50:38 -07:00
branderson e0ce0e79fc Fix allowlist of domains 2026-07-19 01:33:31 -07:00
branderson bcc0d4ab14 Fix permissions issue 2026-07-19 01:01:41 -07:00
branderson 37e77a4c30 Add claude code container sandbox 2026-07-19 00:30:05 -07:00
branderson 93b93b30b8 Fix Ctrl+J in claude code 2026-07-18 17:22:48 -07:00
branderson 49c638cda8 Re-enable extended keys 2026-07-18 17:15:46 -07:00
branderson efd1ddebd9 Fix corruption in copy-paste over nested tmux 2026-07-18 16:03:19 -07:00
branderson ea5a2b77d4 Fix some stale comments 2026-07-17 16:34:37 -07:00
branderson bd4d579a90 Fix remote tmux copy 2026-07-17 16:02:43 -07:00
branderson 0ba29f8d89 Fix clipboard copy across terminal emulator -> tmux -> SSH -> tmux -> nvim 2026-07-17 15:13:40 -07:00
branderson 25dcfc6802 Merge branch 'master' of gitbox.bradina.localdomain:branderson/dotfiles 2026-07-17 14:05:13 -07:00
branderson a56e04a0aa Make alacritty's highlight copy to system clipboard 2026-07-17 14:05:00 -07:00
asphodel 1ec5e0258d Add htop and jq to apt globals 2026-07-17 13:15:53 -07:00
branderson 1caa1be1d2 Support <Shift><Enter> through multiple nested tmux's and alacritty 2026-07-17 12:51:53 -07:00
branderson aa71eebf0b Fix nvim errors when editing html 2026-07-16 14:39:28 -07:00
branderson 9987dcacd8 Merge branch 'master' of gitbox.bradina.localdomain:branderson/dotfiles 2026-07-14 21:12:17 -07:00
branderson 58a3512c28 Disable claude-code systemd limits 2026-07-14 21:11:35 -07:00
branderson 7b61fde6e9 Merge branch 'master' of gitbox.bradina.localdomain:branderson/dotfiles 2026-07-14 19:45:30 -07:00
branderson db267226a8 Enable sixel for iTerm2 2026-07-14 18:39:48 -07:00
branderson 521c1b1c4d Merge branch 'master' of gitbox.bradina.localdomain:branderson/dotfiles 2026-07-14 18:08:06 -07:00
branderson a94e283e98 Add sandboxing tools to global install 2026-07-14 18:07:59 -07:00
branderson b26e564672 Use cargo build instead of prebuilt binary for tree-sitter-cli manual install 2026-07-14 14:23:06 -07:00
branderson 1deb25008f Make nvim installation helpers platform-aware and add local install helper for tree-sitter-cli 2026-07-14 14:11:42 -07:00
branderson 9ffe754410 Add claude gruvbox theme, fix nvim errors with custom npm 2026-07-14 13:48:36 -07:00
branderson d0a4cb0db7 Add authorship disclaimer to LLM generated PR summaries 2026-07-13 18:28:08 -07:00
branderson 46ca53e0c0 Prevent runaway claude-code 2026-07-13 18:24:22 -07:00
branderson ddd7f6bf2c Merge pull request 'gitea-pr: token-file auth + skip duplicate PR creation' (#2) from worktree-gitea-pr-review-workflow into master
Reviewed-on: #2
2026-07-12 22:15:01 -07:00
branderson 06e60bda8c Match existing-PR check on base branch too, not just head
The lookup was matching on head.ref alone, so running create with a
different --base for the same branch would silently return an
unrelated PR's URL instead of opening a new one. Resolve base before
the check and filter on both head.ref and base.ref.
2026-07-12 22:14:07 -07:00
branderson 567d0a1718 Skip creating a duplicate PR when one is already open for the branch
gitea-pr create now checks for an existing open PR on the current
branch first and returns its URL instead of creating a new one. Only
matches open PRs by design -- once merged, new commits on the same
branch correctly get a new PR.
2026-07-12 22:14:07 -07:00
branderson eec71b5f82 Add gitea-pr script and PR review workflow (#1)
Adds bin/gitea-pr script for gitea PR workflow.
Reviewed-on: #1
Co-authored-by: Brad Anderson <brad@branderson.io>
Co-committed-by: Brad Anderson <brad@branderson.io>
2026-07-12 18:49:36 -07:00
branderson 4e8c3c6269 Add keybind to fix missing cursor after SSH timeout in tmux 2026-07-11 13:11:14 -07:00
branderson 8badfdb9b8 Fix copy-paste in tmux 2026-07-10 19:10:41 -07:00
branderson 1eb4ee50d8 Merge branch 'master' of gitbox.bradina.localdomain:branderson/dotfiles 2026-07-10 18:36:42 -07:00
branderson 5bf98d5b1d Make ,, work in terminal mode nvim 2026-07-10 18:36:30 -07:00
branderson 90d67c5a4a Fix file modification issue in non-modifiable nvim buffers 2026-07-10 17:16:28 -07:00
branderson ad9a5072d3 Handle shellcheck cleanly in vim 2026-07-10 16:26:09 -07:00
branderson c6c51c81ef Improve <leader>? keybind search 2026-07-10 16:21:34 -07:00