Skip to content
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

feat(openebs): poolname input validation #21277

Merged
merged 3 commits into from Apr 24, 2024

Conversation

ksimm1
Copy link
Contributor

@ksimm1 ksimm1 commented Apr 24, 2024

Description
Adds input validation to the poolname / dataset variable to prevent users entering common invalid paths

  • rejects leading /
  • enforces at least one /
  • rejects backslash \ in the path
  • rejects ix-applications in the path
  • rejects TANK or TANK/ entries

AI Summary of regex pattern
In summary, this regex pattern matches strings that:

  1. Do not contain a backslash (\) anywhere.
  2. Do not contain the substring "ix-applications" anywhere.
  3. Start with one or more characters that are not a forward slash (/).
  4. Followed by one or more occurrences of a forward slash (/) followed by one or more characters that are not a /.

Here are some examples:

Matching examples:

  • hello/world/subdir
  • foo/bar/baz/qux
  • abc/def/ghi/jkl

Non-matching examples:

  • hello\world (contains a backslash)
  • ix-applications/anything (contains the substring "ix-applications")
  • hello/world/ix-applications (contains the substring "ix-applications")
  • /hello/world (starts with a forward slash)

Keep in mind that this regex pattern is quite specific, and it's likely designed to match a specific type of path or directory structure.
⚒️ Fixes #21275

⚙️ Type of change

  • [x ] ⚙️ Feature/App addition
  • 🪛 Bugfix
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🔃 Refactor of current code

🧪 How Has This Been Tested?
Tested via https://regex101.com/r/8aNdeE/1

📃 Notes:

✔️ Checklist:

  • [x ] ⚖️ My code follows the style guidelines of this project
  • [x ] 👀 I have performed a self-review of my own code
  • #️⃣ I have commented my code, particularly in hard-to-understand areas
  • 📄 I have made corresponding changes to the documentation
  • ⚠️ My changes generate no new warnings
  • 🧪 I have added tests to this description that prove my fix is effective or that my feature works
  • [x ] ⬆️ I increased versions for any altered app according to semantic versioning
  • [ x] I made sure the title starts with feat(chart-name):, fix(chart-name): or chore(chart-name):

➕ App addition

If this PR is an app addition please make sure you have done the following.

  • 🖼️ I have added an icon in the Chart's root directory called icon.png

Please don't blindly check all the boxes. Read them and only check those that apply.
Those checkboxes are there for the reviewer to see what is this all about and
the status of this PR with a quick glance.

@ksimm1 ksimm1 requested a review from Ornias1993 as a code owner April 24, 2024 17:53
@Ornias1993 Ornias1993 merged commit e5e6b97 into truecharts:master Apr 24, 2024
15 checks passed
@ksimm1 ksimm1 deleted the openebs-validation branch April 25, 2024 02:53
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.

[openebs] input validation for poolname field
2 participants