Skip to content

Commit

Permalink
Additional fixes for 2.6.3 (#689)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ikreymer authored Dec 23, 2021
1 parent 0c4e406 commit de9b931
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 6 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -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 }}

16 changes: 16 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/webrecorder/pywb/pull/684>`_

* Fix missing localization of placeholder, fixes `#685 <https://github.com/webrecorder/pywb/pull/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 <https://github.com/webrecorder/pywb/pull/688>`_, fixes `#686 <https://github.com/webrecorder/pywb/pull/686>`_

* Documentation: Fixes to ``cdx-indexer`` helped (from @ldko) `#683 <https://github.com/webrecorder/pywb/pull/683>`_

* Update wombat.js to 3.3.6

* Add automatic Docker push on version tag


pywb 2.6.2 changelist
~~~~~~~~~~~~~~~~~~~~~

Expand Down
3 changes: 2 additions & 1 deletion pywb/rewrite/regex_rewriters.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __init__(self):
# 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',
Expand All @@ -96,6 +96,7 @@ def __init__(self):
]

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)

Expand Down
2 changes: 1 addition & 1 deletion pywb/rewrite/test/test_html_rewriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@
# parse attr with js proxy, rewrite location assignment
>>> parse('<html><a href="javascript:location=\'foo.html\'"></a></html>', js_proxy=True)
<html><a href="javascript:{ location=((self.__WB_check_loc && self.__WB_check_loc(location)) || {}).href = 'foo.html' }"></a></html>
<html><a href="javascript:{ location=((self.__WB_check_loc && self.__WB_check_loc(location, arguments)) || {}).href = 'foo.html' }"></a></html>
# parse attr with js proxy, assigning to location.href, no location assignment rewrite needed
>>> parse('<html><a href="javascript:location.href=\'foo.html\'"></a></html>', js_proxy=True)
Expand Down
8 changes: 4 additions & 4 deletions pywb/rewrite/test/test_regex_rewriters.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@
#=================================================================
>>> _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'
Expand Down Expand Up @@ -213,7 +213,7 @@
'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)'
Expand Down

0 comments on commit de9b931

Please sign in to comment.