mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-11-04 15:07:32 +00:00
* core: test that history posted before channel signing reaches later joiners as signature missing, and channel moderator delete for all Confirms the case the owner's new alert describes: a subscriber who joins after the owner turned on "Sign messages" sees the earlier posts as "signature missing" and later ones as signed, while earlier subscribers keep them unmarked. Also covers a non-owner channel moderator deleting a contributor's signed post for everyone. Run: 001-channel-signing-moderators, slice 1 * ios: keep "Chat with admins" off when saving group preferences toGroupPreferences left out the support preference, so the saved profile had none and core filled in its default, on: every channel preference save from iOS silently turned on chats with admins, which have no end-to-end encryption in channels. Android and desktop already pass it. Run: 001-channel-signing-moderators, slice 2 * ui: let channel owners turn on "Sign messages", warning that earlier messages will show signature missing The channel preference was hidden while signing was recipient-only. Owners now see the switch; turning it on asks for confirmation, because subscribers who join later receive the earlier posts unsigned through history and see them as "signature missing". The "Signature missing" explanation now says the message may predate signing or have been forwarded by a relay without its signature, instead of only implying tampering. Run: 001-channel-signing-moderators, slice 3 * ui: channel owners can make subscribers moderators, and moderators see the subscriber list Core already lets a channel owner make a subscriber a moderator; the role picker offered only subscriber and contributor. It now offers moderator too (not admin, by decision). Moderators see the full member list the owner sees, so they can reach the subscribers they may block (subscribers can't post, so there was no other way to reach them), and member info is headed Moderator or Contributor instead of Subscriber for those roles. Run: 001-channel-signing-moderators, slice 4 * ci: long-press and right-click for app tests, safer ui arguments, desktop Kotlin 4 GB, desktop session limits from claude-scope Message menus open only on long-press (iOS) or right-click (desktop), so Claude sessions couldn't reach Moderate, Info or Delete. Ported from f/directory-search unchanged, with its hardening: the guards refuse unquoted glob, brace and tilde expansion, and desktop ui checks numbers and sends one key per call so a key argument can't run an xdotool command. The desktop app job's Kotlin compiler gets 4 GB, as f/directory-search needed after merging master. Desktop sessions take max-turns and max-budget-usd from claude-scope like iOS (60 and 3 when unset, as before), and the Claude job may run 120 minutes. Run: 001-channel-signing-moderators, slice 5 * ci: Claude test plans for channel message signing and channel moderators This branch's iOS device test plan and desktop prompt replace master's smoke tests: the owner creates a channel on the preset relays, turns on Sign messages through its alert, and two more profiles in the same app join by the copied link; the owner makes one a moderator, who then sees the subscriber list, moderates a contributor's message and blocks the contributor. Signatures are checked as text in message Info. One layout, no test backend. Run: 001-channel-signing-moderators, slice 6 * fixup! ui: let channel owners turn on "Sign messages", warning that earlier messages will show signature missing * update plans * fixup! ui: let channel owners turn on "Sign messages", warning that earlier messages will show signature missing * fixup! ci: Claude test plans for channel message signing and channel moderators * fixup! ui: let channel owners turn on "Sign messages", warning that earlier messages will show signature missing * fixup! ci: Claude test plans for channel message signing and channel moderators * fixup! ui: let channel owners turn on "Sign messages", warning that earlier messages will show signature missing * fixup! ci: Claude test plans for channel message signing and channel moderators --------- Co-authored-by: spacedandy-agents-simplex <342056592+spacedandy-agents-simplex@users.noreply.github.com>
94 lines
3.3 KiB
Bash
Executable File
94 lines
3.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Runs Claude Code to repeat the smoke test with the ui helper, as the prompt (claude-test.md unless given) describes,
|
|
# and passes when its final message ends with "CLAUDE-TEST: PASS".
|
|
# Usage: scripts/ci/desktop-linux/claude-test.sh <output dir> <transcript .jsonl> [prompt .md]
|
|
# Expects the app started (smoke-test.sh ... start) with UI_OUT under <output dir>, claude and ui on PATH,
|
|
# CLAUDE_MODEL and CLAUDE_CODE_OAUTH_TOKEN. Claude works in <output dir>: the screenshots, its report.md and the
|
|
# prompt it was given end up there. The transcript, Claude Code's stderr (<transcript>.stderr) and the guard hook's
|
|
# log (<transcript>.guard.log) are kept outside it, where Claude can't write. If any of them holds the token, all are
|
|
# deleted and the run fails.
|
|
|
|
set -euo pipefail
|
|
|
|
token=${CLAUDE_CODE_OAUTH_TOKEN:?CLAUDE_CODE_OAUTH_TOKEN must be set}
|
|
# only the claude process gets the token, nothing else this script starts
|
|
unset CLAUDE_CODE_OAUTH_TOKEN
|
|
here=$(cd "$(dirname "$0")" && pwd)
|
|
out=$(cd "$1" && pwd)
|
|
transcript=$2
|
|
prompt=${3:-$here/claude-test.md}
|
|
stderr=$transcript.stderr
|
|
settings=$(mktemp)
|
|
export CLAUDE_GUARD_LOG=$transcript.guard.log
|
|
: > "$CLAUDE_GUARD_LOG"
|
|
|
|
scope() {
|
|
sed -n "s/^$1: *//p" "$here/claude-scope"
|
|
}
|
|
|
|
max_turns=$(scope max-turns)
|
|
max_budget=$(scope max-budget-usd)
|
|
|
|
{
|
|
cat "$prompt"
|
|
echo
|
|
echo '```'
|
|
ui || true
|
|
echo '```'
|
|
} > "$out/prompt.md"
|
|
|
|
cat > "$settings" << EOF
|
|
{"hooks": {"PreToolUse": [{"matcher": "Bash", "hooks": [{"type": "command", "command": "$here/claude-guard.py"}]}]}}
|
|
EOF
|
|
|
|
claude --version
|
|
cd "$out"
|
|
status=0
|
|
CLAUDE_CODE_OAUTH_TOKEN=$token claude -p \
|
|
--model "$CLAUDE_MODEL" \
|
|
--effort high \
|
|
--restricted \
|
|
--tools Bash,Read,Write,Edit \
|
|
--allowedTools "Bash(ui)" "Bash(ui *)" "Read(/$out/**)" "Edit(/$out/**)" \
|
|
--permission-mode dontAsk \
|
|
--permission-prompts none \
|
|
--strict-mcp-config \
|
|
--max-turns "${max_turns:-60}" \
|
|
--max-budget-usd "${max_budget:-3}" \
|
|
--autocompact 200k \
|
|
--no-session-persistence \
|
|
--settings "$settings" \
|
|
--output-format stream-json \
|
|
--verbose \
|
|
< prompt.md > "$transcript" 2> "$stderr" || status=$?
|
|
|
|
# A second safeguard to the file tools' limits: what the session wrote is printed and uploaded only when it is known
|
|
# not to hold the token. grep reads the token from a pipe, so it is in no process's arguments.
|
|
leak=0
|
|
printf '%s\n' "$token" | grep -rqF -f - -- "$out" "$transcript" "$stderr" "$CLAUDE_GUARD_LOG" || leak=$?
|
|
if [ "$leak" -ne 1 ]; then
|
|
rm -rf -- "$out" "$transcript" "$stderr" "$CLAUDE_GUARD_LOG"
|
|
echo "error: the token is in the Claude session's output, or checking for it failed (grep exited $leak); the output, transcript, stderr and guard log are deleted"
|
|
exit 1
|
|
fi
|
|
|
|
echo "::group::claude stderr"
|
|
cat "$stderr"
|
|
echo "::endgroup::"
|
|
echo "::group::report.md"
|
|
cat report.md 2> /dev/null || echo "no report.md"
|
|
echo "::endgroup::"
|
|
echo "::group::guard hook decisions"
|
|
cat "$CLAUDE_GUARD_LOG"
|
|
echo "::endgroup::"
|
|
result=$(jq -r 'select(.type == "result") | .result // empty' "$transcript" 2> /dev/null | tail -n 20 || true)
|
|
echo "final message, last lines:"
|
|
echo "$result"
|
|
if [ "$status" -ne 0 ]; then
|
|
echo "error: claude exited with $status"
|
|
exit 1
|
|
fi
|
|
last=$(grep -v '^[[:space:]]*$' <<< "$result" | tail -n 1 || true)
|
|
grep -qxE '[*`]*CLAUDE-TEST: PASS[*`.]*[[:space:]]*' <<< "$last"
|