Skip to content

fix: enforce const-correctness in indexed_vector#3736

Open
vietcgi wants to merge 1 commit intofalcosecurity:masterfrom
vietcgi:fix/indexed-vector-const-correctness
Open

fix: enforce const-correctness in indexed_vector#3736
vietcgi wants to merge 1 commit intofalcosecurity:masterfrom
vietcgi:fix/indexed-vector-const-correctness

Conversation

@vietcgi
Copy link
Copy Markdown
Contributor

@vietcgi vietcgi commented Nov 12, 2025

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind feature

/kind release

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area build

/area engine

/area tests

/area proposals

/area CI

What this PR does / why we need it:

Const at() methods were returning mutable pointers via const_cast, violating const-correctness.

Solution:

  • Split at() methods into const/non-const overloads
  • Const version returns const T*, non-const returns T*
  • Updated callers to use const pointers where appropriate
  • Removed unsafe const_cast

Changes:

  • indexed_vector.h: Added const/non-const overloads for both at() methods
  • rule_loader_compiler.cpp: Updated helper functions to return const pointers

Verified compilation and all call sites handle const-correctness properly.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Signed-off-by: Kevin Vu <vietcgi@gmail.com>
@poiana
Copy link
Copy Markdown
Contributor

poiana commented Nov 12, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: vietcgi
Once this PR has been reviewed and has the lgtm label, please assign jasondellaluce for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana requested review from Andreagit97 and Kaizhe November 12, 2025 18:28
@github-actions
Copy link
Copy Markdown

This PR may bring feature or behavior changes in the Falco engine and may require the engine version to be bumped.

Please double check userspace/engine/falco_engine_version.h file. See versioning for FALCO_ENGINE_VERSION.

/hold

@poiana
Copy link
Copy Markdown
Contributor

poiana commented Apr 14, 2026

Issues go stale after 90d of inactivity.

Mark the issue as fresh with /remove-lifecycle stale.

Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle stale

@ekoops
Copy link
Copy Markdown
Contributor

ekoops commented May 6, 2026

/remove-lifecycle stale

@ekoops
Copy link
Copy Markdown
Contributor

ekoops commented May 6, 2026

Hey, thank you for this contribution. I took the liberty of restoring the original PR template while keeping your content. Please use it for your next contribution 🙏
I'm gonna close and reopen the PR in order to trigger CI

@ekoops
Copy link
Copy Markdown
Contributor

ekoops commented May 6, 2026

/close

@poiana poiana closed this May 6, 2026
@poiana
Copy link
Copy Markdown
Contributor

poiana commented May 6, 2026

@ekoops: Closed this PR.

Details

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@github-project-automation github-project-automation Bot moved this from Todo to Done in Falco Roadmap May 6, 2026
@ekoops
Copy link
Copy Markdown
Contributor

ekoops commented May 6, 2026

/reopen

@poiana poiana reopened this May 6, 2026
@poiana
Copy link
Copy Markdown
Contributor

poiana commented May 6, 2026

@ekoops: Reopened this PR.

Details

In response to this:

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@github-project-automation github-project-automation Bot moved this from Done to In progress in Falco Roadmap May 6, 2026
@ekoops
Copy link
Copy Markdown
Contributor

ekoops commented May 6, 2026

This PR may bring feature or behavior changes in the Falco engine and may require the engine version to be bumped.

Please double check userspace/engine/falco_engine_version.h file. See versioning for FALCO_ENGINE_VERSION.

/hold

False positive
/hold cancel

@ekoops
Copy link
Copy Markdown
Contributor

ekoops commented May 6, 2026

Hey. Unfortunately, it looks like you need to fix the code formatting. You can configure pre-commit for it: thank to the pre-commit configuration in this repo, it will automatically format your code contextually to commit creation

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

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

3 participants