Skip to content

Commit 8d749ea

Browse files
rfayclaude
andauthored
test: accept the hex CSRF token of Adminer 6.3.1 (#60)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 49b8bf4 commit 8d749ea

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎tests/test.bats‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ health_checks() {
9898
# Make sure Adminer can write the database file owned by the host user,
9999
# it only accepts a write together with its CSRF token
100100
sql_url="https://${PROJNAME}.ddev.site:9101/${TEST_REDIRECT_LOCATION}&sql="
101-
token="$(curl -sf --cookie .cookie-jar.txt --cookie-jar .cookie-jar.txt "${sql_url}" | grep -oE "name='token' value='[0-9]+:[0-9]+" | grep -oE '[0-9]+:[0-9]+')"
101+
run curl -sf --cookie .cookie-jar.txt --cookie-jar .cookie-jar.txt "${sql_url}"
102+
assert_success
103+
# The token format changes between Adminer releases (digits before 6.3.1, hex after)
104+
assert_output --regexp "name='token' value='[^']+'"
105+
token="$(grep -oE "name='token' value='[^']+'" <<<"${output}" | head -1 | cut -d"'" -f4)"
102106
run curl -sf --cookie .cookie-jar.txt --cookie-jar .cookie-jar.txt \
103107
--data-urlencode "query=INSERT INTO ${TEST_SQLITE_TABLE}(name) VALUES ('gamma');" \
104108
--data "token=${token}" "${sql_url}"

0 commit comments

Comments
 (0)