Skip to content

Update IP address regex pattern in hardcoded IP find rule#374

Open
GregJohnStewart wants to merge 2 commits into
konveyor:mainfrom
GregJohnStewart:patch-1
Open

Update IP address regex pattern in hardcoded IP find rule#374
GregJohnStewart wants to merge 2 commits into
konveyor:mainfrom
GregJohnStewart:patch-1

Conversation

@GregJohnStewart

@GregJohnStewart GregJohnStewart commented Mar 26, 2026

Copy link
Copy Markdown

The original IP regex pattern was not as specific; it would trigger on valid dates formatted like yy.mm.dd.MMMMMM.

Summary by CodeRabbit

  • Bug Fixes
    • Improved hardcoded IP address detection rule with stricter pattern matching to reduce false positives and increase accuracy in identifying actual IP address values.

Signed-off-by: Greg Stewart <contact@gjstewart.net>
@coderabbitai

coderabbitai Bot commented Mar 26, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The hardcoded-ip-address rule's regex pattern in the discovery YAML file was updated to use word boundaries and more concise digit notation, improving matching accuracy while maintaining the original "four dot-separated numeric octets" structure.

Changes

Cohort / File(s) Summary
IP Address Detection Pattern
stable/java/00-discovery/0.yaml
Updated builtin.filecontent regex from ([0-9]{1,3}\.){3}[0-9]{1,3} to \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b to enforce word boundaries and use shorthand \d notation for stricter IP address matching.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A hop, a skip, through regex bounds,
Word anchors mark the safest grounds,
No stray IPs shall slip through here,
Just four clean octets, crisp and clear! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updating the IP address regex pattern in the hardcoded IP detection rule, which is the sole modification in this pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@stable/java/00-discovery/0.yaml`:
- Line 37: The builtin.filecontent pattern currently uses an unquoted regex with
unescaped dots; update the pattern value for builtin.filecontent to follow the
repo convention by quoting the regex string and escaping literal dots (e.g.,
replace \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b with a quoted version where each
dot is escaped) so the pattern is a proper quoted/escaped string; locate the
pattern entry for builtin.filecontent in the YAML (the line containing
\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b) and change it to the quoted, escaped
regex form.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 08f70260-fddb-4e18-b717-3484cb796758

📥 Commits

Reviewing files that changed from the base of the PR and between 015bb7a and 4213836.

📒 Files selected for processing (1)
  • stable/java/00-discovery/0.yaml

Comment thread stable/java/00-discovery/0.yaml
@jmle jmle self-requested a review March 30, 2026 08:34

@jmle jmle left a comment

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.

@GregJohnStewart thanks for the contribution! I think it looks good, but I need to double check the rule tests, which are broken atm. I will come back to this asap.

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days.
It will remain open for visibility and reporting purposes.
Please comment if this PR is still relevant.

@github-actions github-actions Bot added the stale label Jun 3, 2026
@GregJohnStewart

Copy link
Copy Markdown
Author

Still relevant

@github-actions github-actions Bot removed the stale label Jun 4, 2026
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.

3 participants