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

Revert "Add validation for resource match mode" #3409

Merged
merged 1 commit into from
Aug 31, 2023
Merged

Conversation

FloThinksPi
Copy link
Member

This reverts commit 22e2122 due to the mode limitation to 3-4 characters beeing against the POSIX Standard as it defines 9 permission bits and 3 file bits with no limit for more bits. As the documentation is not specific on the further limitations the currently implemented validation is incorrect.

See also:
https://en.wikipedia.org/wiki/Unix_file_types#Numeric
https://pubs.opengroup.org/onlinepubs/9699919799/

  • Links to any other associated PRs

#3329

  • 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

This reverts commit 22e2122
due to the mode limitation to 3-4 characters beeing against the POSIX
Standard as it defines 9 permission bits and 3 file bits with no limit
for more bits. As the documentation is not specific on the further
limitations the currently implemented validation is incorrect.

See also:
https://en.wikipedia.org/wiki/Unix_file_types#Numeric
https://pubs.opengroup.org/onlinepubs/9699919799/
@FloThinksPi
Copy link
Member Author

FloThinksPi commented Aug 24, 2023

Findings on the API:

  1. The API Docs specify the mode shall be a POSIX file mode(could be more strict enforced in the docs)[1]
  2. The POSIX standard does not define a maximum length of file permission bits. However it defines the type mode must at least be 12 bits of permissions and 4 bits for the file type which makes it 16 bits(6 octal digits). Writing can be shortened to smaller than 3 digits too. [2] [3]

That means e.g. POSXI Permissions 100700 = 0700 = 07.
That in return means the implementation of the API is incorrect and the Java Client is correct in supplying 16bit mode flag.
At least when it comes to the CF API Docs and one follows them strictly. It doesnt make sense of course since the first 4 bits define the File Type which doesn't make sense here but since the API doc just says POSIX compliant mode there is nothing wrong with supplying a 16bit mode and letting the api ignore the 4 file type bits. Also suppling 2 digit long file permissions would fail now but looks like those are also valid POSIX permission values for mode.

@FloThinksPi
Copy link
Member Author

Closed in favour of #3414

@FloThinksPi
Copy link
Member Author

Lets do a revert for the short term fix, we are not sure how exactly the forward code fix should look like, likely needs more time and this should be gone in the next capi release for sure.

@svkrieger svkrieger self-requested a review August 31, 2023 07:58
Copy link
Contributor

@svkrieger svkrieger left a comment

Choose a reason for hiding this comment

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

Makes sense to revert it for now and implement a more loose validation, to not break officially supported clients.

@FloThinksPi FloThinksPi merged commit 79745ad into main Aug 31, 2023
@FloThinksPi FloThinksPi deleted the revert-mode-checks branch August 31, 2023 08:18
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.

3 participants