From 83c7c17fa51a8c886edc81a50963fe8c3fb2eaed Mon Sep 17 00:00:00 2001 From: brotoskyj Date: Tue, 4 Nov 2025 18:17:24 -0500 Subject: [PATCH 1/9] Changed README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a464e7a..d647cdc 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Python toolkit for secure, auditable, and automated airlock agent and policy man ## 🧑‍💻 Requirements -[airlock_libs](https://git.racooncity.org/brotoskyj/-/packages/pypi/airlock-libs/0.1.1) +[airlock_libs](https://git.racooncity.org/brotoskyj/-/packages/pypi/airlock-libs/) --- From c71920d90a6908c51b005280168077c2264938e2 Mon Sep 17 00:00:00 2001 From: brotoskyj Date: Wed, 5 Nov 2025 18:11:20 -0500 Subject: [PATCH 2/9] Updated gitignore file to not include cargo or pyproject --- .gitea/workflows/loxide.yml | 50 +++++++++++++++++++++++ .gitea/workflows/loxide_lib.yml | 36 +++++++++++++++++ .gitignore | 2 + airlock_libs/.gitea/workflows/build.yaml | 51 ++++++++++++++++++++++++ 4 files changed, 139 insertions(+) create mode 100644 .gitea/workflows/loxide.yml create mode 100644 .gitea/workflows/loxide_lib.yml diff --git a/.gitea/workflows/loxide.yml b/.gitea/workflows/loxide.yml new file mode 100644 index 0000000..39ea949 --- /dev/null +++ b/.gitea/workflows/loxide.yml @@ -0,0 +1,50 @@ +name: Build EXE and Release +run-name: ${{ gitea.actor }} +on: + push: + branches: + - master + +jobs: + Build and Release: + runs-on: debian-stable + env: + DISPLAY: :99 + + steps: + - name: Install Prerequisites + run: | + dpkg --add-architecture i386 + apt update > /dev/null 2>&1 + apt install git curl wine32:i386 xvfb -y > /dev/null 2>&1 + + - name: Start X Virtual Framebuffer (Xvfb) + run: | + # Start Xvfb in the background using the defined display number + Xvfb :99 -screen 0 1024x768x16 & + + - name: Cloning Repository + run: | + git clone https://brotoskyj:${{ secrets.RUNNER_TOKEN }}@git.racooncity.org/brotoskyj/build_test --branch RustImplementation + pwd + ls + + - name: Setting Up Build Environment + run: | + apt install wine64 -y -qq > /dev/null 2>&1 + curl -L -o python.exe https://www.python.org/ftp/python/3.13.9/python-3.13.9-amd64.exe + wine python.exe /quiet /NoWeb InstallAllUsers=1 PrependPath=1 TargetDir=C:/Python313 + cp -r build_test/ ~/.wine/drive_c/Python313/ + cd ~/.wine/drive_c/Python313 + wine python.exe -m pip install nuitka pywin32 keyring --break-system-packages + wine python.exe -m pip install -r build_test/requirements.txt + wine python.exe -m pip install \ + --index-url https://git.racooncity.org/api/packages/brotoskyj/pypi/simple/ \ + airlock-libs --break-system-packages + + - name: Build Executable + env: + DISPLAY: :99 + WINEDEBUG: -all + run: | + xvfb-run -a wine cmd /c nuitka --onefile --onefile-windows-splash-screen-image=build_test/loading.png --follow-imports --include-module=keyring.backends.Windows --include-module=win32cred --include-module=pywintypes --include-module=pythoncom --include-module=win32api --include-module=win32security --include-module=win32con --windows-product-name='LoXide' --windows-product-version='1.2.10.0' --windows-company-name='WVUM IRT' --windows-icon-from-ico=build_test/IRT_icon_32-512.ico build_test/AirlockTools_client.py --deployment --assume-yes-for-downloads diff --git a/.gitea/workflows/loxide_lib.yml b/.gitea/workflows/loxide_lib.yml new file mode 100644 index 0000000..b378a7a --- /dev/null +++ b/.gitea/workflows/loxide_lib.yml @@ -0,0 +1,36 @@ +name: Build Library +run-name: ${{ gitea.actor }} +on: + push: + paths: + - airlock_libs/** + +jobs: + Build Library: + runs-on: debian-stable + steps: + - name: Install Prerequisites + run: | + apt update + apt install curl git python3 pip pkg-config openssl libssl-dev patchelf binutils-mingw-w64-x86-64 mingw-w64 -y + curl https://sh.rustup.rs -sSf | sh -s -- -y + pip install maturin twine --break-system-packages + + - name: Pull Repository + run: | + git clone https://brotoskyj:${{ secrets.RUNNER_TOKEN }}@git.racooncity.org/brotoskyj/build_test --branch RustImplementation + + - name: Compile Library and Upload + run: | + export TWINE_USERNAME=brotoskyj + export TWINE_PASSWORD=${{ secrets.RUNNER_TOKEN }} + export TWINE_REPOSITORY_URL=https://git.racooncity.org/api/packages/brotoskyj/pypi + . "$HOME/.cargo/env" + rustup target add x86_64-pc-windows-gnu + cd build_test/airlock_libs + cargo clean + cargo fmt + cargo clippy --fix --all-targets --allow-dirty + maturin build --target x86_64-unknown-linux-gnu -i python3.13 --release --strip + maturin build --target x86_64-pc-windows-gnu -i python3.13 --release --strip + python3 -m twine upload target/wheels/* diff --git a/.gitignore b/.gitignore index 7d2a7e0..f104ebc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +!Cargo.toml +!pyproject.toml .env *.html *.csv diff --git a/airlock_libs/.gitea/workflows/build.yaml b/airlock_libs/.gitea/workflows/build.yaml index e69de29..7619de5 100644 --- a/airlock_libs/.gitea/workflows/build.yaml +++ b/airlock_libs/.gitea/workflows/build.yaml @@ -0,0 +1,51 @@ +name: Build EXE and Release +run-name: ${{ gitea.actor }} +on: + push: + branches: + - master + - RustImplementation + +jobs: + Build and Release: + runs-on: debian-stable + env: + DISPLAY: :99 + + steps: + - name: Install Prerequisites + run: | + dpkg --add-architecture i386 + apt update > /dev/null 2>&1 + apt install git curl wine32:i386 xvfb -y > /dev/null 2>&1 + + - name: Start X Virtual Framebuffer (Xvfb) + run: | + # Start Xvfb in the background using the defined display number + Xvfb :99 -screen 0 1024x768x16 & + + - name: Cloning Repository + run: | + git clone https://brotoskyj:${{ secrets.RUNNER_TOKEN }}@git.racooncity.org/brotoskyj/build_test --branch RustImplementation + pwd + ls + + - name: Setting Up Build Environment + run: | + apt install wine64 -y -qq > /dev/null 2>&1 + curl -L -o python.exe https://www.python.org/ftp/python/3.13.9/python-3.13.9-amd64.exe + wine python.exe /quiet /NoWeb InstallAllUsers=1 PrependPath=1 TargetDir=C:/Python313 + cp -r build_test/ ~/.wine/drive_c/Python313/ + cd ~/.wine/drive_c/Python313 + wine python.exe -m pip install nuitka pywin32 keyring --break-system-packages + wine python.exe -m pip install -r build_test/requirements.txt + wine python.exe -m pip install \ + --index-url https://git.racooncity.org/api/packages/brotoskyj/pypi/simple/ \ + airlock-libs --break-system-packages + + - name: Build Executable + env: + DISPLAY: :99 + WINEDEBUG: -all + run: | + xvfb-run -a wine cmd /c nuitka --onefile --onefile-windows-splash-screen-image=build_test/loading.png --follow-imports --include-module=keyring.backends.Windows --include-module=win32cred --include-module=pywintypes --include-module=pythoncom --include-module=win32api --include-module=win32security --include-module=win32con --windows-product-name='LoXide' --windows-product-version='1.2.10.0' --windows-company-name='WVUM IRT' --windows-icon-from-ico=build_test/IRT_icon_32-512.ico build_test/AirlockTools_client.py --deployment --assume-yes-for-downloads \ No newline at end of file From 582c4445f3a0a8b35447a351a87092900d2372bb Mon Sep 17 00:00:00 2001 From: brotoskyj Date: Wed, 5 Nov 2025 18:12:30 -0500 Subject: [PATCH 3/9] Updated gitignore file to not include cargo or pyproject --- .gitignore | 5 ++--- airlock_libs/Cargo.toml | 31 +++++++++++++++++++++++++++++++ airlock_libs/pyproject.toml | 14 ++++++++++++++ 3 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 airlock_libs/Cargo.toml create mode 100644 airlock_libs/pyproject.toml diff --git a/.gitignore b/.gitignore index f104ebc..d9b2b2a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ -!Cargo.toml -!pyproject.toml +!airlock_libs/Cargo.toml +!airlock_libs/pyproject.toml .env *.html *.csv @@ -10,7 +10,6 @@ jobs.json *.xl* *.exe securitytest.py -*.toml system_config.json Development/ AirlockTools_client*/ \ No newline at end of file diff --git a/airlock_libs/Cargo.toml b/airlock_libs/Cargo.toml new file mode 100644 index 0000000..b5b9896 --- /dev/null +++ b/airlock_libs/Cargo.toml @@ -0,0 +1,31 @@ +[package] +name = "airlock_libs" +version = "1.0.1" +edition = "2024" + +[lib] +crate-type = ["cdylib"] + +[dependencies] +chrono = "0.4.42" +indicatif = "0.18.2" +mongodb = "3.3.0" +pyo3 = { version = "0.27.0", features = ["extension-module", "generate-import-lib"] } +reqwest = { version = "0.12.24", features = ["json", "native-tls"] } +serde = "1.0.228" +serde-pyobject = "0.8.0" +serde_json = "1.0.145" +tokio = { version = "1.48.0", features = ["full"] } + +[package.metadata.maturin] +generate-abi-stubs = true + +[profile.release] +opt-level = "z" +lto = "fat" +debug = false +codegen-units = 1 +panic = 'abort' +strip = true +debug-assertions = false +overflow-checks = false diff --git a/airlock_libs/pyproject.toml b/airlock_libs/pyproject.toml new file mode 100644 index 0000000..4b7b463 --- /dev/null +++ b/airlock_libs/pyproject.toml @@ -0,0 +1,14 @@ +[build-system] +requires = ["maturin1.9.6"] +build-backend = "maturin" + +[project] +name = "airlock_libs" +version = "1.0.1" +description = "Airlock Digital API Wrapper" +readme = "README.md" +license = { text = "AGPL-3.0-only" } +authors = [{ name = "James Brotosky", email = "james.brotosky@racooncity.org" }] + +[tool.maturin] # if you're building via maturin +bindings = "pyo3" \ No newline at end of file From 2ed08526f8b3d8a36cef2da9efe00fd1f0e104cc Mon Sep 17 00:00:00 2001 From: brotoskyj Date: Wed, 5 Nov 2025 18:15:47 -0500 Subject: [PATCH 4/9] Fixed Typo --- .gitea/workflows/loxide.yml | 8 ++++---- .gitea/workflows/loxide_lib.yml | 4 ++-- airlock_libs/airlock_libs.pyi | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/loxide.yml b/.gitea/workflows/loxide.yml index 39ea949..ca7e614 100644 --- a/.gitea/workflows/loxide.yml +++ b/.gitea/workflows/loxide.yml @@ -25,7 +25,7 @@ jobs: - name: Cloning Repository run: | - git clone https://brotoskyj:${{ secrets.RUNNER_TOKEN }}@git.racooncity.org/brotoskyj/build_test --branch RustImplementation + git clone https://brotoskyj:${{ secrets.RUNNER_TOKEN }}@git.racooncity.org/brotoskyj/AirlockTools --branch RustImplementation pwd ls @@ -34,10 +34,10 @@ jobs: apt install wine64 -y -qq > /dev/null 2>&1 curl -L -o python.exe https://www.python.org/ftp/python/3.13.9/python-3.13.9-amd64.exe wine python.exe /quiet /NoWeb InstallAllUsers=1 PrependPath=1 TargetDir=C:/Python313 - cp -r build_test/ ~/.wine/drive_c/Python313/ + cp -r AirlockTools/ ~/.wine/drive_c/Python313/ cd ~/.wine/drive_c/Python313 wine python.exe -m pip install nuitka pywin32 keyring --break-system-packages - wine python.exe -m pip install -r build_test/requirements.txt + wine python.exe -m pip install -r AirlockTools/requirements.txt wine python.exe -m pip install \ --index-url https://git.racooncity.org/api/packages/brotoskyj/pypi/simple/ \ airlock-libs --break-system-packages @@ -47,4 +47,4 @@ jobs: DISPLAY: :99 WINEDEBUG: -all run: | - xvfb-run -a wine cmd /c nuitka --onefile --onefile-windows-splash-screen-image=build_test/loading.png --follow-imports --include-module=keyring.backends.Windows --include-module=win32cred --include-module=pywintypes --include-module=pythoncom --include-module=win32api --include-module=win32security --include-module=win32con --windows-product-name='LoXide' --windows-product-version='1.2.10.0' --windows-company-name='WVUM IRT' --windows-icon-from-ico=build_test/IRT_icon_32-512.ico build_test/AirlockTools_client.py --deployment --assume-yes-for-downloads + xvfb-run -a wine cmd /c nuitka --onefile --onefile-windows-splash-screen-image=AirlockTools/loading.png --follow-imports --include-module=keyring.backends.Windows --include-module=win32cred --include-module=pywintypes --include-module=pythoncom --include-module=win32api --include-module=win32security --include-module=win32con --windows-product-name='LoXide' --windows-product-version='1.2.10.0' --windows-company-name='WVUM IRT' --windows-icon-from-ico=AirlockTools/IRT_icon_32-512.ico AirlockTools/AirlockTools_client.py --deployment --assume-yes-for-downloads diff --git a/.gitea/workflows/loxide_lib.yml b/.gitea/workflows/loxide_lib.yml index b378a7a..c991875 100644 --- a/.gitea/workflows/loxide_lib.yml +++ b/.gitea/workflows/loxide_lib.yml @@ -18,7 +18,7 @@ jobs: - name: Pull Repository run: | - git clone https://brotoskyj:${{ secrets.RUNNER_TOKEN }}@git.racooncity.org/brotoskyj/build_test --branch RustImplementation + git clone https://brotoskyj:${{ secrets.RUNNER_TOKEN }}@git.racooncity.org/brotoskyj/AirlockTools --branch RustImplementation - name: Compile Library and Upload run: | @@ -27,7 +27,7 @@ jobs: export TWINE_REPOSITORY_URL=https://git.racooncity.org/api/packages/brotoskyj/pypi . "$HOME/.cargo/env" rustup target add x86_64-pc-windows-gnu - cd build_test/airlock_libs + cd AirlockTools/airlock_libs cargo clean cargo fmt cargo clippy --fix --all-targets --allow-dirty diff --git a/airlock_libs/airlock_libs.pyi b/airlock_libs/airlock_libs.pyi index 2e061f1..948c4b4 100644 --- a/airlock_libs/airlock_libs.pyi +++ b/airlock_libs/airlock_libs.pyi @@ -27,7 +27,7 @@ def history_logging( checkpoint_number: str, policy_names: str, ) -> List[Dict[str, Any]]: - """ + """ Query execution history logs from the Airlock API. Parameters From a5e659f5713899224aee81ec12bacdf14e749a29 Mon Sep 17 00:00:00 2001 From: brotoskyj Date: Wed, 5 Nov 2025 18:22:28 -0500 Subject: [PATCH 7/9] Added secret to Gitea --- airlock_libs/airlock_libs.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airlock_libs/airlock_libs.pyi b/airlock_libs/airlock_libs.pyi index 948c4b4..2e061f1 100644 --- a/airlock_libs/airlock_libs.pyi +++ b/airlock_libs/airlock_libs.pyi @@ -27,7 +27,7 @@ def history_logging( checkpoint_number: str, policy_names: str, ) -> List[Dict[str, Any]]: - """ + """ Query execution history logs from the Airlock API. Parameters From f6881f89e05a00f086a7cfc58202d82a605eff65 Mon Sep 17 00:00:00 2001 From: brotoskyj Date: Thu, 6 Nov 2025 08:26:07 -0500 Subject: [PATCH 8/9] Changed to Cargo --- airlock_libs/Cargo.lock | 2 +- airlock_libs/Cargo.toml | 2 +- airlock_libs/pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/airlock_libs/Cargo.lock b/airlock_libs/Cargo.lock index 5faf19a..b63511b 100644 --- a/airlock_libs/Cargo.lock +++ b/airlock_libs/Cargo.lock @@ -17,7 +17,7 @@ dependencies = [ [[package]] name = "airlock_libs" -version = "1.0.1" +version = "1.0.2" dependencies = [ "chrono", "indicatif", diff --git a/airlock_libs/Cargo.toml b/airlock_libs/Cargo.toml index b5b9896..907432e 100644 --- a/airlock_libs/Cargo.toml +++ b/airlock_libs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "airlock_libs" -version = "1.0.1" +version = "1.0.2" edition = "2024" [lib] diff --git a/airlock_libs/pyproject.toml b/airlock_libs/pyproject.toml index 4b7b463..2251ec9 100644 --- a/airlock_libs/pyproject.toml +++ b/airlock_libs/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "maturin" [project] name = "airlock_libs" -version = "1.0.1" +version = "1.0.2" description = "Airlock Digital API Wrapper" readme = "README.md" license = { text = "AGPL-3.0-only" } From d5c9bbe38e31029dce398b53ae52c3868fc0a75b Mon Sep 17 00:00:00 2001 From: brotoskyj Date: Thu, 6 Nov 2025 10:35:21 -0500 Subject: [PATCH 9/9] Minor Memory Optimization in Airlock Libs --- .gitignore | 1 + airlock_libs/Cargo.lock | 2 +- airlock_libs/Cargo.toml | 2 +- airlock_libs/pyproject.toml | 2 +- airlock_libs/src/services.rs | 2 +- requirements.txt | 5 ++++- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index d9b2b2a..056024d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +*.toml !airlock_libs/Cargo.toml !airlock_libs/pyproject.toml .env diff --git a/airlock_libs/Cargo.lock b/airlock_libs/Cargo.lock index b63511b..70327a0 100644 --- a/airlock_libs/Cargo.lock +++ b/airlock_libs/Cargo.lock @@ -17,7 +17,7 @@ dependencies = [ [[package]] name = "airlock_libs" -version = "1.0.2" +version = "1.0.3" dependencies = [ "chrono", "indicatif", diff --git a/airlock_libs/Cargo.toml b/airlock_libs/Cargo.toml index 907432e..15f8786 100644 --- a/airlock_libs/Cargo.toml +++ b/airlock_libs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "airlock_libs" -version = "1.0.2" +version = "1.0.3" edition = "2024" [lib] diff --git a/airlock_libs/pyproject.toml b/airlock_libs/pyproject.toml index 2251ec9..2f78abd 100644 --- a/airlock_libs/pyproject.toml +++ b/airlock_libs/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "maturin" [project] name = "airlock_libs" -version = "1.0.2" +version = "1.0.3" description = "Airlock Digital API Wrapper" readme = "README.md" license = { text = "AGPL-3.0-only" } diff --git a/airlock_libs/src/services.rs b/airlock_libs/src/services.rs index bb7b11e..5056344 100644 --- a/airlock_libs/src/services.rs +++ b/airlock_libs/src/services.rs @@ -95,6 +95,7 @@ pub fn pull_policy_exec_histories( progress_bar.enable_steady_tick(std::time::Duration::from_millis(100)); let client = build_client(py, &py_self); let api: Py = py_self; + let cutoff = Local::now().naive_local() - Duration::days(days); loop { let execution_histories = history_logging( py, @@ -152,7 +153,6 @@ pub fn pull_policy_exec_histories( Ok(date) => date, Err(_) => continue, }; - let cutoff = Local::now().naive_local() - Duration::days(days); if history_date >= cutoff.into() { let key = ( executions.sha256.clone(), diff --git a/requirements.txt b/requirements.txt index bb00042..e932ee2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,4 +8,7 @@ requests==2.32.5 schedule==1.2.2 tqdm==4.67.1 urllib3==2.5.0 -bson==0.5.10 \ No newline at end of file +bson==0.5.10 + +--extra-index-url https://git.racooncity.org/api/packages/brotoskyj/pypi/simple/ +airlock_libs==1.0.3 \ No newline at end of file