From f7164a967786c045a9d12546633e933edfe7203b Mon Sep 17 00:00:00 2001 From: Matt Schwager Date: Tue, 3 Mar 2020 08:22:21 -0700 Subject: [PATCH 1/4] Fix #309, avoid catastrophic backtracking in searchcommands.internals --- splunklib/searchcommands/internals.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/splunklib/searchcommands/internals.py b/splunklib/searchcommands/internals.py index 9a2a4e9e2..3ccecc40a 100644 --- a/splunklib/searchcommands/internals.py +++ b/splunklib/searchcommands/internals.py @@ -232,7 +232,7 @@ def replace(match): _escaped_character_re = re.compile(r'(\\.|""|[\\"])') - _fieldnames_re = re.compile(r"""("(?:\\.|""|[^"])+"|(?:\\.|[^\s"])+)""") + _fieldnames_re = re.compile(r"""("(?:\\.|""|[^"\\])+"|(?:\\.|[^\s"])+)""") _options_re = re.compile(r""" # Captures a set of name/value pairs when used with re.finditer From 65aceadce95e91b967942581eaf3bb1bf03882fc Mon Sep 17 00:00:00 2001 From: Tim Pavlik Date: Thu, 28 Jan 2021 20:21:21 -0800 Subject: [PATCH 2/4] Fix duplicate TOC in Sphinx docs and automate bundling of docs with new 'make docs' command --- Makefile | 8 ++++++++ docs/index.rst | 13 ------------- tox.ini | 10 ++++++++-- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 598bdea99..938166231 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,14 @@ build_app: @echo "$(ATTN_COLOR)==> build_app $(NO_COLOR)" @python setup.py build dist +.PHONY: docs +docs: + @echo "$(ATTN_COLOR)==> docs $(NO_COLOR)" + @rm -rf ./docs/_build + @tox -e docs + @cd ./docs/_build && zip -r docs_html.zip . -x ".*" -x "__MACOSX" + @echo "$(ATTN_COLOR)==> Docs pages can be found at ./docs/_build/html, docs bundle available at ./docs/_build/docs_html.zip" + .PHONY: test test: @echo "$(ATTN_COLOR)==> test $(NO_COLOR)" diff --git a/docs/index.rst b/docs/index.rst index 8f209468f..756838f50 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,19 +1,6 @@ Welcome to the API reference for the Splunk SDK for Python, which describes the modules that are included in the SDK. For more information, see the `Splunk Developer Portal `_. -.. toctree:: - :maxdepth: 2 - :name: SDK for Python API Reference - - binding - client - data - results - modularinput - searchcommands - searchcommandsvalidators - - :doc:`binding` -------------- diff --git a/tox.ini b/tox.ini index ba8fb2b2c..d9a001e25 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = clean,py27,py37 +envlist = clean,docs,py27,py37 skipsdist = {env:TOXBUILD:false} [testenv:pep8] @@ -26,7 +26,7 @@ application-import-names = splunk-sdk-python passenv = LANG setenv = SPLUNK_HOME=/opt/splunk INPUT_EXAMPLE_UPLOAD=/opt/splunk/var/log/splunk/splunkd_ui_access.log -whitelist_externals = true +allowlist_externals = make deps = pytest pytest-cov xmlrunner @@ -41,3 +41,9 @@ commands = deps = coverage skip_install = true commands = coverage erase + +[testenv:docs] +description = invoke sphinx-build to build the HTML docs +basepython = python3.7 +deps = sphinx >= 1.7.5, < 2 +commands = make -C docs/ html \ No newline at end of file From 73c0dae9311697428fa122cde3ac68d7ef72ee64 Mon Sep 17 00:00:00 2001 From: Tim Pavlik Date: Fri, 5 Feb 2021 16:41:52 -0800 Subject: [PATCH 3/4] Addressed some docs feedback --- Makefile | 2 +- docs/conf.py | 2 +- docs/index.rst | 13 +++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 938166231..a09da530b 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ docs: @echo "$(ATTN_COLOR)==> docs $(NO_COLOR)" @rm -rf ./docs/_build @tox -e docs - @cd ./docs/_build && zip -r docs_html.zip . -x ".*" -x "__MACOSX" + @cd ./docs/_build/html && zip -r ../docs_html.zip . -x ".*" -x "__MACOSX" @echo "$(ATTN_COLOR)==> Docs pages can be found at ./docs/_build/html, docs bundle available at ./docs/_build/docs_html.zip" .PHONY: test diff --git a/docs/conf.py b/docs/conf.py index 3c7c43d4b..84316d044 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -138,7 +138,7 @@ # Custom sidebar templates, maps document names to template names. #html_sidebars = { html_sidebars = { - '**': ['localtoc.html', 'globaltoc.html', 'searchbox.html'], + '**': ['globaltoc.html', 'searchbox.html'], } # Additional templates that should be rendered to pages, maps page names to diff --git a/docs/index.rst b/docs/index.rst index 756838f50..8f209468f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,6 +1,19 @@ Welcome to the API reference for the Splunk SDK for Python, which describes the modules that are included in the SDK. For more information, see the `Splunk Developer Portal `_. +.. toctree:: + :maxdepth: 2 + :name: SDK for Python API Reference + + binding + client + data + results + modularinput + searchcommands + searchcommandsvalidators + + :doc:`binding` -------------- From f3774edca10923c111f94b6dac7fd43f39c4b4bd Mon Sep 17 00:00:00 2001 From: Tim Pavlik Date: Tue, 8 Jun 2021 15:40:11 -0700 Subject: [PATCH 4/4] Release 1.6.16 --- CHANGELOG.md | 5 +++++ README.md | 2 +- examples/searchcommands_app/setup.py | 2 +- splunklib/__init__.py | 2 +- splunklib/binding.py | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89c2b6450..1c0cd3cec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Splunk Enterprise SDK for Python Changelog +## Version 1.6.16 + +### Bug fixes +[#312](https://github.com/splunk/splunk-sdk-python/pull/312) Fix issue [#309](https://github.com/splunk/splunk-sdk-python/issues/309), avoid catastrophic backtracking in searchcommands + ## Version 1.6.15 ### Bug fixes diff --git a/README.md b/README.md index fbb4f3827..94ae42469 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # The Splunk Enterprise Software Development Kit for Python -#### Version 1.6.15 +#### Version 1.6.16 The Splunk Enterprise Software Development Kit (SDK) for Python contains library code and examples designed to enable developers to build applications using the Splunk platform. diff --git a/examples/searchcommands_app/setup.py b/examples/searchcommands_app/setup.py index fdb734630..b9dc87b78 100755 --- a/examples/searchcommands_app/setup.py +++ b/examples/searchcommands_app/setup.py @@ -439,7 +439,7 @@ def run(self): setup( description='Custom Search Command examples', name=os.path.basename(project_dir), - version='1.6.15', + version='1.6.16', author='Splunk, Inc.', author_email='devinfo@splunk.com', url='http://github.com/splunk/splunk-sdk-python', diff --git a/splunklib/__init__.py b/splunklib/__init__.py index 668dcfe7f..525dc8eed 100644 --- a/splunklib/__init__.py +++ b/splunklib/__init__.py @@ -16,5 +16,5 @@ from __future__ import absolute_import from splunklib.six.moves import map -__version_info__ = (1, 6, 15) +__version_info__ = (1, 6, 16) __version__ = ".".join(map(str, __version_info__)) diff --git a/splunklib/binding.py b/splunklib/binding.py index a95faa480..c3121fb86 100644 --- a/splunklib/binding.py +++ b/splunklib/binding.py @@ -1385,7 +1385,7 @@ def request(url, message, **kwargs): head = { "Content-Length": str(len(body)), "Host": host, - "User-Agent": "splunk-sdk-python/1.6.15", + "User-Agent": "splunk-sdk-python/1.6.16", "Accept": "*/*", "Connection": "Close", } # defaults