Files
firezone/scripts/nix/flake.nix
Thomas Eizinger 69f9a03ee8 refactor(connlib): simplify IpPacket struct (#9795)
With the removal of the NAT64/46 modules, we can now simplify the
internals of our `IpPacket` struct. The requirements for our `IpPacket`
struct are somewhat delicate.

On the one hand, we don't want to be overly restrictive in our parsing /
validation code because there is a lot of broken software out there that
doesn't necessarily follow RFCs. Hence, we want to be as lenient as
possible in what we accept.

On the other hand, we do need to verify certain aspects of the packet,
like the payload lengths. At the moment, we are somewhat too lenient
there which causes errors on the Gateway where we have to NAT or
otherwise manipulate the packets. See #9567 or #9552 for example.

To fix this, we make the parsing in the `IpPacket` constructor more
restrictive. If it is a UDP, TCP or ICMP packet, we attempt to fully
parse its headers and validate the payload lengths.

This parsing allows us to then rely on the integrity of the packet as
part of the implementation. This does create several code paths that can
in theory panic but in practice, should be impossible to hit. To ensure
that this does in fact not happen, we also tackle an issue that is long
overdue: Fuzzing.

Resolves: #6667 
Resolves: #9567
Resolves: #9552
2025-07-29 04:42:57 +00:00

71 lines
2.0 KiB
Nix

{
inputs = {
nixpkgs.url = "nixpkgs";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = { nixpkgs, nixpkgs-unstable, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [
(final: _prev: {
unstable = import nixpkgs-unstable {
inherit (final) system config;
};
})
];
};
packages = with pkgs; [
rustup # We use `rustup` to manage the Rust installation in order to get `+nightly` etc features.
curl
wget
pkg-config
dbus
openssl_3
glib
gtk3
libsoup_3
librsvg
zenity
desktop-file-utils
android-tools
llvmPackages.bintools-unwrapped
bpftools
# For Tauri
at-spi2-atk
atkmm
cairo
gdk-pixbuf
glib
gobject-introspection
gobject-introspection.dev
gtk3
harfbuzz
librsvg
libsoup_3
pango
webkitgtk_4_1
webkitgtk_4_1.dev
libayatana-appindicator
];
in
{
devShells = {
x86_64-linux.default = pkgs.mkShell {
packages = [ pkgs.cargo-tauri pkgs.iptables pkgs.pnpm pkgs.unstable.cargo-sort pkgs.cargo-deny pkgs.cargo-autoinherit pkgs.dump_syms pkgs.xvfb-run pkgs.ktlint pkgs.unstable.actionlint pkgs.cargo-fuzz pkgs.cargo-llvm-cov ];
buildInputs = packages;
src = ../..;
PKG_CONFIG_PATH = with pkgs; "${glib.dev}/lib/pkgconfig:${libsoup_3.dev}/lib/pkgconfig:${webkitgtk_4_1.dev}/lib/pkgconfig:${at-spi2-atk.dev}/lib/pkgconfig:${gtk3.dev}/lib/pkgconfig:${gdk-pixbuf.dev}/lib/pkgconfig:${cairo.dev}/lib/pkgconfig:${pango.dev}/lib/pkgconfig:${harfbuzz.dev}/lib/pkgconfig";
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ pkgs.libayatana-appindicator pkgs.gtk3 pkgs.glib ];
};
};
};
}