Skip to content

Conversation

@cx-rui-oliveira
Copy link
Contributor

@cx-rui-oliveira cx-rui-oliveira commented May 7, 2025

Proposed Changes

  • Separate secret detection logic for filesystem plugin
    • Chunking when the processed file is larger than 10 MB (with peeking so as not to lose the context of the secrets);
    • Weighted semaphore to control the use of memory (with a dynamic budget, i.e., dependent on the host's RAM).

Checklist

  • I covered my changes with tests.
  • I Updated the documentation that is affected by my changes:
    • Change in the CLI arguments
    • Change in the configuration file

@cx-rui-oliveira cx-rui-oliveira changed the title Ast 79069 improve memory consumption in 2 ms file walk perf: improve memory consumption in 2ms file walk May 7, 2025
@github-actions
Copy link

github-actions bot commented May 8, 2025

kics-logo

KICS version: v1.7.13

Category Results
HIGH HIGH 0
MEDIUM MEDIUM 0
LOW LOW 0
INFO INFO 0
TRACE TRACE 0
TOTAL TOTAL 0
Metric Values
Files scanned placeholder 11
Files parsed placeholder 11
Files failed to scan placeholder 0
Total executed queries placeholder 53
Queries failed to execute placeholder 0
Execution time placeholder 1

@github-actions
Copy link

github-actions bot commented May 8, 2025

Logo
Checkmarx One – Scan Summary & Details1ebce5bf-6ac3-48aa-be12-0196b419ef01

Great job, no security vulnerabilities found in this Pull Request

@cx-rui-oliveira cx-rui-oliveira marked this pull request as ready for review May 12, 2025 14:29
@cx-rui-oliveira cx-rui-oliveira requested a review from a team as a code owner May 12, 2025 14:29
Copy link
Contributor

@cx-rogerio-dalot cx-rogerio-dalot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have a package under engine, something like engine/semaphore. We can have all the logic there that handles everything related to the weights and memory (including the one in cmd/memory).

In cmd we can then handle the DI of the semaphore by injecting it on the engine instance. It is in the end, the semaphore that knows which memory budget to allocate and how to handle the weights, and the engine, that should operate and depend on the semaphore.

WDYT?

@cx-rui-oliveira
Copy link
Contributor Author

I think we should have a package under engine, something like engine/semaphore. We can have all the logic there that handles everything related to the weights and memory (including the one in cmd/memory).

In cmd we can then handle the DI of the semaphore by injecting it on the engine instance. It is in the end, the semaphore that knows which memory budget to allocate and how to handle the weights, and the engine, that should operate and depend on the semaphore.

WDYT?

It makes perfect sense, it is a cleaner and more modular approach.

@cx-rui-oliveira cx-rui-oliveira force-pushed the AST-79069-improve-memory-consumption-in-2-ms-file-walk branch from afc7d7d to b3d896e Compare May 21, 2025 12:10
@cx-rogerio-dalot
Copy link
Contributor

Awesome work 🎉

@cx-rui-oliveira cx-rui-oliveira merged commit c1df497 into master May 22, 2025
11 checks passed
@cx-rui-oliveira cx-rui-oliveira deleted the AST-79069-improve-memory-consumption-in-2-ms-file-walk branch May 22, 2025 11:47
cx-rogerio-dalot pushed a commit that referenced this pull request Sep 11, 2025
**Proposed Changes**

- Separate secret detection logic for filesystem plugin
- Chunking when the processed file is larger than 10 MB (with peeking so
as not to lose the context of the secrets);
- Weighted semaphore to control the use of memory (with a dynamic
budget, i.e., dependent on the host's RAM).

**Checklist**

- [x] I covered my changes with tests.
- [ ] I Updated the documentation that is affected by my changes:
  - [ ] Change in the CLI arguments
  - [ ] Change in the configuration file

---------

Co-authored-by: cx-leonardo-fontes <[email protected]>
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.

3 participants