-
Notifications
You must be signed in to change notification settings - Fork 307
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
Bug: Accessing Rego Policies from Different Drives in Windows #979
Comments
conftest project version used |
hi @pckvcode Very nice find! The corresponding code block seems to be added from the very beginning of the OPA: https://github.com/open-policy-agent/opa/pull/176/files With the current form, I can verify it ignores the C as the following: example.com:C:/foo/bar It should normally be able to open files using different drivers intuitively, so +1 from my side, though we need to check this strictly in unit tests-e2e to make sure it doesn't break any of the core features under the hood Feel free to propose a PR containing multiple cases for unit-tests to OPA, and feel free to ping us in the PR to review Thanks for your investigations |
…ther drives in Windows. For more details, see open-policy-agent#6910 and open-policy-agent/conftest#979. OPA should be capable of accessing Rego policies from specified paths including drives (e.g., c:\a\b\c.rego). The code has been updated to allow OPA to load Rego policies from paths with drives. Now, OPA can load Rego policies from paths, URLs, and drives. Fixes open-policy-agent#6910 Signed-off-by: pckvcode <[email protected]>
Earlier, there was an issue with loading policies using the path However, we're now encountering an issue with loading the
I've attached screenshots of the errors. Command used: .\conftest.exe test C:/Users/pck/Punith/test_files/config.yaml --policy file:///C:/Users/pck/Punith/test_files/policy --data C:/Users/pck/Punith/test_files/data.yaml Steps to reproduce:
It seems there may be an issue with how data files are loaded. Could we apply the same logic used for loading policy files here to loading data files here?
More details: |
@boranx |
Conftest encounters errors on Windows when loading file paths that include drive letters (e.g., `C:/path/to/data.yaml`). Even when using a file URL (e.g., `file:///C:/path/to/data.yaml`), we still face issues. With these code changes, Conftest can now successfully load files using a file URL (e.g., `file:///C:/path/to/data.yaml`). We opted for file URLs instead of paths with drive letters (e.g., `C:/path/to/data.yaml`) because OPA does not support file paths with drive letters. For more details, see [this issue comment](open-policy-agent/opa#6922 (comment)). Resolves: open-policy-agent#979 Signed-off-by: Punith C K <[email protected]>
… file:///C:/path/to/data.yaml) on windows Conftest encounters errors on Windows when loading file paths that include drive letters (e.g., C:/path/to/data.yaml). Even when using a file URL (e.g., file:///C:/path/to/data.yaml), we still face issues. We opted for file URLs(e.g., file:///C:/path/to/data.yaml) instead of paths with drive letters (e.g., C:/path/to/data.yaml) because OPA does not support file paths with drive letters. Resolves open-policy-agent#979
… file:///C:/path/to/data.yaml) on windows Conftest encounters errors on Windows when loading file paths that include drive letters (e.g., C:/path/to/data.yaml). Even when using a file URL (e.g., file:///C:/path/to/data.yaml), we still face issues. We opted for file URLs(e.g., file:///C:/path/to/data.yaml) instead of paths with drive letters (e.g., C:/path/to/data.yaml) because OPA does not support file paths with drive letters. Resolves open-policy-agent#979 Signed-off-by: Punith C K <[email protected]>
… file:///C:/path/to/data.yaml) on windows Conftest encounters errors on Windows when loading file paths that include drive letters (e.g., C:/path/to/data.yaml). Even when using a file URL (e.g., file:///C:/path/to/data.yaml), we still face issues. We opted for file URLs(e.g., file:///C:/path/to/data.yaml) instead of paths with drive letters (e.g., C:/path/to/data.yaml) because OPA does not support file paths with drive letters. Resolves open-policy-agent#979 Signed-off-by: Punith C K <[email protected]>
bug: Accessing Rego Policies from Different Drives in Windows
Not able to access Rego policies from another drive in Windows. Error occurs while integrating with Golang.
Example: If
go-binary/main.go
is in the D drive and tries to access Rego policies located in the C drive (or vice-versa), an error occurs:OPA loader should identify Windows C, D drives and load files.
Quick Fix
Short Description
Steps To Reproduce
Expected Behavior
Code should be able to load Rego policies from other drives (C, D, or E drives) in Windows.
Additional Context
Bug in code: opa/loader.go#L575
Current:
New:
Description: It should not separate the prefix if it detects C/D/E drives.
New test case to be added: opa/loader_test.go#L825
The text was updated successfully, but these errors were encountered: