A desktop browser with x402 built in: when a page asks for payment, it pays in stablecoins and shows the content.

9 downloads

Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-browser.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-browser.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-browser.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 toolbar: Back and Forward are greyed out when there's nowhere to go cc08c7a 1 week, 2 days ago History
pre-push · 2.1 KB · 44 lines
1#!/usr/bin/env bash
2# Pre-push checks. Enable once per clone: git config core.hooksPath .githooks (bypass in an emergency: git push --no-verify)
3#
4# 1. no key-shaped secrets in the lines being pushed
5# 2. type check, then the unit tests (which include the "no key is ever committed" test)
6# 3. an optional extra check kept outside the repository, if this clone has one: .git/hooks/pre-push.local
7#
8# PREPUSH_ONLY=secrets runs only step 1 (used by the hook's own test).
9set -euo pipefail
10zero=0000000000000000000000000000000000000000
11root="$(git rev-parse --show-toplevel)"
12gitdir="$(git rev-parse --git-dir)"
13input="$(cat)" # lines: <local ref> <local sha> <remote ref> <remote sha>
14
15# High-confidence shapes only, so a failure means something. (Provider keys, cloud keys, tokens, private key blocks.)
16pattern='sk-ant-[A-Za-z0-9_-]{20,}|sk-(proj-)?[A-Za-z0-9_-]{32,}|AKIA[0-9A-Z]{16}|gh[pousr]_[A-Za-z0-9]{30,}|xox[baprs]-[A-Za-z0-9-]{10,}|-----BEGIN [A-Z ]*PRIVATE KEY'
17
18added_lines() { # added lines of every commit being pushed
19 while read -r _lref lsha _rref rsha; do
20 [ -z "${lsha:-}" ] && continue
21 [ "$lsha" = "$zero" ] && continue # deleting a ref
22 if [ "$rsha" = "$zero" ]; then range="$lsha --not --remotes"; else range="$rsha..$lsha"; fi
23 # shellcheck disable=SC2086
24 git -C "$root" log $range -p --no-color --format= | grep -E '^\+' | grep -vE '^\+\+\+' || true
25 done <<<"$input"
26}
27
28hits="$(added_lines | grep -E "$pattern" || true)"
29if [ -n "$hits" ]; then
30 echo "pre-push: refusing to push. These added lines look like secrets:" >&2
31 echo "$hits" | sed -E 's/(.{6}).{0,}/\1…(hidden)/' | head -5 >&2
32 exit 1
33fi
34echo "pre-push: no key-shaped secrets in the pushed lines"
35[ "${PREPUSH_ONLY:-}" = "secrets" ] && exit 0
36
37( cd "$root" && npm run --silent typecheck && npm test --silent ) || { echo "pre-push: type check or unit tests failed" >&2; exit 1; }
38echo "pre-push: type check and unit tests pass"
39
40local_extra="$gitdir/hooks/pre-push.local"
41if [ -x "$local_extra" ]; then
42 echo "pre-push: running this clone's extra check"
43 printf '%s\n' "$input" | "$local_extra"
44fi