Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Validator] Add additional versions (*_NO_PUBLIC,*_ONLY_PRIV &*_ONLY_RES) in IP address constraint#51777

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Ninos wants to merge32 commits intosymfony:7.1fromNinos:constraints-networking

Conversation

@Ninos
Copy link
Contributor

@NinosNinos commentedSep 28, 2023
edited
Loading

QA
Branch?6.4
Bug fix?no
New feature?yes
Deprecations?no
LicenseMIT

Possibility to allow only private or only reserved ips.

  • Enhancement: Add*_NO_PUBLIC,*_ONLY_PRIV &*_ONLY_RES as possible versions inIp constraint
  • Enhancement: Possibility to use allIp versions inCidr constraint

PS: InIp constraint I changed the default version fromV4 toALL, think it's time to support alsoV6 by default :-) Otherwise we can revert that, but normally should not break much...

…constraintAdded: MAC address constraintChanged: Default version filter from IPv4 to ALL (IPv4 & IPv6)
@carsonbotcarsonbot changed the titleMac address & IP address constraint[Validator] Mac address & IP address constraintSep 29, 2023
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks for the PR. Here are some comments. Changing the defaults look undesired to me since it would change the behavior of existing apps without notice.
Can you also please update the title of your PR so that it can be useful for readers in the auto-generated changelog when doing the release?

@xabbuh
Copy link
Member

I am not convinced that a MAC address validator is a common enough use case to be included in the Symfony core.

Ninosand others added8 commitsOctober 5, 2023 08:11
Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
@NinosNinos changed the title[Validator] Mac address & IP address constraint[Validator] Added mac address constraint & additional versions*_ONLY_PRIV &*_ONLY_RES in IP address constraintOct 5, 2023
@Ninos
Copy link
ContributorAuthor

Thanks for the PR. Here are some comments. Changing the defaults look undesired to me since it would change the behavior of existing apps without notice. Can you also please update the title of your PR so that it can be useful for readers in the auto-generated changelog when doing the release?

Thx for review, merged your commits, reverted your comments & changed title :-)

@stof
Copy link
Member

stof commentedOct 5, 2023

If we want to change the default version, we would have to make it configurable in the validator:

  • make theversion field of the constraint nullable and default tonull
  • configure a default version in the validator (defaulting toV4 for BC reasons), that is used when the constraint version isnull
  • add a configuration setting in FrameworkBundle to configure the default IP version.

But to me, this deserves a separate PR than this one adding new version constants. It deserves to have a separate discussion instead of being bundled in the same decision to merge or no (note that I would have separated the Mac constraint as well, to allow separating the decisions as well).

@fabpotfabpot modified the milestones:6.4,7.1Oct 18, 2023
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM with one comment about naming


self::V4_ONLY_RES,
self::V6_ONLY_RES,
self::ALL_ONLY_RES,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

RES is super cryptic, let's go with the fullRESERVED word

Let's duplicate all consts to add these full-word names as aliases (PRIV also)

@Ninos
Copy link
ContributorAuthor

Seems my responses are still on pending... I'll reply as seperate comment:

I used the same suffix, which was used as filter flag (e.g.FILTER_FLAG_NO_PRIV_RANGE, see also:https://www.php.net/manual/de/filter.filters.flags.php).

Also this constraint already contains constants with_PRIV &_RES suffix, see already existing constant*_ONLY_PRIV:
https://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/Validator/Constraints/Ip.php#L35

We cannot just rename new constants toPRIVATE orRESERVED, this will be inconsistent. We could also rename old constrants to new suffix, but then we need to add additional complexity for backward-compatibility...

@Seb33300
Copy link
Contributor

We cannot just rename new constants toPRIVATE orRESERVED, this will be inconsistent. We could also rename old constants to new suffix, but then we need to add additional complexity for backward-compatibility...

@nicolas-grekas suggested to duplicate all names in his latest comment.

@Ninos
Copy link
ContributorAuthor

@Seb33300@nicolas-grekas@OskarStark renamed & deprecated old constants. Hope it's fine now :-)

@Ninos
Copy link
ContributorAuthor

I've also updatedCidr constraint to use possible versions defined inIp constraint. Please check also :-)

@NinosNinos changed the title[Validator] Add additional versions (*_ONLY_PRIV &*_ONLY_RES) in IP address constraint[Validator] Add additional versions (*_NO_PUBLIC,*_ONLY_PRIV &*_ONLY_RES) in IP address constraintNov 6, 2023
@nicolas-grekas
Copy link
Member

(please rebase, don't merge - you can also squash as we won't keep the history)

@Ninos
Copy link
ContributorAuthor

(please rebase, don't merge - you can also squash as we won't keep the history)

Ok now I have a problem.. :D Give me some min, may I'll create a new branch if possible to retag this MR :/

@Ninos
Copy link
ContributorAuthor

Ninos commentedNov 20, 2023
edited
Loading

@nicolas-grekas I've created a new branch based on 7.1, hope this is fine :( Sry for spamming, I'll try to rebase my mac addresses branch instead :)

See also:#52658

@NinosNinos closed thisNov 20, 2023
@NinosNinos deleted the constraints-networking branchNovember 21, 2023 19:51
nicolas-grekas added a commit that referenced this pull requestJan 2, 2024
… MAC address (Ninos)This PR was merged into the 7.1 branch.Discussion----------[Validator] Add `MacAddress` constraint for validating MAC address| Q             | A| ------------- | ---| Branch?       | 7.1| Bug fix?      | no| New feature?  | yes| Deprecations? | no| License       | MITPossibility to validate against mac address.See also past discussion:#51777Commits-------06ccf62 [Validator] Add `MacAddress` constraint for validating MAC address
fabpot added a commit that referenced this pull requestFeb 3, 2024
…_ONLY_PRIV` & `*_ONLY_RES`) in IP address & CIDR constraint (Ninos)This PR was squashed before being merged into the 7.1 branch.Discussion----------[Validator] Add additional versions  (`*_NO_PUBLIC`, `*_ONLY_PRIV` & `*_ONLY_RES`) in IP address & CIDR constraint| Q             | A| ------------- | ---| Branch?       | 7.1| Bug fix?      | no| New feature?  | yes| Deprecations? | no| License       | MITPossibility to allow no public, only private or only reserved ips.- Enhancement: Add `*_NO_PUBLIC`, `*_ONLY_PRIV` & `*_ONLY_RES` as possible versions in `Ip` constraint- Enhancement: Possibility to use all `Ip` versions in `Cidr` constraintSee also old MR:#51777Commits-------291ef1c [Validator] Add additional versions  (`*_NO_PUBLIC`, `*_ONLY_PRIV` & `*_ONLY_RES`) in IP address & CIDR constraint
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@OskarStarkOskarStarkOskarStark left review comments

+1 more reviewer

@Seb33300Seb33300Seb33300 left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

7.1

Development

Successfully merging this pull request may close these issues.

8 participants

@Ninos@xabbuh@stof@Seb33300@nicolas-grekas@OskarStark@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp