liquibase: XSDs are not resolved from the jar when referenced via HTTPS

Environment

Java 8.

Liquibase Version: 3.8

Liquibase Integration & Version: <Pick one: CLI, maven, gradle, spring boot, servlet, etc.> Spring Boot

Database Vendor & Version: N/A

Operating System Type & Version: MacOS

Description

If a migration XML file refers to the liqubase XSD using https, the local jar packaged version is not used. That can cause issues if liquibase.org is down.

Steps To Reproduce

Use a liquibase XML with the following header without a network connection:

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
        xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
        http://www.liquibase.org/xml/ns/dbchangelog-ext https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">

Actual Behavior

XSD resolution fails because https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd cannot be read.

Expected/Desired Behavior

The locally packaged XSD is used.

Additional Context

The StandardNamespaceDetails class could be updated to include https as well as http URLs.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 9
  • Comments: 42 (13 by maintainers)

Most upvoted comments

The problem is back today.

ISSUE RESOLVED: During a regular website maintenance, a change was introduced that incorrectly forced https for the xsd files we host for some Liquibase users, causing some users to experience 301 and 403 errors. This issue has been resolved and we apologize for any inconvenience.

We are facing the same problem for our Java 8 systems today. Yesterday everything worked… The problem seems to be with the user-agent header. When the value is “java/1.8.0_172” we get the 403 error. If I try with “java/11” it works (That’s the reason why our Java 11 systems work properly).

Was able to get this working by making sure the liquibase-core pom version and the xsd version match. As someone mentioned, there is a fallback to use the bundled xsd files. In my case, was looking for 3.6 xsd and my pom version was 3.5. 😞

The original issue is still reproducible.

Java 11.

Liquibase Version: 3.10.3

Liquibase Integration & Version: <Pick one: CLI, maven, gradle, spring boot, servlet, etc.> Spring Boot 2.5.1

Database Vendor & Version: N/A

Operating System Type & Version: MacOS

When I start my service offline I have the behaviour below

https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd -> FAIL
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd -> OK

https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.10.xsd -> FAIL
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.10.xsd -> OK

https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.5.xsd -> FAIL
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.5.xsd -> FAIL

The same issue I started to get today but the folowing code solved my problem

Before:

 new Liquibase(
              changeLog.getPath(),
                  new FileSystemResourceAccessor(new File("."))),
              new JdbcConnection(connection)).update(new Contexts());

After:

new Liquibase(
              changeLog.getPath(),
              new CompositeResourceAccessor(
                  new FileSystemResourceAccessor(new File(".")), new ClassLoaderResourceAccessor()),
              new JdbcConnection(connection).update(new Contexts());

Hi @philwebb , @biswell @gnumilanix @fo-fo @teamperfomatix @bjsee @tolix . Thanks for reporting this. We migrated our website yesterday US CT and are working to fix this issues as quickly as we can to match the old site.

i tried add to bat-launcher parameter -Dhttp.agent=“wtf” (probably any except java/1.8*) and it helped 😃

We are also facing the same issue in multiple Java projects.

Error setting up or running Liquibase: liquibase.exception.SetupException: Error parsing line 7 column 139 of config/liquibase/changelog/20180606073206_added_entity_Brand.xml: schema_reference.4: Failed to read schema document ‘http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd’, because

  1. could not find the document;
  2. the document could not be read;
  3. the root element of the document is not xsd:schema.[m: Server returned HTTP response code: 403 for URL: http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd -> [1m[Help 1][m

Same issue here (or some variation of it, not related to https in our case). I traced it down to www.liquibase.org returning HTTP 403 if it doesn’t like the user agent specified in headers.

curl -v -H "user-agent: Java/1.8.0_172" http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd => 403

curl -v -H "user-agent: wtf" http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd => 200