From de9b9310d4123b3db3a33fdfd77a106ec641e7bb Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Wed, 22 Dec 2021 17:26:45 -0800 Subject: [PATCH] Additional fixes for 2.6.3 (#689) CHANGES: update changes for 2.6.3 location rewrite: pass 'arguments' to rewrite func to guard against rewriting local 'location' in some circumstances, partial fix for #684 ci: add automated docker push on new v-* tag --- .github/workflows/release.yaml | 42 +++++++++++++++++++++++ CHANGES.rst | 16 +++++++++ pywb/rewrite/regex_rewriters.py | 3 +- pywb/rewrite/test/test_html_rewriter.py | 2 +- pywb/rewrite/test/test_regex_rewriters.py | 8 ++--- 5 files changed, 65 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..0372e59e --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,42 @@ +name: Publish Docker image +on: + release: + types: [published] + +jobs: + push_to_registries: + name: Build x86 and ARM Images and push to Dockerhub + runs-on: ubuntu-latest + steps: + - + name: Check out the repo + uses: actions/checkout@v2 + - + name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: webrecorder/pywb + tags: | + type=match,pattern=v-(.*),group=1 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - + name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + diff --git a/CHANGES.rst b/CHANGES.rst index ffcbc587..b745d5ca 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,19 @@ +pywb 2.6.3 changelist +~~~~~~~~~~~~~~~~~~~~~ + +* Fix false-positive rewriting of ``localion`` through additional check if local var is used, fixes `#684 `_ + +* Fix missing localization of placeholder, fixes `#685 `_ + +* Fix regression caused by 2.6.2, ensure pywb.app_prefix, pywb.host_prefix and pywb.static_prefix paths set correctly for all pages `#688 `_, fixes `#686 `_ + +* Documentation: Fixes to ``cdx-indexer`` helped (from @ldko) `#683 `_ + +* Update wombat.js to 3.3.6 + +* Add automatic Docker push on version tag + + pywb 2.6.2 changelist ~~~~~~~~~~~~~~~~~~~~~ diff --git a/pywb/rewrite/regex_rewriters.py b/pywb/rewrite/regex_rewriters.py index 6c8200ba..333b2ca4 100644 --- a/pywb/rewrite/regex_rewriters.py +++ b/pywb/rewrite/regex_rewriters.py @@ -82,7 +82,7 @@ if (!self.__WB_pmw) {{ self.__WB_pmw = function(obj) {{ this.__WB_source = obj; # By using a function the expression injected is an call expression that plays nice in those cases this_rw = '_____WB$wombat$check$this$function_____(this)' - check_loc = '((self.__WB_check_loc && self.__WB_check_loc(location)) || {}).href = ' + check_loc = '((self.__WB_check_loc && self.__WB_check_loc(location, arguments)) || {}).href = ' self.local_objs = [ 'window', @@ -96,6 +96,7 @@ if (!self.__WB_pmw) {{ self.__WB_pmw = function(obj) {{ this.__WB_source = obj; ] local_declares = '\n'.join([local_var_line.format(obj, local_init_func_name) for obj in self.local_objs]) + local_declares += "\nlet arguments;" prop_str = '|'.join(self.local_objs) diff --git a/pywb/rewrite/test/test_html_rewriter.py b/pywb/rewrite/test/test_html_rewriter.py index 5629aff9..8809441c 100644 --- a/pywb/rewrite/test/test_html_rewriter.py +++ b/pywb/rewrite/test/test_html_rewriter.py @@ -394,7 +394,7 @@ r""" # parse attr with js proxy, rewrite location assignment >>> parse('', js_proxy=True) - + # parse attr with js proxy, assigning to location.href, no location assignment rewrite needed >>> parse('', js_proxy=True) diff --git a/pywb/rewrite/test/test_regex_rewriters.py b/pywb/rewrite/test/test_regex_rewriters.py index f3aa4aaf..af08b5ee 100644 --- a/pywb/rewrite/test/test_regex_rewriters.py +++ b/pywb/rewrite/test/test_regex_rewriters.py @@ -131,13 +131,13 @@ r""" #================================================================= >>> _test_js_obj_proxy('var foo = this; location = bar') -'var foo = _____WB$wombat$check$this$function_____(this); location = ((self.__WB_check_loc && self.__WB_check_loc(location)) || {}).href = bar' +'var foo = _____WB$wombat$check$this$function_____(this); location = ((self.__WB_check_loc && self.__WB_check_loc(location, arguments)) || {}).href = bar' >>> _test_js_obj_proxy('var that = this\n location = bar') -'var that = _____WB$wombat$check$this$function_____(this)\n location = ((self.__WB_check_loc && self.__WB_check_loc(location)) || {}).href = bar' +'var that = _____WB$wombat$check$this$function_____(this)\n location = ((self.__WB_check_loc && self.__WB_check_loc(location, arguments)) || {}).href = bar' >>> _test_js_obj_proxy('location = "xyz"') -'location = ((self.__WB_check_loc && self.__WB_check_loc(location)) || {}).href = "xyz"' +'location = ((self.__WB_check_loc && self.__WB_check_loc(location, arguments)) || {}).href = "xyz"' >>> _test_js_obj_proxy('var foo = this.location') 'var foo = _____WB$wombat$check$this$function_____(this).location' @@ -213,7 +213,7 @@ r""" 'this. alocation = http://example.com/' >>> _test_js_obj_proxy(r'this. location = http://example.com/') -'this. location = ((self.__WB_check_loc && self.__WB_check_loc(location)) || {}).href = http://example.com/' +'this. location = ((self.__WB_check_loc && self.__WB_check_loc(location, arguments)) || {}).href = http://example.com/' >>> _test_js_obj_proxy('eval(a)') 'WB_wombat_runEval(function _____evalIsEvil(_______eval_arg$$) { return eval(_______eval_arg$$); }.bind(this)).eval(a)'