The timeline for Google Summer of Code is coming to an end, and us interns are piecing together the final touches to our projects for submission. Thanks to the help of my mentors, and the duck sitting on my monitor, the algorithm that beats the heart of Vocab Crosswords in GNOME Crosswords has been tremendous strides in accuracy and testability. The primary focus shifted to getting the algorithm landed by the end of the summer, and working on the frontend of the application post-GSoC.
Unit TestsAt GUADEC, with the help of Federico, I created unit tests to see how my functions reacted in a given circumstance. Jonathan and I worked on creating different circumstances for the run and helper functions.
OptimizationFor user optimization, we don’t want to keep the board at a strict 30×30 grid and only allow for the first viable option. We decided to incorporate a new function to trim the dimensions of the generated grids based on the outermost edges of the letters, create a new board based on the newly calculated dimensions, trim that board down respectively, and copy the words over in the exact respective format. This is due to the libipuz grid’s origin point (0, 0) being fixed at the uppermost left corner cell. All in all, the trimming function essentially does this:
Additionally, it is pretty ideal to have some leeway of choice on how you want your puzzle to look. Some puzzles might generate lanky, while others extensively branched out all the way to the maximum borders, and the rest perhaps condensed together. The ability to rearrange the ordering of the words is already a feature in Crosswords thanks to PuzzleTask. But, it is for known grids of typically 15×15 sandwiched together. What is different with the vocab puzzle is that the rearrangement must still respect the same constraints of intersecting at a single letter nodal point, words cannot be on top of nor right next to each other (edge of nodes must respect space), and no islands (all words must share at least one node with another word). For instance, grids A and B here pertain the same words 1 through 6, but these words can connect differently on the graph, producing two options to choose from.
Tested, I achieved these 3 different versions of grids based off the same word bank:
Island Checking
The final component I will implement within GSoC’s timeline is checking for islanding words. Say a user provides a list of words and one word absolutely cannot intersect with any other word, it shares no node. The backtracking algorithm will spend a lot of time trying to place it, or invalidate any graph generation at all. We want to check beforehand if a word would not belong along the rest, and warn the user about it. Because there are many alphabets that exist, we are going to analyze the sets of characters as guint64 bitsets and GHashTable. Every unique character gets its own bit-slot, and every word’s 64-bit mask is compared to available words using bit operations.
I’m happy to announce that the SparkleShare project will receive a grant from the NLnet Foundation’s NGI0 Commons fund!
SparkleShare is a Free and Open Source collaboration app. It allows people who are not software developers or otherwise technical (designers, lawyers, students, academics, etc.) to work together and share files in projects that use the Git version control system.
SparkleShare provides an automatic sync algorithm and a friendly user interface to review changes and restore files from history.
What happened?SparkleShare has been around since 2010. I guess that makes it an “old” project now… Since then, the Mono/C# community active around that time has all but disbanded. The platform underneath slowly started to rot.
Eventually the app had to be removed from Flathub, also due to my own maintainer burnout. Providing maintenance and support next to a full-time job proved too much.
But that’s no longer an issue.
Now I have an opportunity to rebuild and address long-standing issues and feature requests. I have renewed energy to bring back the project better than ever!
The workThe funding proposal is to finish porting to Rust, bring SparkleShare in line with modern security and privacy practices, and design a fresh user interface informed by years worth of community feedback.
The goal is to get a Linux release back on Flathub. I’m planning to post frequent updates, so subscribe or follow me on GitHub or the Fediverse.
Read more of this story at Slashdot.
In these turbulent times, one frequently needs to run some tooling in a sandbox. The goal is mainly to reduce the blast radius: make it so programs within the sandbox cannot damage the host system (e.g. delete or overwrite something unintended), but also, to a lesser extent, to hide most of the filesystem to avoid exfiltrating sensitive data.
Recently, Bartosz Taudul (of Tracy fame) showed how to use systemd-nspawn for this purpose. He creates a container configuration, installs a distro inside, and bind-mounts some cache and project folders from the host. The mounts have an overlayfs on top, so within the container, tools can write over the files, but those writes do not affect the host filesystem.
I also want to share my sandboxing approach. My goal was to make it easy to use and reduce friction as much as possible, so that I always have a sandbox at my fingertips.
The result boils down to spawning a container-like environment, sharing enough of the host filesystem read-only to make all host binaries runnable, and sharing the current working directory read-write. Within this sandbox, you don’t need to install a separate distro—everything from your host just works, while the filesystem is kept mostly isolated (except for the folder where you run the sandbox).
For example, I’ll run the script in a Tracy checkout.
┌ ((8c8d451a)) ~/s/c/tracy └─ box fish Welcome to fish, the friendly interactive shell Type help for instructions on how to use fish yalter@sandbox ~/s/c/tracy>I can run the build since all my host binaries are accessible:
yalter@sandbox ~/s/c/tracy> meson setup build The Meson build system Version: 1.11.2 Source dir: /home/yalter/source/cpp/tracy Build dir: /home/yalter/source/cpp/tracy/build Build type: native build Project name: tracy Project version: 0.13.1 C++ compiler for the host machine: /usr/bin/ccache c++ (clang 22.1.8 "clang version 22.1.8 (AerynOS)") C++ linker for the host machine: c++ ld.lld 22.1.8 Host machine cpu family: x86_64 Host machine cpu: x86_64 Checking if define "_MSC_VER" exists: NO Run-time dependency threads found: YES Found pkg-config: YES (/usr/bin/pkg-config) 2.5.1 Build targets in project: 1 Found ninja-1.13.2 at /usr/bin/ninja yalter@sandbox ~/s/c/tracy> ninja -C build ninja: Entering directory `build' [2/2] Linking target libtracy.soThe home folder contains the working directory, and is otherwise mostly empty:
yalter@sandbox ~/s/c/tracy> ls -l ~ total 0 drwx------ 4 1000 1000 80 Aug 9 20:20 source/I can write into the home folder, but the write will go into a tmpfs, and will not affect the host system:
yalter@sandbox ~/s/c/tracy> touch ~/evil yalter@sandbox ~/s/c/tracy> ^D ┌ ((8c8d451a)) ~/s/c/tracy └─ cat ~/evil cat: /home/yalter/evil: No such file or directoryOnly changes to the Tracy folder, where I ran the sandbox, persisted on the host, all with correct user ID and everything:
┌ ((8c8d451a)) ~/s/c/tracy └─ ls -l build/ total 28K drwxr-xr-x 1 yalter yalter 48 Aug 9 20:21 libtracy.so.p drwxr-xr-x 1 yalter yalter 496 Aug 9 20:21 meson-info drwxr-xr-x 1 yalter yalter 56 Aug 9 20:21 meson-logs drwxr-xr-x 1 yalter yalter 310 Aug 9 20:21 meson-private drwxr-xr-x 1 yalter yalter 40 Aug 9 20:21 meson-uninstalled -rw-r--r-- 1 yalter yalter 5,3K Aug 9 20:21 build.ninja -rw-r--r-- 1 yalter yalter 545 Aug 9 20:21 compile_commands.json -rwxr-xr-x 1 yalter yalter 14K Aug 9 20:21 libtracy.so The box script #I use Bubblewrap to spawn the sandbox. This is an unprivileged sandboxing tool used by Flatpak (though, I hear there are plans to replace it with something else).
The script itself composes a long bwrap invocation. Let’s look at some of the parts.
#!/usr/bin/env bash set -euo pipefail # Export ALLOW_NET=0 to disable network access inside the sandbox. # # Keep in mind that if your X11/Xwayland doesn't check Xauth, # then network access lets the sandbox connect to your X11 # via an abstract Unix socket. This is quite dangerous. ALLOW_NET="${ALLOW_NET:-1}" # The current folder that we're binding read-write. REPO="$(readlink -f .)" BWRAP=( bwrap --die-with-parent # Unshare (isolate) a bunch of things inside the sandbox. --unshare-pid --unshare-uts --unshare-cgroup-try --unshare-user-try --cap-drop ALL # Create/mount important folders. --proc /proc --dev /dev --tmpfs /tmp --tmpfs /var --dir /run --dir /etc --hostname sandbox # Warning: this script shares all environment variables. # If on your system the environment can contain secrets, # you may want to clear them: # --clearenv # Bind the current folder read-write and chdir there. --bind "$REPO" "$REPO" --chdir "$REPO" ) # --- Read-only system binds --- SYS_RO_BINDS=( # Folders with binaries and libraries. /usr /bin /sbin /lib /lib64 # Random configuration files that programs tend to need. /etc/alternatives /etc/nsswitch.conf /etc/hosts /etc/localtime /etc/timezone /etc/pki /etc/ca-certificates /etc/ssl /etc/crypto-policies /etc/fonts # I fill these as I bump into problems, more or less. /etc/java /etc/texlive /var/lib/texmf /usr/lib/jvm /usr/share/java ) # Bind all of them read-only. for p in "${SYS_RO_BINDS[@]}"; do [[ -e "$p" ]] && BWRAP+=( --ro-bind "$p" "$p" ) done BWRAP+=( --ro-bind-try /etc/ld.so.cache /etc/ld.so.cache ) # resolv.conf is fun because it's a symlink into /run, # a folder which we do not want to expose. RESOLV_REAL="$(readlink -f /etc/resolv.conf 2>/dev/null || true)" if [[ -n "$RESOLV_REAL" && -f "$RESOLV_REAL" ]]; then BWRAP+=( --ro-bind "$RESOLV_REAL" /etc/resolv.conf ) fi # Unshare the network if needed. if [[ "$ALLOW_NET" -eq 0 ]]; then BWRAP+=( --unshare-net ) fi # Create a fresh home directory. # The username and the path is the same as on the host # so that everything keeps working. BWRAP+=( --setenv HOME "$HOME" --dir "$HOME" ) # --- Home read-only binds --- HOME_RO_BINDS=( .cargo/bin .cargo/config.toml .local/bin .local/lib/node_modules .rustup .fonts .local/share/fonts .local/share/nvim/site/parser .gitconfig .config/git .config/tmux .cache/ms-playwright .cache/corepack ) for rel in "${HOME_RO_BINDS[@]}"; do [[ -e "$HOME/$rel" ]] && BWRAP+=( --ro-bind "$HOME/$rel" "$HOME/$rel" ) done # --- Home overlays --- # The sandbox can write here, but the changes # will not affect the host filesystem. HOME_TMP_OVERLAYS=( .cache/fontconfig .cargo/registry .cargo/git .gradle .npm .cache/npm .local/share/pnpm/store .cache/yarn .cache/cpm .texlive2023 ) for rel in "${HOME_TMP_OVERLAYS[@]}"; do [[ -d "$HOME/$rel" ]] && BWRAP+=( --overlay-src "$HOME/$rel" --tmp-overlay "$HOME/$rel" ) done # Set up $PATH with the paths that we have inside this sandbox. BWRAP+=( --setenv PATH "$HOME/.cargo/bin:$HOME/.local/bin:/usr/local/bin:/usr/bin:/bin" ) # Execute our big commandline and pass it # the rest of the arguments (the command to run). CMD=( "${@:-bash}" ) exec "${BWRAP[@]}" "${CMD[@]}"Many lines, but most of them are just listing directories to mount.
If you want to run GUI apps in the sandbox, you’ll need to create an XDG_RUNTIME_DIR and mount a Wayland socket:
# Export PASS_WAYLAND=1 to enable Wayland access. # Warning: it is currently NOT SANDBOXED (e.g. with security-context protocol). # See https://niri-wm.github.io/niri/Security-Model.html#unsandboxed-clients # for an example of what that implies. PASS_WAYLAND="${PASS_WAYLAND:-0}" # Export PASS_DRI=1 to enable DRI (GPU) access for hardware acceleration. PASS_DRI="${PASS_DRI:-0}" # Export PASS_X11=1 to enable X11 (Xwayland) access. PASS_X11="${PASS_X11:-0}" if [[ "$PASS_DRI" -eq 1 && -d /dev/dri ]]; then BWRAP+=( --dev-bind /dev/dri /dev/dri ) fi # EGL complains without this. BWRAP+=( --ro-bind /sys /sys ) # Wayland: bind only the socket into a fresh runtime dir. XDG_RT="${XDG_RUNTIME_DIR:-}" WAYLAND_SOCK="${WAYLAND_DISPLAY:-wayland-0}" if [[ "$PASS_WAYLAND" -eq 1 && -n "$XDG_RT" && -S "$XDG_RT/$WAYLAND_SOCK" ]]; then BWRAP+=( --dir /run/user --dir /run/user/1000-sbox --bind "$XDG_RT/$WAYLAND_SOCK" "/run/user/1000-sbox/$WAYLAND_SOCK" --setenv XDG_RUNTIME_DIR /run/user/1000-sbox --setenv WAYLAND_DISPLAY "$WAYLAND_SOCK" ) else BWRAP+=( --unsetenv WAYLAND_DISPLAY ) fi # X11. DISPLAY_VAR="${DISPLAY:-}" if [[ "$PASS_X11" -eq 1 && -n "$DISPLAY_VAR" && -d /tmp/.X11-unix ]]; then BWRAP+=( --ro-bind /tmp/.X11-unix /tmp/.X11-unix --setenv DISPLAY "$DISPLAY_VAR" ) else # Make it harder for accidental X11: unset DISPLAY. BWRAP+=( --unsetenv DISPLAY ) fiThat’s about it for the script. If needed, it’s easy to mount more folders by adding them into one of the arrays. The script doesn’t require elevated privileges to run.
Just remember that the folder where you run it is mounted read-write with the sandbox. When I want to run a dangerous command without affecting the files in the repository I’m working on, I just make a temporary copy:
project > cd .. > git clone project project2 > cd project2 project2 > box fish project2@sandbox > ...some dangerous command... ... project2@sandbox > ^D project2 > cd .. > rm -rf project2Another trick I recently did: I created a read-only GitHub personal access token, and automatically put it into $GH_TOKEN in the sandbox. This way, commands like gh pr list work in the sandbox without having any write access.
Conclusion #This is very much not a polished tool, but rather a script I’ve been adding on to here and there for several months. I wanted to share it because I think it’s fairly generic (works on both Fedora and AerynOS at least), and avoids a number of pain points with other sandboxing approaches:
One limitation is that I haven’t been able to make podman run inside this sandbox yet. I tried once briefly, but kept hitting weird errors. Maybe it needs some capabilities exposed; not sure.
This is also obviously not intended as a bulletproof sandbox for running fully untrusted code, in fact I wouldn’t be too surprised if I left some gaping holes by mistake (please let me know if I did).
Read more of this story at Slashdot.
Read more of this story at Slashdot.
Read more of this story at Slashdot.
Read more of this story at Slashdot.
Read more of this story at Slashdot.
Read more of this story at Slashdot.
Read more of this story at Slashdot.
Read more of this story at Slashdot.
Read more of this story at Slashdot.
Read more of this story at Slashdot.
Read more of this story at Slashdot.
Read more of this story at Slashdot.