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] update-rules fails for packages created with Release Automation #1429

Closed
fukusuket opened this issue Oct 9, 2024 · 3 comments · Fixed by #1430
Closed

[bug] update-rules fails for packages created with Release Automation #1429

fukusuket opened this issue Oct 9, 2024 · 3 comments · Fixed by #1430
Assignees
Labels
bug Something isn't working

Comments

@fukusuket
Copy link
Collaborator

fukusuket commented Oct 9, 2024

Describe the bug
update-rules fails for packages created with Release Automation.

Sorry, I did not notice this issue because the rules folder was up to date when I was testing :(
This issue occurs when there is an update to hayabusa_rules repo after the Release Automation Actions are executed.

Step to Reproduce

  1. Download package from https://github.com/Yamato-Security/hayabusa/actions/runs/11233651311
  2. ./hayabusa update-rules

Actual behavior

% ./hayabusa-2.18.0-mac-aarch64 update-rules -q
Start time: 2024/10/09 09:14

[ERROR] Failed to update rules. Error { code: -1, klass: 9, message: "object not found - no match for id (3c2a557667c452d01ed9c869be0d86ee669cb78b)" }

Expected behavior
Successfully updated rules

Environment

  • OS: macOS 15.0.1
  • hayabusa version: 2.18.0-dev

Additional context
I have been deleting unused files under the rules folder in the actions, so that may be the cause ... 🤔

In Integration-test, cargo build --release binaries are used. However, it does not use the release package zip, so it cannot detect this issue. It might be better to also have an Integration-test that uses the release package zip...

@fukusuket fukusuket added the bug Something isn't working label Oct 9, 2024
@fukusuket fukusuket added this to the 2.18.0 Sector Release milestone Oct 9, 2024
@fukusuket fukusuket self-assigned this Oct 9, 2024
@fukusuket fukusuket changed the title [bug] update-rules fails for packages created with release automation [bug] update-rules fails for packages created with Release Automation Oct 9, 2024
@fukusuket
Copy link
Collaborator Author

[ERROR] Failed to update rules. Error { code: -1, klass: 9, message: "object not found - no match for id (3c2a557667c452d01ed9c869be0d86ee669cb78b)" }

The above message matches the following commit hash from this morning
Yamato-Security/hayabusa-rules@3c2a557

@fukusuket
Copy link
Collaborator Author

fukusuket commented Oct 9, 2024

The cause was that only the latest commit in git was available, as shown below.

fukusuke@fukusukenoMacBook-Air ~ % cd Downloads/hayabusa-2.18.0-mac-arm/rules
fukusuke@fukusukenoMacBook-Air rules % pwd
/Users/fukusuke/Downloads/hayabusa-2.18.0-mac-arm/rules
fukusuke@fukusukenoMacBook-Air rules % git log --all
commit 61cc3c153b85132582c923e35d0b67d01927c9de (grafted, HEAD -> main, origin/main)
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Mon Oct 7 20:15:16 2024 +0000

    Sigma Rule Update (2024-10-07  20:15:08) (#735)

    Co-authored-by: hach1yon <[email protected]>
fukusuke@fukusukenoMacBook-Air rules %

To keep all commit history in git, we need to specify fetch-depth: 0 in the following action.
https://github.com/actions/checkout?tab=readme-ov-file#fetch-all-history-for-all-tags-and-branches

I would modify it to specify fetch-depth: 0.

@fukusuket
Copy link
Collaborator Author

After specifying fetch-depth: 0, I confirmed that the commit history is retained.

fukusuke@fukusukenoMacBook-Air Downloads % cd hayabusa-2.18.0-mac-arm/rules
fukusuke@fukusukenoMacBook-Air rules % git log --all
commit a04b2a90be14b7317d1ac8ed1d8c692de573fa1d (HEAD -> main, origin/main)
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Tue Oct 8 21:12:20 2024 +0000

    Sigma Rule Supported Modifier Update (2024-10-08  21:12:14) (#737)

    Co-authored-by: YamatoSecurity <[email protected]>

commit 423ed0cc979f7ca1d6225e64d16c3e067196973c
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Tue Oct 8 20:13:20 2024 +0000

    Sigma Rule Update (2024-10-08  20:13:13) (#736)

    Co-authored-by: hach1yon <[email protected]>

commit 61cc3c153b85132582c923e35d0b67d01927c9de
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Mon Oct 7 20:15:16 2024 +0000

    Sigma Rule Update (2024-10-07  20:15:08) (#735)

    Co-authored-by: hach1yon <[email protected]>

commit 3c2a557667c452d01ed9c869be0d86ee669cb78b
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Sun Oct 6 21:10:53 2024 +0000

    Sigma Rule Supported Modifier Update (2024-10-06  21:10:47) (#734)

    Co-authored-by: YamatoSecurity <[email protected]>

commit b83ba8b3e131b9834d0518b5f17199a95875802d
Merge: 33a181e0 220cae37
Author: Zach Mathis (田中ザック) <[email protected]>
Date:   Sat Oct 5 07:42:53 2024 +0900
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant