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
x/sys/windows/registry: ReadSubKeyNames will only work if QUERY_VALUE is passed #23869
Comments
@FluorescentTouch I do not understand your explanation of why ReadSubKeyNames does not work properly. Sorry. Please, provide small program to demonstrate the problem. Run your program, show us its output and tell us what your program should output instead. Thank you |
@alexbrainman here the code is!
Even with ENUMERATE_SUB_KEYS permission i can't enumerate sub keys without more permissions added to this one. This is because first line of ReadSubKeysNames() func:
Stat() function requires QUERY_VALUE permission, and ENUMERATE_SUB_KEYS permission is not enough. Compared to windows registry logic, where u can enumerate subkeys even if read and query_value is not permitted for user. I believe there has to be some different syscall for just enumerating subkeys without reading key value and tehre has to be different function, that doesn not require QUERY_VALUE permission. |
Thank you for explaining. I understand your report now, and I agree that newKey.ReadSubKeyNames could and should work with just ENUMERATE_SUB_KEYS. Would you like to try and fix this yourself? The change would needs to include new test. And also it should adjust all calls to ReadSubKeyNames to have only ENUMERATE_SUB_KEYS if needed. We also need to adjust internal/syscall/windows/registry package in standard library. https://golang.org/doc/contribute.html explains how to contribute. Or you could send PR via Github. If not I will fix this when I have time. Thank you. Alex |
@alexbrainman I'll try to find a fix, and report here in a week if i can do such work. If not, i would notify you. Thank you! |
Sounds like a plan. Alex |
Change https://golang.org/cl/95655 mentions this issue: |
@alexbrainman I dont know how to comment on googlesource.com, so i'll put it there. I'll send another PR to change $GOROOT/src/internal/syscall/windows/registry after this one would be accepted. |
Reopening so we do not forget to do similar changes in $GOROOT/src/internal/syscall/windows/registry. Alex |
Change https://golang.org/cl/97435 mentions this issue: |
@alexbrainman , https://go-review.googlesource.com/c/go/+/97435 PL created for $GOROOT/src/internal/syscall/windows/registry |
What version of Go are you using (
go version
)?1.9
What is wrong (for my opinion)?
package registry
func (Key) ReadSubKeyNames() requires both registry.QUERY_VALUE and registry.ENUMERATE_SUB_KEYS permissions (key.Stat() inside RedSubKeyNames() requires registry.QUERY_VALUE permission).
What did you expect to see?
Because windows has divided rights for QUERY_VALUE and ENUMERATE_SUB_KEYS and possibility to set up one without other, it would be impossible to enum sub keys without QUERY_VALUE permission, even if ENUMERATE_SUB_KEYS permission will be set.
What did you see instead?
Even if i had ENUMERATE_SUB_KEYS permission, but don't have QUERY_VALUE i can't enumerate subkeys of registry key with go registry package.
The text was updated successfully, but these errors were encountered: