chore: update gosec
Description
All my changes were merged upstream. Continue using our fork to avoid docker hub rate limiting.
Main impact is a continued reduction in G115 false-negatives and false-positives. We will need to review the new errors before merge.
[!IMPORTANT]
Review skipped
Auto incremental reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
Walkthrough
The pull request introduces several significant updates across multiple files, primarily focusing on enhancing security practices, improving error handling, and refining logging mechanisms. Key changes include updates to the gosec security scanning tool, the introduction of periodic P2P diagnostics, and enhancements to various transaction processing methods. Additionally, comments indicating security considerations have been added to multiple locations, clarifying the intent behind certain code behaviors. Overall, the changes aim to bolster the robustness and clarity of the codebase.
Changes
| File Path | Change Summary |
|---|---|
.github/workflows/sast-linters.yml |
Updated gosec action version; refined nosec_alert job to improve detection/reporting of #nosec annotations; added PR labeling for detected #nosec usages. |
cmd/zetaclientd/p2p_diagnostics.go |
Enhanced RunDiagnostics function with a ticker for periodic peer discovery and communication; improved error handling and logging. |
e2etests/test_bitcoin_std_deposit.go |
Added assertions to TestBitcoinStdMemoDeposit for positive amountSatoshis and retained existing balance checks. |
e2e/runner/setup_solana.go |
Added security comment regarding ChainID assignment. |
pkg/contracts/ton/gateway.go |
Updated parseInbound method to handle operation codes; refined error handling in parseDeposit and parseDepositAndCall. |
pkg/crypto/aes256_gcm.go |
Added comment addressing a false positive in DecryptAES256GCM. |
pkg/memo/codec_compact.go |
Added security comment in packLength method regarding range checks. |
pkg/ticker/ticker.go |
Renamed SecondsFromUint64 to DurationFromUint64Seconds for clarity; added security comment. |
precompiles/logs/logs.go |
Reformatted AddLog function for readability; retained security comment regarding block height. |
precompiles/staking/staking.go |
Enhanced error handling in staking methods; added security comments. |
rpc/backend/node_info.go |
Improved error handling and comments in Syncing and SetEtherbase methods. |
rpc/backend/tx_info.go |
Added comments indicating positive values in GetTransactionReceipt method. |
rpc/namespaces/ethereum/debug/api.go |
Enhanced error handling and added security comments in various profiling methods. |
rpc/types/utils.go |
Updated FormatBlock function to clarify positive value assumptions; added timestamp field. |
scripts/gosec.sh |
Updated Docker image version for gosec tool. |
zetaclient/chains/bitcoin/observer/inbound.go |
Improved error handling and logging in WatchInbound and ObserveInbound methods. |
zetaclient/chains/evm/observer/inbound.go |
Updated ticker interval handling in WatchInbound and related methods. |
zetaclient/chains/evm/observer/outbound.go |
Enhanced logging and error handling in WatchOutbound and ProcessOutboundTrackers. |
zetaclient/chains/ton/observer/inbound.go |
Updated ticker interval handling in watchInbound method. |
zetaclient/orchestrator/orchestrator.go |
Improved error handling and logging in ScheduleCctxSolana and related methods. |
zetaclient/types/dynamic_ticker.go |
Added security comments to NewDynamicTicker and UpdateInterval methods. |
zetaclient/zetacore/client_worker.go |
Added security comment in UpdateAppContextWorker method regarding interval safety. |
Possibly related PRs
- #2912: The addition of the Semgrep workflow is related to the main PR's focus on enhancing security practices, particularly in the context of code scanning and alerting mechanisms.
- #2929: This PR enhances the CI process by uploading SARIF results to the GitHub Security Dashboard, which aligns with the main PR's emphasis on improving security alerting and reporting mechanisms.
Suggested labels
breaking:cli
Suggested reviewers
- fbac
- kingpinXD
- swift1337
- lumtis
- brewmaster012
- skosito
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and generate unit testing code.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
Codecov Report
Attention: Patch coverage is 57.14286% with 9 lines in your changes missing coverage. Please review.
Project coverage is 64.47%. Comparing base (
ef764ae) to head (3ec03d0). Report is 1 commits behind head on develop.
Additional details and impacted files
@@ Coverage Diff @@
## develop #2933 +/- ##
========================================
Coverage 64.47% 64.47%
========================================
Files 412 412
Lines 28976 28985 +9
========================================
+ Hits 18681 18687 +6
- Misses 9512 9515 +3
Partials 783 783
| Files with missing lines | Coverage Δ | |
|---|---|---|
| pkg/contracts/ton/gateway.go | 55.19% <100.00%> (+0.29%) |
:arrow_up: |
| pkg/crypto/aes256_gcm.go | 76.00% <100.00%> (+0.32%) |
:arrow_up: |
| pkg/memo/codec_compact.go | 98.21% <ø> (ø) |
|
| precompiles/logs/logs.go | 77.50% <100.00%> (+0.57%) |
:arrow_up: |
| precompiles/staking/staking.go | 44.97% <100.00%> (+0.16%) |
:arrow_up: |
| zetaclient/chains/bitcoin/observer/inbound.go | 29.70% <ø> (ø) |
|
| zetaclient/chains/evm/observer/outbound.go | 54.54% <100.00%> (+0.11%) |
:arrow_up: |
| zetaclient/orchestrator/orchestrator.go | 23.64% <ø> (ø) |
|
| zetaclient/types/dynamic_ticker.go | 60.86% <66.66%> (-1.04%) |
:arrow_down: |
| zetaclient/zetacore/client_worker.go | 0.00% <0.00%> (ø) |
|
| ... and 3 more |
!!!WARNING!!!
nosec detected in the following files: cmd/zetaclientd/p2p_diagnostics.go, e2e/e2etests/test_bitcoin_std_deposit.go, e2e/runner/setup_solana.go, pkg/contracts/ton/gateway.go, pkg/crypto/aes256_gcm.go, pkg/memo/codec_compact.go, pkg/ticker/ticker.go, precompiles/logs/logs.go, precompiles/staking/staking.go, rpc/backend/node_info.go, rpc/backend/tx_info.go, rpc/namespaces/ethereum/debug/api.go, rpc/types/utils.go, zetaclient/chains/bitcoin/observer/inbound.go, zetaclient/chains/evm/observer/outbound.go, zetaclient/orchestrator/orchestrator.go, zetaclient/types/dynamic_ticker.go, zetaclient/zetacore/client_worker.go
Be very careful about using #nosec in code. It can be a quick way to suppress security warnings and move forward with development, it should be employed with caution. Suppressing warnings with #nosec can hide potentially serious vulnerabilities. Only use #nosec when you're absolutely certain that the security issue is either a false positive or has been mitigated in another way.
Only suppress a single rule (or a specific set of rules) within a section of code, while continuing to scan for other problems. To do this, you can list the rule(s) to be suppressed within the #nosec annotation, e.g: /* #nosec G401 */ or //#nosec G201 G202 G203
Broad #nosec annotations should be avoided, as they can hide other vulnerabilities. The CI will block you from merging this PR until you remove #nosec annotations that do not target specific rules.
Pay extra attention to the way #nosec is being used in the files listed above.