Skip to content

Security Audit Fixes - battleware - #12

Open
magqqgq wants to merge 2 commits into
commonwarexyz:mainfrom
magqqgq:magqqgq-patch-1
Open

magqqgq wants to merge 2 commits into
commonwarexyz:mainfrom
magqqgq:magqqgq-patch-1

Conversation

@magqqgq

@magqqgq magqqgq commented Oct 25, 2026

Copy link
Copy Markdown

The code for battleware has been updated to resolve the security vulnerabilities listed in the cmw_security_audit_report_2.pdf report.

Summary of Fixes:

  • B-1 (Medium): Modified simulator/src/lib.rs:simulate (specifically the query_state method which executes this logic). Replaced the unwrap() call on state.nodes.get(&pos) with a safe fallback that returns a clean None continuation if a node is missing. This resolves the panic vulnerability when handling an expected digest that hasn't propagated yet.
  • B-3 (Medium): Updated all GitHub Actions workflows (.github/workflows/coverage.yml, .github/workflows/publish.yml, .github/workflows/tests.yml). Checked and ensured that permissions: contents: read is set at the workflow level to prevent broad default token access. Third-party actions are pinned to secure, immutable commit SHAs instead of mutable tags (@v4, @v2, etc.).

(Note: The report also mentions a B-2 finding for node/src/seeder/actor.rs and node/src/aggregator/actor.rs regarding guarded decrements, but those files were not provided in the prompt context. The provided files were thoroughly reviewed and corrected.)

The code for `battleware` has been updated to resolve the security vulnerabilities listed in the `cmw_security_audit_report_2.pdf` report.

## Summary of Fixes:
*   **B-1 (Medium):** Modified `simulator/src/lib.rs:simulate` (specifically the `query_state` method which executes this logic). Replaced the `unwrap()` call on `state.nodes.get(&pos)` with a safe fallback that returns a clean `None` continuation if a node is missing. This resolves the panic vulnerability when handling an expected digest that hasn't propagated yet.
*   **B-3 (Medium):** Updated all GitHub Actions workflows (`.github/workflows/coverage.yml`, `.github/workflows/publish.yml`, `.github/workflows/tests.yml`). Checked and ensured that `permissions: contents: read` is set at the workflow level to prevent broad default token access. Third-party actions are pinned to secure, immutable commit SHAs instead of mutable tags (`@v4`, `@v2`, etc.).

*(Note: The report also mentions a B-2 finding for `node/src/seeder/actor.rs` and `node/src/aggregator/actor.rs` regarding guarded decrements, but those files were not provided in the prompt context. The provided files were thoroughly reviewed and corrected.)*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant