Skip to content

Fix: Allow inline comments in .driftignore (#1688)#1741

Open
Mallikarjunadevops wants to merge 1 commit intosnyk:mainfrom
Mallikarjunadevops:fix/driftignore-inline-comments
Open

Fix: Allow inline comments in .driftignore (#1688)#1741
Mallikarjunadevops wants to merge 1 commit intosnyk:mainfrom
Mallikarjunadevops:fix/driftignore-inline-comments

Conversation

@Mallikarjunadevops
Copy link
Copy Markdown

Fixes #1688

Description

This Pull Request fixes the .driftignore parsing engine ignoring inline comments and corrupting trailing strings.

Context

Currently, if a user writes aws_iam_role.baz # created manually, driftctl does not strip the comment unless the line strictly starts with #. This leads to the entire identifier tracking the comment block and silently failing to ignore the resource.

Verification

  • Adjusted string parser block explicitly to evaluate inline # limits during line iterations.
  • Expanded mock test environment in pkg/filter/testdata block to forcefully vet the inline regex stripping.
  • All test vectors validated and standard Golang unit coverage cleared natively.
  • DCO signatures applied correctly.

This patch adds deterministic # indexing processing to strip inline comments prior to validating block depth. Evaluates inline constraints accurately without corrupting matched strings.

Signed-off-by: Mallikarjunadevops <mallikarjunadevops@example.com>
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 4, 2026

CLA assistant check
All committers have signed the CLA.

@snyk-io
Copy link
Copy Markdown

snyk-io bot commented Apr 4, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

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.

.driftignore: Inline comments being ignored

2 participants