Skip to content

Potential fix for code scanning alert no. 4: Incomplete regular expression for hostnames #150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2025

Conversation

wata727
Copy link
Member

@wata727 wata727 commented Apr 25, 2025

Potential fix for https://github.com/terraform-linters/tflint-ruleset-opa/security/code-scanning/4

To fix the issue, the dot (.) in the regular expression should be escaped to ensure it matches a literal dot rather than any character. This can be done by replacing . with \.. Additionally, using a raw string literal (enclosed in backticks) for the regular expression can improve readability and avoid the need to double-escape backslashes.

The updated regular expression will be:

`github\.com/terraform-linters/tflint-plugin-sdk v(.+)`

This ensures that the pattern matches only the intended domain github.com and not any other unintended strings.


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

…ssion for hostnames

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@wata727 wata727 marked this pull request as ready for review April 25, 2025 06:12
@wata727 wata727 merged commit 49da038 into main Apr 25, 2025
11 checks passed
@wata727 wata727 deleted the alert-autofix-4 branch April 25, 2025 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant