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

Update CryptKey.php #901

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Update CryptKey.php #901

wants to merge 2 commits into from

Conversation

ShyZhen
Copy link

@ShyZhen ShyZhen commented May 17, 2018

当我在windows环境下测试的时候,它报错,虽然我知道他不应该在windows下跑。
这是我的原始问题:laravel/passport#712
我需要一些建议,谢谢。


When I tested in the windows environment, it was wrong, though I knew he should not run under windows.
This is my original question: laravel/passport#712
I need some advice, thank you.

当我在windows环境下测试的时候,它报错,虽然我知道他不应该在windows下跑。
这是我的原始问题:laravel/passport#712
我需要一些建议,谢谢。

-----
When I tested in the windows environment, it was wrong, though I knew he should not run under windows.
This is my original question: laravel/passport#712
I need some advice, thank you.
@simonhamp
Copy link

@ShyZhen I don't think this is the right approach. fileperms() should still work correctly on Windows systems and this is an important security measure to make sure that your keys aren't accessible by outside parties.

You should adjust your file permissions correctly. The desired permissions roughly translate to "read & write for user and/or group".

I'm going to close this PR, but happy to help try and solve this with you if you can share what the value of $keyPathPerms = decoct(fileperms($keyPath) & 0777); is for you.

@simonhamp simonhamp closed this May 17, 2018
@Sephster
Copy link
Member

Sephster commented May 17, 2018

I don't think fileperms() is reliable on Windows and is only really viable on Unix systems. This is one of the reasons we only issue a notice. I must admit though, I haven't been able to find much documentation on this and don't have a Windows machine to hand at the moment to test this.

If it is the case that Windows servers can't be relied upon for fileperms() as I suspect, we might need to see if we can have a work around or exemption.

This was discussed in another issue. It was noted there that if you use an instance of CryptKey, you shouldn't need to worry about this.

This information might be of use to you @ShyZhen so I would recommend looking through the previous issue raised.

I will try and have a look at this properly tonight but we might need to reopen this issue as multiple people have reported problems with Windows servers and this check.

If anyone has a reliable source for how fileperms() works on Windows it would be appreciated if you could share.

Edit: Just remembered I have a Windows VM so can check this

@ShyZhen
Copy link
Author

ShyZhen commented May 19, 2018

Hi, 谢谢您的答复,我认为用Windows进行权限管理其实是很难的一件事,我一般都使用Windows进行开发,最终程序跑在Linux;我一直在尝试,怎样把我的文件权限改成600,但是,我试过了很多方法,找了很多资料,她依然是666,在我眼里Windows并不适合做权限管理。不过这只是我的一面之词,因为我也很无知,我也在追求真理。谢谢阅读。


Hi, thanks for your reply, I think it's very difficult to use Windows to manage permission, I usually use Windows for development, and the final program runs in Linux; I've been trying to change my file rights to 600, but I tried a lot of methods and found a lot of information, she was still 666, In my opinion
Windows is not suitable for permission management. It's statement of only one of the parties, because I am also ignorant, and I am also seeking truth. Thank you for reading.

@Sephster
Copy link
Member

Reopening this issue. I've not had chance to test this yet but suspect that @ShyZhen is right, and we need to re-evaluate this for Windows users

@Sephster Sephster reopened this May 31, 2018
@marcharding
Copy link

Hey, i just stumbled upon this very problem.

If oauth2-server is not used directly but as a dependency, it is not going to work on windows (if used directly one can just the the $keyPermissionsCheck flag, so that is not a problem).

I dug a little bit deeper and there is no way to get a windows php to return 600, so it would be great if this could be merged.

Why will windows never return 600?

Take a look here:

https://github.com/php/php-src/blob/master/ext/standard/php_filestat.h#L23

The S_**USR, S_**GRP and S_**OTH all get the same value S_IREAD, S_IWRITE and S_IEXEC which is what you get on windows. So you will always get 666, 444 etc. but never 600.

@marcharding
Copy link

marcharding commented Jul 20, 2020

Any news here? Should i open a new pull request?

@Sephster
Copy link
Member

No update on this yet. I am leaning towards removing these checks but am torn. I need to take a look at the history of this being introduced. We will either implement this PR or remove the checks entirely. Thank you for the offer of a new PR but at this time, it is not required. Cheers

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.

4 participants