Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drop non-unique Cleanup logic from expect step (facebookincubator#516)
Summary: Pull Request resolved: facebookincubator#516 To enable actual clean ups and prevent errors like ``` ERROR failed to run command: could not load TTP at /home/nesusvet/security-ttpcode/ttps/infra/tupperware/ssh-to-container-as-root.yaml: could not parse action for step "start-tupperware-container": action fields did not match any valid action type ``` Changes pretty radical but I don't see why we need a custom implementation of cleanup logic for expect step Consider small change to the [expect.yaml](https://www.internalfb.com/code/fbsource/fbcode/security/redteam/purple_team/ttpforge/example-ttps/actions/expect/expect.yaml) example TTP ``` hg d diff --git a/fbcode/security/redteam/purple_team/ttpforge/example-ttps/actions/expect/expect.yaml b/fbcode/security/redteam/purple_team/ttpforge/example-ttps/actions/expect/expect.yaml --- a/fbcode/security/redteam/purple_team/ttpforge/example-ttps/actions/expect/expect.yaml +++ b/fbcode/security/redteam/purple_team/ttpforge/example-ttps/actions/expect/expect.yaml @@ -26,3 +26,4 @@ response: "John" - prompt: "Enter your age:" response: "30" + cleanup: echo "Done" ``` Try to run it on master and see NO CLEANUP instructions executed: ``` buck run security/redteam/purple_team/ttpforge:ttpforge -- run security/redteam/purple_team/ttpforge/example-ttps/actions/expect/expect.yaml File changed: fbcode//security/redteam/purple_team/ttpforge/example-ttps/actions/expect/expect.yaml Buck UI: https://www.internalfb.com/buck2/a008be5d-79d8-4591-960a-64fafbc10a44 Network: Up: 0B Down: 0B Jobs completed: 4. Time elapsed: 0.0s. BUILD SUCCEEDED INFO RUNNING TTP: Complex Expect Step with Python Script INFO ---------------------------------------- INFO Executing Step #1: "create_python_script" INFO ---------------------------------------- INFO Executing Step facebookincubator#2: "run_expect_script" Enter your name: John Enter your age: 30 Hello John, you are 30 years old! INFO ---------------------------------------- INFO All TTP steps completed successfully! INFO ======================================== INFO CLEANING UP 2 steps of TTP: "Complex Expect Step with Python Script" INFO ---------------------------------------- INFO Cleaning Up Step facebookincubator#2: "run_expect_script" INFO No Cleanup Action Defined for Step run_expect_script INFO ---------------------------------------- INFO Cleaning Up Step #1: "create_python_script" INFO No Cleanup Action Defined for Step create_python_script INFO ---------------------------------------- INFO Finished Cleanup Successfully ``` Differential Revision: D64108097 fbshipit-source-id: 2ab395b393b88ebfd0f5dd647cd75f34fce52b97
- Loading branch information