-
-
Notifications
You must be signed in to change notification settings - Fork 260
feat: add support for changing docker labels via application api #1939
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
Closed
Closed
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2254c38
Docker labels
m41denx 12053f7
Rename $payload to $attributes
m41denx 13814b8
Ignore falsy docker_labels
m41denx 785124a
Prevent docker labels from being a flat array and therefore having em…
m41denx 3a401a5
Added docker labels validation
m41denx 70ae7e9
Validate Docker labels rule
m41denx a5350c2
Fix pint and phpstan errors
m41denx 321e9fe
Update regex
m41denx 605b3e7
Return "required" validator
m41denx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Regex validates values instead of keys.
Laravel's
docker_labels.*syntax validates array VALUES, not KEYS. Given input{"docker_labels": {"my.label": "myvalue"}}, the regex on line 35 validates"myvalue", not"my.label". This means:"Com.Docker.test","123numeric") pass validationTo validate keys, implement a custom validation rule:
Then update the validation rules:
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uhh, I'll wait for maintainers response, I have little idea how laravel works besides basic http contracts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
💡 Result:
Short answer: array.* validates the array's values (each element), not the keys. Use the array rule (or Rule::array / array:keys) to restrict allowed keys or the newer in_array_keys/required_array_keys rules to require specific keys. [1][2][3]
Examples:
Sources:
[1] Laravel Validation — array rule (allowed keys).
[2] Laravel Validation — validating nested arrays / wildcard (items.* example).
[3] Laravel News / docs — in_array_keys / required_array_keys additions.
@m41denx I can confirm that CodeRabbit's finding is correct. In Laravel, the
docker_labels.*syntax validates the values of your array, not the keys.So with this input:
{ "docker_labels": { "COM.DOCKER.test": "some-value", "123invalid": "another-value" } }Your current validation would check if
"some-value"and"another-value"match the Docker key regex (which they won't, but for the wrong reason). The actual keys ("COM.DOCKER.test"and"123invalid") aren't validated at all, even though they violate Docker's naming rules.Two approaches to fix this:
withValidator()- quick fix without new files:Totally understand waiting for maintainer input on the approach! Let me know if you'd like help implementing either solution once you get direction. 👍
🧠 Learnings used