Repository navigation
GUACAMOLE-2343: Add guacclip tool for extracting clipboard contents from session recordings - #724
Open
ciroiriarte wants to merge 2 commits into
Open
ciroiriarte wants to merge 2 commits into
ciroiriarte wants to merge 2 commits into
Conversation
…ion recordings. New `guacclip` CLI (peer to guaclog/guacenc) that recovers clipboard artifacts - text and images - from a `.guac` session recording, filling the gap those tools leave (guacenc renders video, guaclog interprets keystrokes, neither touches clipboard). No recording-format change; purely additive tooling on top of the existing recording-include-clipboard support. `guacclip [-f] [-o OUTDIR] [--direction guest-to-client|client-to-guest] [--include image|text|all] [--max-item-bytes N] FILE...` writes `OUTDIR/manifest.json` + `OUTDIR/items/` with per-item direction, timing, mimetype, byte count, and SHA-256. Design mirrors guaclog (guac_parser/guac_socket loop). Clipboard streams are reassembled strictly by the stream index opened by a `clipboard` instruction, so graphical `img`/file/pipe blob streams are never misread as clipboard data. Direction comes from a recording-only `log stream=N direction=...` annotation where a protocol emits one, buffered per stream index and consumed at stream open; recordings without it get direction "unknown". A self-contained FIPS 180-4 SHA-256 (sha256.c) keeps the tool dependency-free - it links only libguac. Hardened against hostile recordings: mimetype is slugged to [A-Za-z0-9_] for filenames (no path traversal) and \u-escaped in JSON (valid manifest even with non-ASCII bytes); per-item size is capped (64 MiB default, `0` opts out) and the manifest item count is bounded to prevent OOM; item files are written via O_EXCL|O_NOFOLLOW temp + atomic rename; stream indices are parsed with strtol validation. Gated by --disable-guacclip.
--dedup none|skip (default none): duplicates are detected by SHA-256 of the reassembled item bytes. Every manifest item gains a duplicate_of field (the sequence number of the first identical item, or null). In skip mode a duplicate's file is not written (filename null) and a "duplicate" warning is added; none mode writes every item. Repeated copies are legitimate audit events, so none is the default. tests/: a CUnit suite (test_guacclip, wired into make check) covering SHA-256 FIPS 180-4 vectors and, via the guacclip_interpret() integration path, multi-blob reassembly, interleaved streams, direction correlation (and the unknown-direction fallback), the non-clipboard-stream guard, truncation, oversized capping, bad base64, non-numeric stream index, and both dedup modes.
ciroiriarte
added a commit
to ciroiriarte/guacamole-server
that referenced
this pull request
Oct 17, 2026
guacclip is protocol-independent and is now proposed separately as GUACAMOLE-2343 (apache#724).
ciroiriarte
added a commit
to ciroiriarte/guacamole-manual
that referenced
this pull request
Oct 31, 2026
guacclip is protocol-independent and is now proposed separately as GUACAMOLE-2343 (apache/guacamole-server#724). Its documentation will be proposed together with it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
guacclip, a command-line tool next toguacencandguaclogthat extracts clipboard contents (text and images) from session recordings made withrecording-include-clipboard. Neither existing tool surfaces this data today.Output is
OUTDIR/manifest.jsonplus one file per item inOUTDIR/items/, recording each item's timestamp, mimetype, size, SHA-256 and direction (where the recording annotates it; otherwiseunknown).--disable-guacclipto opt out.clipboardinstruction, so image/file/pipe blobs are never picked up.O_EXCL|O_NOFOLLOW+ atomic rename for output files).src/guacclip/tests, wired intomake check(14 tests).Split out from the SPICE PR #688 as suggested there, since it is protocol-independent.