-
Notifications
You must be signed in to change notification settings - Fork 388
Disallow logging.conf from elsewhere than the app folder #825
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -137,6 +137,30 @@ def test_logging_configuration(self): | |
| f"Expected ValueError, but logging_configuration={command.logging_configuration}" | ||
| ) | ||
|
|
||
| # logging_configuration raises a value error for an existing absolute path outside the app directory (RCE guard) | ||
| try: | ||
| command.logging_configuration = os.path.join(package_directory, "__init__.py") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TBH I don't understand what this even tests.
Does that test even make sense, if run outside of splunk? Since that is what we do here. |
||
| except ValueError: | ||
| pass | ||
| except BaseException as e: | ||
| pytest.fail(f"Expected ValueError, but {type(e)} was raised") | ||
| else: | ||
| pytest.fail( | ||
| f"Expected ValueError, but logging_configuration={command.logging_configuration}" | ||
| ) | ||
|
|
||
| # logging_configuration raises a value error when a relative path traverses outside the app directory (RCE guard) | ||
| try: | ||
| command.logging_configuration = os.path.join("..", "..", "..", "__init__.py") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add an additional test with an absolute path, one that points to an app dir (success), and the other one that points to a different place (failure). |
||
| except ValueError: | ||
| pass | ||
| except BaseException as e: | ||
| pytest.fail(f"Expected ValueError, but {type(e)} was raised") | ||
| else: | ||
| pytest.fail( | ||
| f"Expected ValueError, but logging_configuration={command.logging_configuration}" | ||
| ) | ||
|
|
||
| def test_logging_level(self): | ||
| rebase_environment("app_without_logging_configuration") | ||
| command = StubbedSearchCommand() | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
filenameis relative here, what will happen? Doesrealpathalways return the absolute path?Docs does not seem to say anything about that:
It only follows symbolic links.