Skip to content

Potential fix for code scanning alert no. 4: Polynomial regular expression used on uncontrolled data - #292

Open
Exohayvan wants to merge 1 commit into
mainfrom
alert-autofix-4
Open

Potential fix for code scanning alert no. 4: Polynomial regular expression used on uncontrolled data#292
Exohayvan wants to merge 1 commit into
mainfrom
alert-autofix-4

Conversation

@Exohayvan

Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/AetherMesh-AI/aethermesh-core/security/code-scanning/4

The best fix is to make the secret-assignment separator whitespace possessive so the regex engine cannot repeatedly repartition user-controlled whitespace while searching for a value.

Concretely, in src/aethermesh_core/local_audit_event.py, the two \s* quantifiers surrounding the : or = separator in _SECRET_IN_TEXT are changed to Python 3.11+ possessive quantifiers. This preserves redaction of quoted and unquoted secret values while eliminating the backtracking path reported by CodeQL.

A regression test locks the separator quantifiers to the non-backtracking form. No API, audit schema, or persisted file-format changes are required.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

@Exohayvan
Exohayvan marked this pull request as ready for review July 23, 2026 02:07
@Exohayvan Exohayvan added type:bug Type: bug or broken behavior. priority:P2 Priority P2: high-impact near-term work. system:runtime System: local node runtime/service lifecycle. area:audit-log Area: generated triage label for audit log. area:audit-logging Area: generated triage label for audit logging. risk:medium Risk: changes existing working behavior with moderate regression risk. needs:review Needs: generated triage label for review. labels Jul 23, 2026
@Exohayvan Exohayvan added status:ready Human-readable workflow status: ready for the next review or merge step. status:in-review Human-readable workflow status: under review. status:blocked Human-readable workflow status: blocked by a failing gate or dependency. and removed needs:review Needs: generated triage label for review. status:ready Human-readable workflow status: ready for the next review or merge step. status:in-review Human-readable workflow status: under review. labels Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:audit-log Area: generated triage label for audit log. area:audit-logging Area: generated triage label for audit logging. priority:P2 Priority P2: high-impact near-term work. risk:medium Risk: changes existing working behavior with moderate regression risk. status:blocked Human-readable workflow status: blocked by a failing gate or dependency. system:runtime System: local node runtime/service lifecycle. type:bug Type: bug or broken behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant