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

Add validation for resource match mode #3414

Merged
merged 1 commit into from
Sep 19, 2023
Merged

Conversation

FloThinksPi
Copy link
Member

@FloThinksPi FloThinksPi commented Aug 29, 2023

If provided, the mode field (resource match object) must be a string. Without this fix a request to /v3/resource_matches with

{ .. "mode": 644 .. }

resulted in an UnknownError. Now the error message

"array contains at least one resource with a non-string mode"

is returned instead.

Furthermore the format is checked and if the provided value is not a POSIX mode string (*), the following error message is returned:

"array contains at least one resource with an incorrect mode"

(*) A simple regex only allowing digits from 0 to 7 is used. At least 1 digit must be provided.

See also #3329 and #3409.

  • I have reviewed the contributing guide

  • I have viewed, signed, and submitted the Contributor License Agreement

  • I have made this pull request to the main branch

  • I have run all the unit tests using bundle exec rake

  • I have run CF Acceptance Tests

If provided, the 'mode' field (resource match object) must be a string.
Without this fix a request to /v3/resource_matches with

  { .. "mode": 644 .. }

resulted in an UnknownError. Now the error message

  "array contains at least one resource with a non-string mode"

is returned instead.

Furthermore the format is checked and if the provided value is not a
POSIX mode string (*), the following error message is returned:

  "array contains at least one resource with an incorrect mode"

(*) A simple regex only allowing digits from 0 to 7 is used. At least 1
digit must be provided.

Co-authored-by: Florian Braun <[email protected]>
@philippthun philippthun force-pushed the fix-mode-posix-permission branch from 6da720a to 0771dda Compare September 18, 2023 14:54
@philippthun philippthun changed the title Increase possible POSIX mode to 6 octets Add validation for resource match mode Sep 18, 2023
@philippthun philippthun marked this pull request as ready for review September 19, 2023 06:59
@philippthun philippthun merged commit 69dfa67 into main Sep 19, 2023
@moleske moleske deleted the fix-mode-posix-permission branch September 19, 2023 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants