slalombuild / secureli

seCureLI is a tool that enables you to experience the delight of building products by helping you get ideas from your head into working software as frictionlessly as possible, in a reliable, secure, scalable, and observable way.
Apache License 2.0
29 stars 3 forks source link

Prompt user to install new hooks for new languages detected on commit #493

Open JordoHeffernan opened 3 months ago

JordoHeffernan commented 3 months ago

As a SeCurLI user, I want to easily add new languages to my repository   So that when I have an existing repo with secureli installed, and I add a new language to the repo (ie add a .js file for the first time) we currently abort their commit until they run secureli init again. A prompt comes up in the CLI but I don't wait for input.

AC

-              When I commit a new language, I am prompted to install new hooks and wait for their response -              If I input "n" I continue the commit with existing hooks -              If I input "y" SeCurLI install the new hooks, and then continues the pre-commit process with all installed hooks

isaac-heist-slalom commented 2 months ago

@blonienc I don't think that we can fix this issue as described in the AC's. The reason the commit is aborted is because the pre-commit triggers code that requests user input. From my research, git hooks don't allow user input since they are supposed to be completely automated. There are some possible workarounds, but this would involve changing the way git hooks operate, which I don't think we want to do. The pre-commit hook triggers the following securely command secureli scan --publish-results=always. If this command is run via the cmd line, it works as described in the AC's already, but aborts if run via pre-commit.

One possible solution is to not ask the "add new language question" during the commit. This could be done by passing a flag in with the pre-commit, such as "is-commit=true"