Skip to content

fix(misconf): make identifiers in ignore rules case-insensitive#10375

Open
nikpivkin wants to merge 2 commits intoaquasecurity:mainfrom
nikpivkin:fix/ci-ids
Open

fix(misconf): make identifiers in ignore rules case-insensitive#10375
nikpivkin wants to merge 2 commits intoaquasecurity:mainfrom
nikpivkin:fix/ci-ids

Conversation

@nikpivkin
Copy link
Copy Markdown
Contributor

Description

Make identifiers used in ignore rules case-insensitive.

Related issues

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
@nikpivkin nikpivkin added the autoready Automatically mark PR as ready for review when all checks pass label Mar 12, 2026
@github-actions github-actions Bot marked this pull request as ready for review March 12, 2026 05:35
@github-actions github-actions Bot removed the autoready Automatically mark PR as ready for review when all checks pass label Mar 12, 2026
@github-actions github-actions Bot requested a review from simar7 as a code owner March 12, 2026 05:35
@nikpivkin nikpivkin requested review from afdesk and removed request for simar7 April 27, 2026 06:40
Comment thread pkg/iac/ignore/rule.go Outdated
Comment on lines +120 to +121
re := "(?i)^" + strings.ReplaceAll(regexp.QuoteMeta(pattern), "\\*", ".*") + "$"
matched, err := regexp.MatchString(re, input)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

won't it affect on this call?

func workspaceIgnorer(ws string) ignore.Ignorer {
return func(_ types.Metadata, param any) bool {
ignoredWorkspace, ok := param.(string)
if !ok {
return false
}
return ignore.MatchPattern(ws, ignoredWorkspace)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch! Fixed 3d76c16

Comment thread pkg/iac/ignore/rule.go
func MatchPattern(input, pattern string) bool {
matched, err := regexp.MatchString(regexpFromPattern(pattern), input)
re := "(?i)^" + strings.ReplaceAll(regexp.QuoteMeta(pattern), "\\*", ".*") + "$"
matched, err := regexp.MatchString(re, input)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

regexp.MatchString is re-complied too often here, isn't it? maybe should we add ToDo to improve it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added 3d76c16



The ignore rule must contain one of the possible check IDs that can be found in its metadata: ID, short code or alias. The `id` from the metadata is not case-sensitive, so you can specify, for example, `AVD-AWS-0089` or `avd-aws-0089`.
The ignore rule must contain one of the possible check identifiers that can be found in its metadata: ID, long id, or aliases. All of these identifiers are case-insensitive, so you can specify, for example, `AWS-0089`, `aws-0089`, or any combination of upper/lowercase letters.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

won't this be breaking change migrating from short code to long id?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The migration has already been completed and now the short code is in aliases, so this is a fix of outdated documentation.

@nikpivkin nikpivkin requested a review from afdesk April 28, 2026 16:23
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.

bug(misconf): ignore by AVDID became case-sensitive

2 participants