Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ BUG ] Invoke-FalconDeploy doesn't execute scripts specified in the File parameter #441

Open
bk-cs opened this issue Jan 6, 2025 · 1 comment
Assignees
Labels
bug Something isn't working fix available Self-applied fix available in issue

Comments

@bk-cs
Copy link
Collaborator

bk-cs commented Jan 6, 2025

Describe the bug
When using File with a PowerShell script (for Windows) or ZSH script (for Mac), the script is not started.

To Reproduce
Invoke-FalconDeploy -File .\my.ps1 -HostId <id>

Expected behavior
Script should be executed.

Environment (please complete the following information):

  • OS: Windows 10
  • PowerShell: 5.1
  • PSFalcon: 2.2.8

Additional context
If you put the script in an archive and use Archive and Run instead, it works as expected.

@bk-cs bk-cs added the bug Something isn't working label Jan 6, 2025
@bk-cs bk-cs self-assigned this Jan 6, 2025
bk-cs added a commit that referenced this issue Jan 7, 2025
Added code to ensure that the final `run` step takes place when using `File` with Windows or Mac hosts. Previously, the `run` step was never reached because the `extract` step (only necessary when using the `Archive` and `Run` parameters) was not processed. Now that step will be effectively ignored when using the `File` parameter for Mac and Windows which should lead everything completing successfully.
@bk-cs
Copy link
Collaborator Author

bk-cs commented Jan 7, 2025

I've made changes to Invoke-FalconDeploy to fix this issue for the next release. If you'd like to resolve it for your local module before release, you can replace public\psf-real-time-response.ps1 using the steps outlined below.

Import-Module -Name PSFalcon
$ModulePath = (Show-FalconModule).ModulePath
(Invoke-WebRequest -Uri https://raw.githubusercontent.com/CrowdStrike/psfalcon/293d032ad7ec2eb525b4a6137fb4993abc28f50c/public/psf-real-time-response.ps1 -UseBasicParsing).Content > (Join-Path (Join-Path $ModulePath public) psf-real-time-response.ps1)

Please ensure you close and re-open PowerShell and re-import PSFalcon before testing. If you have any issues, respond here for me to review.

EDIT: Updated link with additional fix to account for when the put step fails more accurately.

@bk-cs bk-cs added the fix available Self-applied fix available in issue label Jan 7, 2025
@bk-cs bk-cs changed the title [ BUG ] Invoke-FalconDeploy doesn't start PowerShell scripts specified in the File parameter [ BUG ] Invoke-FalconDeploy doesn't execute scripts specified in the File parameter Jan 8, 2025
bk-cs added a commit that referenced this issue Jan 8, 2025
Changed fix by re-ordering steps run for `File` and `Archive` parameters to account for cases where a file fails to `put`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fix available Self-applied fix available in issue
Projects
None yet
Development

No branches or pull requests

1 participant