Skip to content

fix(engine_function): sanitize ANSI escapes in Prisma severity parsing#627

Merged
Gaviria9601 merged 2 commits intobancolombia:trunkfrom
cjrdz:trunk
Mar 20, 2026
Merged

fix(engine_function): sanitize ANSI escapes in Prisma severity parsing#627
Gaviria9601 merged 2 commits intobancolombia:trunkfrom
cjrdz:trunk

Conversation

@cjrdz
Copy link
Contributor

@cjrdz cjrdz commented Mar 20, 2026

Description

This PR fixes an issue where ANSI escape/control sequences from Prisma/Twistcli output leaked into parsed vulnerability severity values (for example, \x1b[31;1Mcritical). As a result, severity normalization and downstream payload validation could fail in pipeline executions.

The fix adds robust ANSI sanitization during function-scan parsing and normalizes severity values before findings are built, ensuring valid outputs critical/high/medium/low are consistently produced.

Fix

To fix in code/runtime

  • Sanitize scanner text output before field extraction so terminal color/control bytes are removed.
  • Normalize severity values with strip + lower + mapping before building findings.

Checklist:

  • The pull request is complete according to the guide of contributing of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my feature, policy, or fix is effective and works
  • New and existing tests pass locally with my changes

cjrdz added 2 commits March 20, 2026 08:51
Refactor clean_text function to use regex for ANSI escape code removal.
Add ANSI escape code normalization for severity
@Gaviria9601 Gaviria9601 merged commit d62ca12 into bancolombia:trunk Mar 20, 2026
5 checks passed
@app-toolkit-opensource-innersource
Copy link
Contributor

🎉 This PR is included in version 1.144.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants