Commit graph

74 commits

Author SHA1 Message Date
Eli Peter
6f78f95efb
Create SECURITY.md (#25) 2025-06-28 18:34:22 +02:00
Eli Peter
aedd4a90a1
Potential fix for code scanning alert no. 2: Workflow does not contain permissions (#24)
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2025-06-28 18:18:10 +02:00
elipeter
cc33a9cfd9 chore: Add GPL-3.0 to license list in about.toml 2025-06-28 17:41:47 +02:00
Eli Peter
3c21efba75
Added experimental control flow analysis and syntax classification for rust lang (#22)
* Introduce control flow graph (CFG) support:

- Added `cfg.rs` with CFG generation and analysis utilities.
- Integrated `petgraph` library for graph-based computations.
- Updated `ast.rs` to utilize CFG for function analysis.
- Modified `Cargo.toml` and `Cargo.lock` to include new dependencies.
- Improved static analysis with taint tracking through CFG paths.

* feat: enhance control flow analysis with taint tracking and node labeling

* feat: improve control flow graph with enhanced node handling and new tests

* Remove unnecessary reference marker in `byte_offset_to_point` comment.

* Remove unnecessary reference marker in `byte_offset_to_point` comment.

* Refactor `ast.rs` for performance and clarity; enhance `cfg.rs` with recursive CFG generation and improved classification logic for AST analysis.

* Refactor CFG and taint tracking logic:

- Enhanced `cfg.rs` with inline helper function `text_of` for cleaner UTF-8 handling in AST nodes.
- Expanded `labels.rs` rules with detailed `Sources`, `Sanitizers`, and `Sinks` for improved classification.
- Refined `push_node` to handle method call expressions with object-function pairing.
- Simplified code handling in trivia skipping and debug-only logic.

* Enhance `cfg.rs` with `first_call_ident` helper and improve identifier extraction logic in `push_node`.

* Add targeted CFG taint-tracking tests to enhance analysis coverage.

* Enhance CFG generation with loop expression handling and improve taint tracking logic. Add new sanitization example in `examples/sanitize/example.rs`.

* Update README with installation instructions for Cargo and GitHub releases.

* Expand taint-tracking with precise `def-use` computation and enhance `labels.rs` for detailed classification. Extend `examples/sanitize` with realistic scenarios demonstrating new rules.

* Refactor `labels.rs`:

- Removed redundant `LabelRule` entries for cleaner rule definitions.
- Adjusted matching logic to prioritize suffix and prefix matches effectively.

* Refactor `labels.rs`:

- Removed redundant `LabelRule` entries for cleaner rule definitions.
- Adjusted matching logic to prioritize suffix and prefix matches effectively.

* Add test for taint tracking with multiple sources in `cfg.rs`.

* Add `function_summaries` table and implement summary upsert/load methods. Refactor to handle summary storage and retrieval efficiently, with placeholder clean/drop logic.

* refactor: split `labels.rs` into modular structure with language-specific files

* refactor: split `labels.rs` into modular structure with language-specific files

* refactor: clean up SQL table definitions in `database.rs` for better readability

* refactor: simplify CFG structure by removing lifetime parameters and enhancing taint metadata handling

* refactor: update TODO comments in `cfg.rs` to clarify future enhancements for cap labels and function details

* refactor: remove redundant header from README.md for improved clarity

* feat: add PHF-based syntax classifiers and Kind enum for efficient syntax mapping across languages

* feat: introduce analysis modes for enhanced scanner configuration and diagnostics

* feat: define Kind enum for syntax classification in control flow analysis

* feat: bump version to 0.2.0-alpha and update CHANGELOG for new features and fixes

* refactor: clean up imports and formatting in AST and CFG modules for improved readability

* refactor: simplify function signatures and improve code readability in CFG and module files

* fix: correct rayon_thread_stack_size comment to reflect actual value of 8 MiB

* refactor: update string formatting in clean and project modules for consistency

* refactor: fix indentation in clean.rs for improved readability

---------

Co-authored-by: elipeter <eli.peter@es.fcm.travel>
2025-06-28 17:36:14 +02:00
Eli Peter
fd65360818
Update licensing to GPL-3: (#19)
* Update licensing to GPL-3:

- Changed project license from "MIT OR Apache-2.0" to "GPL-3".
- Added LICENSE file with GNU GPL-3 full text.
- Removed MIT and Apache-2.0 license files from the repository.

* docs: Update license badge in README to reflect GPL v3

* Update Cargo.toml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* docs: updated README.md for new license

* docs: update license information to GPL-3.0 in README and Cargo.toml

---------

Co-authored-by: elipeter <eli.peter@es.fcm.travel>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-25 17:23:31 +02:00
elipeter
cdd89dab4a docs: Update badges in README to reflect crates.io links and license information 2025-06-25 03:56:07 +02:00
elipeter
eb5bd2a244 fix: Update author email in Cargo.toml for consistency 2025-06-25 03:50:27 +02:00
Eli Peter
0366f66b42
Fix/updated binary name (#18)
* feat: Add binary configuration for nyx in Cargo.toml

* fix: Set default binary to nyx in Cargo.toml
2025-06-25 03:46:21 +02:00
Eli Peter
423e6bffd1
fix: Clarify changelog entry for Windows zip command issue in release pipeline (#17) 2025-06-25 03:37:39 +02:00
Eli Peter
ef0a6f80bb
Rename CHANGELOG.MD to CHANGELOG.md (#16) 2025-06-25 02:52:06 +02:00
Eli Peter
238ed095a3
Fix/update release pipeline (#15)
* fix: Enhance release packaging for cross-platform compatibility

* fix: Resolve pipeline bug with zip command on Windows

* fix: Clarify changelog entry for Windows zip command issue in release pipeline

* Update CHANGELOG.MD

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-25 02:49:09 +02:00
Eli Peter
e221fdd7d6
ci: Update license generation command to use output flag for consistency (#14) 2025-06-25 02:37:06 +02:00
elipeter
cd8ae3c47e ci: Update license generation command to use output flag for consistency 2025-06-25 02:26:59 +02:00
elipeter
c6c41bf0ce ci: Update license generation command to use handlebars template 2025-06-25 02:17:01 +02:00
Eli Peter
faf70b9eb6
ci: Update license generation format to use handlebars (#13) 2025-06-25 02:13:28 +02:00
Eli Peter
90fa775a48
docs: Add third-party licenses documentation and update build process (#12) 2025-06-25 02:05:15 +02:00
Eli Peter
9c76fd1e9f
Delete THIRDPARTY-LICENSES.html (#11) 2025-06-25 01:54:23 +02:00
Eli Peter
d50684e31b
docs: Add section on advantages of using Nyx in README (#10)
* docs: Add section on advantages of using Nyx in README

* ci: Update branch references from 'main' to 'master' in CI configuration

* docs: Add third-party licenses documentation and update build process

* Update .github/workflows/release-build.yml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* docs: Add third-party licenses documentation and update build process

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-25 01:42:10 +02:00
elipeter
a614e157b3 ci: Update CI workflow with matrix strategy, security checks, and linting rules adjustments 2025-06-25 00:49:29 +02:00
elipeter
24689be6f7 ci: Add rust-cache action to improve build performance 2025-06-25 00:37:36 +02:00
elipeter
47d4f589af Refactor CI workflow: rename file, update job name, and remove verbose flag from cargo build 2025-06-25 00:33:58 +02:00
elipeter
4872c5acb5 docs: Add initial CHANGELOG with project release history and key updates 2025-06-25 00:31:30 +02:00
elipeter
0efc26d28d chore: Add dual licensing information and contribution guidelines 2025-06-25 00:24:05 +02:00
Eli Peter
72ca7fa45d
test: Add unit tests for index building and scanning functionality (#9) 2025-06-24 23:57:27 +02:00
Eli Peter
46c4732f6e
test: Add unit tests for file handling and configuration merging (#7)
* test: Add unit tests for file handling and configuration merging

* test: Update IO error conversion test to use new error creation method
2025-06-24 23:38:32 +02:00
Eli Peter
8497800b13
test: Add unit tests for config merging and project name sanitization (#6)
* test: Add unit tests for config merging and project name sanitization

* Update src/utils/project.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* test: Update assertion for follow_symlinks in scanner configuration

* test: Fix typo in test function name for project info retrieval

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-24 23:18:01 +02:00
Eli Peter
a0c9d0f9d4
Merge pull request #2 from ecpeter23/bug/fix-max-results
fix: Limit diagnostics output on non indexed scan to a maximum number…
2025-06-24 22:51:30 +02:00
elipeter
a75b6cfabe fix: Remove unnecessary whitespace in diagnostics output handling 2025-06-24 22:51:16 +02:00
elipeter
ebe78b270c fix: Limit diagnostics output on non indexed scan to a maximum number of results based on configuration 2025-06-24 22:44:57 +02:00
elipeter
e309b956c3 Enhance release build workflow with improved binary path resolution and error messaging 2025-06-24 22:28:47 +02:00
elipeter
0876209834 Refactor release build workflow to include OS mapping for targets and improve error handling for binary packaging 2025-06-24 22:26:41 +02:00
elipeter
34e8174003 Add support for aarch64-apple-darwin target and define binary name in release build workflow 2025-06-24 22:22:03 +02:00
elipeter
aecf37163f Add target specification to Rust toolchain setup in release build workflow 2025-06-24 22:14:25 +02:00
elipeter
3d744ae44f Improve release build workflow by adding error handling and dynamic binary path resolution 2025-06-24 22:13:52 +02:00
elipeter
95b934ad39 Add target installation step to release build workflow 2025-06-24 22:05:46 +02:00
elipeter
4bb61aba8b Update default configuration handling and integrate NyxResult into config.rs
- Introduced `DEFAULT_CONFIG_TOML` to simplify default configuration loading.
- Replaced `show_progress` with `quiet` in configuration for improved clarity.
- Refactored `create_example_config` to use `NyxResult` and streamline logic with fallback handling.
- Added `default-nyx.conf` file for default configuration management.
- Enhanced `merge_configs` to include new parameters like `scan_timeout_secs` and `quiet`.
2025-06-24 21:43:26 +02:00
elipeter
14a549ac39 Refactor codebase for consistent indentation and formatting
- Standardized spacing and indentation across multiple modules for improved readability.
- Reorganized `patterns` and `utils` imports for consistency.
- Updated `NyxError` and `NyxResult` related implementations to maintain consistent formatting.
- Enhanced readability in AST patterns for better clarity and maintainability.
2025-06-24 20:27:06 +02:00
elipeter
b3870997d7 Add Ruby AST support using tree-sitter-ruby
- Added `tree-sitter-ruby` dependency to `Cargo.toml` and `Cargo.lock`.
- Introduced `patterns/ruby.rs` with Ruby-specific AST patterns for vulnerability detection.
- Updated `patterns/mod.rs` and `ast.rs` to support Ruby AST parsing and pattern registry initialization.
2025-06-24 18:53:31 +02:00
elipeter
484f4b6d05 Added release-build.yml to automate releases 2025-06-24 18:09:50 +02:00
elipeter
f4544d261e Fixed clippy errors 2025-06-24 18:06:02 +02:00
elipeter
16b469c16f Renamed file.rs to ast.rs to more accurately represent what that code does 2025-06-24 17:56:26 +02:00
elipeter
bd788a8373 Refactor error handling with NyxResult and enhance debugging
- Replaced `Result` with `NyxResult` across the codebase for consistent error management.
- Enhanced `NyxError` with new variants and utility conversions for better flexibility.
- Added detailed `tracing::debug` logs in `file.rs` and `walk.rs` for improved traceability.
- Simplified conditionals and improved path handling in `file.rs`.
- Refined severity filtering logic in `scan.rs`.
2025-06-23 20:59:49 +02:00
elipeter
0a66a0ae2d Add error handling with NyxError and refactor console output formatting
- Introduced `NyxError` and `NyxResult` for unified error handling across modules.
- Refactored `scan.rs`, `index.rs`, and `walk.rs` with improved error management and consistent formatting.
- Replaced existing error handling in `database.rs` with `NyxResult`.
- Improved database maintenance by integrating `vacuum` and `clear` methods into workflows.
- Added `dashmap` for efficient parallel diagnostics result aggregation in `scan_with_index_parallel`.
- Enhanced readability and formatting of console outputs in multiple modules.
2025-06-23 20:27:16 +02:00
elipeter
75a20eaa2a Simplify console output formatting in index.rs by removing redundant characters in success message. 2025-06-23 19:39:38 +02:00
elipeter
17d327a572 Add bytesize and chrono, improve console output formatting
- Added `bytesize` and `chrono` dependencies in `Cargo.toml` and `Cargo.lock` for enhanced size and time formatting.
- Enhanced console output in `list.rs`, `index.rs`, `clean.rs`, and `config.rs` with improved styles for readability.
- Updated file size and modified time formatting across commands using `ByteSize` and `chrono`.
2025-06-23 19:37:19 +02:00
elipeter
47d850843c Format execution time output in seconds instead of milliseconds in main.rs. 2025-06-23 18:27:48 +02:00
elipeter
487ccbba8b Add thiserror and improve console output formatting
- Added `thiserror` dependency in `Cargo.toml` and `Cargo.lock` for enhanced error handling.
- Improved execution time tracking and output formatting in `main.rs`.
- Refactored console output in `scan.rs` for better readability with grouped warnings.
- Simplified error handling in `scan_filesystem`.
2025-06-23 18:25:10 +02:00
elipeter
952e83453a Refactor and simplify code in index.rs, scan.rs, and database.rs
- Removed unnecessary references and improved clarity in `Indexer` method calls.
- Reorganized conditionals and eliminated redundant variable assignments in `scan.rs`.
- Simplified database initialization handling by removing unused commented-out code and improving formatting in `database.rs`.
2025-06-23 17:49:15 +02:00
elipeter
8bc16ac940 Refactor and enhance debugging in walk.rs and scan.rs
- Removed unused commented-out code in `walk.rs` for improved readability.
- Added more `tracing::debug` logs for clearer traceability during file scanning and rule processing.
- Improved condition handling and formatting consistency in `scan.rs`.
- Simplified error management and removed redundant comments in database-related functions.
2025-06-23 17:45:54 +02:00
elipeter
80c0bc9845 Add max_file_size_mb and high_only logic to scanning process:
- Implement `max_file_size_mb` to restrict files for scanning based on size.
- Refactor `high_only` handling to modify `min_severity` in `Config`.
- Update `ScannerConfig` to use `Option<u64>` for optional size limits.
- Remove redundant `high_only` parameter from `scan::handle` function.
- Improve batch processing in `walk` for efficient file scanning.
2025-06-23 16:51:39 +02:00