1# profile refuses what it can't show as asked, saying why, and keeps what2# was there: a bio over 120 characters or with control characters, a link3# that isn't one https:// address (http, a password in it, no host), pins4# that aren't the caller's own public repos, or more than three.5. "$(dirname "$0")/../lib.sh"6user ana7user bob8for r in ana/a ana/b ana/c ana/d bob/x; do repo "$r"; done9repo --private ana/secret10ok ssh_as ana profile bio "short and fine"11f=$FORGE_ROOT/.forge/profiles/ana12fails_with 'a bio of 121 characters; it can have 120 at most' ssh_as ana profile bio "$(printf 'x%.0s' $(seq 121))"13ok ssh_as ana profile bio "$(printf 'é%.0s' $(seq 120))"14ok ssh_as ana profile bio "short and fine"15fails_with 'without control characters' ssh_as ana profile bio "$(printf 'one\001two')"16fails_with 'only https:// links' ssh_as ana profile link http://ana.example/17fails_with 'only https:// links' ssh_as ana profile link 'javascript:alert(1)'18fails_with 'without a user name or password' ssh_as ana profile link https://me:pw@ana.example/19fails_with "isn't a host name" ssh_as ana profile link https://localhost/20fails_with 'one link' ssh_as ana profile link https://a.example/ https://b.example/21fails_with "bob/x isn't yours" ssh_as ana profile pin bob/x22fails_with 'secret is private' ssh_as ana profile pin a secret23fails_with 'you have no repo nope' ssh_as ana profile pin nope24fails_with '4 repos; pin 3 at most' ssh_as ana profile pin a b c d25fails_with 'a is there twice' ssh_as ana profile pin a a26fails_with 'usage: profile' ssh_as ana profile colour red27has "$f" '^bio short and fine$'28lacks "$f" '^(link|pin) '