Title: Validation of Security Groups is wrong · Issue #1054 · stackitcloud/stackit-sdk-python · GitHub
Open Graph Title: Validation of Security Groups is wrong · Issue #1054 · stackitcloud/stackit-sdk-python
X Title: Validation of Security Groups is wrong · Issue #1054 · stackitcloud/stackit-sdk-python
Description: Invalid validation rule for security group We have a validation rule in place that checks for the correct name of a security group. It does not allow consecutive special characters in a name that is actually valid: cls.pydantic_validator...
Open Graph Description: Invalid validation rule for security group We have a validation rule in place that checks for the correct name of a security group. It does not allow consecutive special characters in a name that i...
X Description: Invalid validation rule for security group We have a validation rule in place that checks for the correct name of a security group. It does not allow consecutive special characters in a name that i...
Opengraph URL: https://github.com/stackitcloud/stackit-sdk-python/issues/1054
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Validation of Security Groups is wrong","articleBody":"## Invalid validation rule for security group\n\nWe have a validation rule in place that checks for the correct name of a security group. It does not allow consecutive special characters in a name that is actually valid:\n\ncls.__pydantic_validator__.validate_python(\\npydantic_core._pydantic_core.ValidationError: 1 validation error for SecurityGroup\\nname\\n \nValue error, must validate the regular expression /^[A-Za-z0-9]+((-|_|\\\\s|\\\\.)[A-Za-z0-9]+)*$/ [type=value_error, input_value='Nagios Monitoring - NRPE', input_type=str]\n\nThe problem is, that a space, dash and another space in a row are correct, but maybe two spaces are not. Either the regex needs to be more specific or is should be deleted. \n\n## Steps to reproduce\nThe error is in the class iaas/models/security_group.py\n\n```python\n @field_validator(\"name\")\n def name_validate_regular_expression(cls, value):\n \"\"\"Validates the regular expression\"\"\"\n if not re.match(r\"^[A-Za-z0-9]+((-|_|\\s|\\.)[A-Za-z0-9]+)*$\", value):\n raise ValueError(r\"must validate the regular expression /^[A-Za-z0-9]+((-|_|\\s|\\.)[A-Za-z0-9]+)*$/\")\n return value\n```\n\nthe security groups cannot even be loaded:\n\n```python\n def __get_security_groups(self, client: DefaultApi, uuid: UUID) -\u003e List[StackitSecurityGroup]:\n security_groups = client.list_security_groups(uuid)\n```\n\n## Actual behavior\n\nRaises an exception on valid security names\n\n## Expected behavior\n\nRaise only an exception on invalid security group name\n\n## Environment\n - OS: Mac\n - Python version (see `python --version`): `Python 3.9.4`\n - Version of the Python STACKIT SDK: 4.5.0\n\nUnfortunately I could not find the check Openstack is implementing in its code and validation ...\nMaybe it is also not in the responsibility of this class to check weather the name complies with a certain pattern as the Openstack Neutron server will raise a 4xx error when the name is not correct (e.g., too long, already taken, etc) in any case. Maybe we want to rely on what Openstack says to the name (or any other field, or even on any other resource). Maybe we will not be able to keep up with changes on the server side.\n\n\nUps, now I see this bug: https://github.com/stackitcloud/stackit-sdk-python/issues/790\nSame problem, different Openstack resource\nAgain, maybe not the responsibility of this lib to check for the validity of the names, esp. not when reading only the resources","author":{"url":"https://github.com/wuppermann","@type":"Person","name":"wuppermann"},"datePublished":"2025-05-06T15:02:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1054/stackit-sdk-python/issues/1054"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1b135221-97a4-9b3a-de84-9da392bfc698 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C72C:AD316:2937A:35014:6981B4B9 |
| html-safe-nonce | 7dad0a78bc8187277d64107a083f5b4598ba461f928e69020d8a5ae12c36c4ff |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNzJDOkFEMzE2OjI5MzdBOjM1MDE0OjY5ODFCNEI5IiwidmlzaXRvcl9pZCI6IjcxMjM0NjQ3MDk3MzAzMTc0OTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 982037141ad178755d7fba2cd6da86b454553b3f01ff84b632f29d9925b8122c |
| hovercard-subject-tag | issue:3043142685 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/stackitcloud/stackit-sdk-python/1054/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7501ed8b46df3bd5d019b9bc4b48b4c8303bd043ca4066c37afda3d69d72daaf/stackitcloud/stackit-sdk-python/issues/1054 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7501ed8b46df3bd5d019b9bc4b48b4c8303bd043ca4066c37afda3d69d72daaf/stackitcloud/stackit-sdk-python/issues/1054 |
| og:image:alt | Invalid validation rule for security group We have a validation rule in place that checks for the correct name of a security group. It does not allow consecutive special characters in a name that i... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | wuppermann |
| hostname | github.com |
| expected-hostname | github.com |
| None | e137814e266030874fd2c86863529d0622b13889eeda04148c57654b6ea84ad6 |
| turbo-cache-control | no-preview |
| go-import | github.com/stackitcloud/stackit-sdk-python git https://github.com/stackitcloud/stackit-sdk-python.git |
| octolytics-dimension-user_id | 55577607 |
| octolytics-dimension-user_login | stackitcloud |
| octolytics-dimension-repository_id | 872376182 |
| octolytics-dimension-repository_nwo | stackitcloud/stackit-sdk-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 872376182 |
| octolytics-dimension-repository_network_root_nwo | stackitcloud/stackit-sdk-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | dd58d68a7813bbec9c91422c8c35f4af33832d70 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width