stable
Clone or download
Add git object content analysis in the git:pre-receive-analyze command. The analysis is done with a piece of Rust code that is called by using PHP's FFI. Our code simply check is the word 'Tuleap' is found in the git object content, if that is the case a rejection message in JSON format, explaining the issue is returned. If it everything is good, the rejection message will be 'null'. This patch also put the command behind a feature flag. To build prereceivers.so (required for proper testing): - `cd plugins/git/additional-packages/pre-receive-rs/` - `nix-shell` (you need to have nix installed) - `cargo zigbuild --target x86_64-unknown-linux-gnu.2.17 --release` To test: - set feature_flag_enable_pre_receive_analyze_command to 1 - launch the command with valid parameters Part of story #28845 have an hidden command executing custom command to determine if the reference should have been rejected Change-Id: I2a9d625d3ac1cfb4daa3a1b2cf440e8ed59c2048
Modified Files
Name | ||||
---|---|---|---|---|
A | plugins/git/additional-packages/pre-receive-rs/.gitignore | +8 | −0 | Go to diff View file |
A | plugins/git/additional-packages/pre-receive-rs/Cargo.lock | +314 | −0 | Go to diff View file |
A | plugins/git/additional-packages/pre-receive-rs/Cargo.toml | +16 | −0 | Go to diff View file |
A | plugins/git/additional-packages/pre-receive-rs/build.rs | +12 | −0 | Go to diff View file |
A | plugins/git/additional-packages/pre-receive-rs/cbindgen.toml | +2 | −0 | Go to diff View file |
A | plugins/git/additional-packages/pre-receive-rs/shell.nix | +9 | −0 | Go to diff View file |
A | plugins/git/additional-packages/pre-receive-rs/src/lib.rs | +92 | −0 | Go to diff View file |
A | plugins/git/additional-packages/pre-receive-rs/src/wire.rs | +25 | −0 | Go to diff View file |
M | plugins/git/db/uninstall.sql | +2 | −0 | Go to diff View file |
M | plugins/git/include/Hook/PreReceive/PreReceiveAnalyzeAction.php | +6 | −7 | Go to diff View file |
M | plugins/git/include/Hook/PreReceive/PreReceiveAnalyzeCommand.php | +9 | −3 | Go to diff View file |
A | plugins/git/include/Hook/PreReceive/PreReceiveAnalyzeFFI.php | +53 | −0 | Go to diff View file |
A | plugins/git/include/Hook/PreReceive/WASMCaller.php | +28 | −0 | Go to diff View file |
A | plugins/git/include/Hook/PreReceive/WASMFFICallerStub.php | +33 | −0 | Go to diff View file |
M | plugins/git/include/gitPlugin.php | +22 | −11 | Go to diff View file |
M | plugins/git/tests/unit/Hook/PreReceive/PreReceiveAnalyzeActionTest.php | +39 | −5 | Go to diff View file |
M | tests/psalm/psalm.xml | +1 | −0 | Go to diff View file |
A | tests/psalm/stubs/ext-ffi.phpstub | +472 | −0 | Go to diff View file |
M | tools/utils/nix/build-tools/build-tools-php.nix | +1 | −0 | Go to diff View file |