Feat/9 add report command to scan generate json and html reports#10
Conversation
- Revised the README.md to reflect new features in the `solsec scan` command, including default JSON and HTML output, and options for generating specific formats (JSON, HTML, Markdown, CSV). - Updated CLI command definitions to support multiple output formats and added flags for generating only JSON or HTML outputs. - Removed the legacy report command from the CLI, streamlining the command structure. These changes improve user experience and clarify the capabilities of the solsec tool.
…e.json - Updated version number from 0.1.5 to 0.1.6 across Cargo.toml, Cargo.lock, and UI package.json. - Adjusted version reference in the application to ensure consistency in versioning throughout the project. These changes maintain versioning accuracy across the project.
🛡️ Security Scan Results
|
- Added badges for version, downloads, license, and Rust edition to the README.md. - Enhanced the README to provide quick access to important project metrics and information. These updates improve the documentation and make key project details more accessible to users.
- Updated the README.md to enhance clarity in the usage instructions for the `solsec scan` command, specifying that it generates both JSON and HTML outputs. These changes improve the documentation and user understanding of the command's functionality.
- Updated the README.md to improve clarity in the usage instructions for the `solsec scan` command, specifically removing redundant phrases and enhancing readability. - Adjusted descriptions for JSON and HTML output options to streamline user understanding. These changes enhance the documentation and provide clearer guidance on the command's functionality.
🛡️ Security Scan Results
|
🛡️ Security Scan Results
|
There was a problem hiding this comment.
Bug: Output Filename Overwrite Bug
When multiple output formats are requested and a specific output filename with an extension is provided (e.g., --output report.json), all formats are incorrectly written to the same file. This occurs because the output.clone() logic is applied to every format in the loop when an extension is detected, rather than generating unique filenames for subsequent formats. Consequently, each subsequent report overwrites the previous one, leading to data loss where only the last generated report is preserved. For example, solsec scan --output results.json --format json,html will result in only the HTML report being saved to results.json.
src/cli.rs#L116-L128
Lines 116 to 128 in 9dd3ce1
Bug: Conflicting CLI Flags Lead to Unintuitive Behavior
The json_only and html_only CLI flags do not conflict with each other, allowing users to specify both simultaneously. When both are provided, the json_only flag takes precedence, resulting in only JSON output, which is unintuitive. These flags should be mutually exclusive.
src/cli.rs#L41-L47
Lines 41 to 47 in 9dd3ce1
Was this report helpful? Give feedback by reacting with 👍 or 👎
🛡️ Security Scan Results
|
This pull request introduces several updates to the Solana Smart Contract Security Toolkit (
solsec) to enhance functionality, simplify workflows, and improve user experience. The most significant changes include the removal of thesolsec reportcommand, updates to thesolsec scancommand to support multiple output formats, and corresponding adjustments to the CLI, documentation, and CI workflow.CLI and Command Enhancements:
solsec reportcommand and integrated its functionality directly into thesolsec scancommand, which now supports generating multiple output formats (e.g., JSON, HTML, Markdown, CSV) simultaneously. Added new flags--json-onlyand--html-onlyfor convenience. (src/cli.rs: [1] [2] [3] [4]Documentation Updates:
README.mdto reflect the removal of thesolsec reportcommand and to document the new multi-format capabilities ofsolsec scan. Added examples for generating JSON and HTML outputs independently or together. (README.md: [1] [2] [3]CI Workflow Changes:
solsec reportstep with the enhancedsolsec scancommand, which now directly generates all required output formats. (.github/workflows/ci.yml: .github/workflows/ci.ymlL88-R95)Codebase Refactoring:
generate_from_directorymethod and related logic from theReportGeneratorclass, as it is no longer needed with the updatedsolsec scancommand. (src/report.rs: [1] [2]Version Bumps:
solseccrate and thesolsec-uipackage to0.1.6to reflect these changes. (Cargo.toml: [1]ui/package.json: [2]ui/src/App.tsx: [3]