Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t.sh

Commit

A cloud session's headless browser trusts the sandbox proxy with certificate checks on (#55): on flagon-io/session-lab #2 the session's Chromium refused every https page until it set ignore_https_errors, because Chromium reads its own NSS store (~/.pki/nssdb), not the system store that curl, git and the g1t CLI trust. The system prompt now gives BROWSER_TRUST to run once before a headless browser opens an https page: it installs certutil when missing, creates the NSS store, and adds every certificate of /etc/ssl/certs/ca-certificates.crt (the proxy's among them), again safely; and it says never to turn certificate checks off instead. The prompt is in the agent's config hash, so each workspace's agent is updated on its next session. The sessions guide says so. Checked: cargo test -p g1t-integrations (76); in debian:bookworm, headless Chromium refused a page served under a private CA the system store trusts, loaded it after the command, and the command ran a second time cleanly.

G1t-Session:
ses_01m4zbw69vethr4vmwsmcpwe3n
syntaqxcommitted Parentb0ef4fdBrowse files
2 files+19−30/2 viewed
+4−1
303303 g1t's MCP server is attached too, for anything the CLI has no command
304304 for. Its sandbox reaches the internet as a CI runner does, and it can
305305 search and read the web (web search and web fetch), for a fact the work
306− needs from outside g1t or to open its own deploy. Both reach g1t with one token: g1t
306+ needs from outside g1t or to open its own deploy. Before a headless
307+ browser (Playwright, Puppeteer) opens an https page, it copies the
308+ certificates the sandbox trusts into Chromium's own store, so pages load
309+ with certificate checks on. Both reach g1t with one token: g1t
307310 acting on your behalf, in that repository only, which lasts the session
308311 and is revoked when it ends. What the session does on g1t shows as
309312 **g1t, on behalf of @you**: its comments and reviews, what it closes or
+15−2
9595
9696 /// What g1t tells the agent, for every session.
9797 pub fn system_prompt() -> String {
98− "You work on issues in a g1t repository (g1t is a git forge), for the person who started you, with their own Claude. \
98+ format!(
99+ "You work on issues in a g1t repository (g1t is a git forge), for the person who started you, with their own Claude. \
99100 Each session's first message says which repository and issue, what kind of work, and how to reach them.\n\n\
100101 - Run the setup in your first message before anything else: it installs the g1t CLI, has git send your token to g1t, \
101102 clones the repository and ties the clone to this g1t session.\n\
118119 `g1t deploy list` until it is live or failed; if it failed, read why, fix it and push again. Say where it is live in your report.\n\
119120 - To show a screenshot in a pull request or a comment, upload it with `g1t attach FILE` and paste the Markdown it prints \
120121 (or pass `--attach FILE` to `g1t pr create`, `g1t pr ready` or `g1t pr comment`). Never commit an image to the repository just to link it.\n\
122+ - The sandbox reaches the web through a proxy whose certificate the system store trusts; curl, git and the g1t CLI read that store, \
123+ but Chromium (Playwright, Puppeteer) reads its own. Before a headless browser opens an https page, run once: `{BROWSER_TRUST}`. \
124+ Never turn certificate checks off (ignore_https_errors, --ignore-certificate-errors) instead.\n\
121125 - Never write `@g1t` in what you post on g1t: that asks g1t for another session.\n\
122126 - When you finish, say in a few sentences what you did, what is left, and the pull request, if any. That is your report on g1t: it shows on the issue as this session's card, so never post it, \
123127 or anything else, as a comment."
124− .to_owned()
128+ )
125129 }
126130
131+/// Copies the certificates the system store trusts (the sandbox proxy's
132+/// among them) into Chromium's NSS store, which it reads instead of the
133+/// system's. Safe to run again: each certificate keeps its nickname.
134+pub const BROWSER_TRUST: &str = "command -v certutil >/dev/null || { apt-get update -qq && apt-get install -y -qq libnss3-tools; } >/dev/null 2>&1; \
135+mkdir -p ~/.pki/nssdb && { [ -f ~/.pki/nssdb/cert9.db ] || certutil -d sql:$HOME/.pki/nssdb -N --empty-password; } \
136+&& d=$(mktemp -d) && awk -v d=\"$d\" '/BEGIN CERT/{n++; f=d \"/\" n \".pem\"} n{print > f} /END CERT/{close(f)}' /etc/ssl/certs/ca-certificates.crt \
137+&& for f in \"$d\"/*.pem; do certutil -d sql:$HOME/.pki/nssdb -A -t C,, -n \"system-$(basename \"$f\" .pem)\" -i \"$f\"; done && rm -rf \"$d\"";
138+
127139 /// The agent g1t keeps on an Anthropic account.
128140 pub fn agent_body(model: &str, mcp_url: &str, skills: &[Value]) -> Value {
129141 json!({
15721584 assert!(system_prompt().contains("never in a URL"));
15731585 assert!(system_prompt().contains("g1t pr checks --watch --fail-fast"));
15741586 assert!(system_prompt().contains("g1t attach FILE"), "screenshots are attached, never committed");
1587+ assert!(system_prompt().contains(BROWSER_TRUST), "the browser trusts the proxy instead of skipping certificate checks");
15751588 }
15761589
15771590 #[test]

Comments

Sign in to comment.