apache/dolphinscheduler · error · IllegalArgumentException

Invalid resource path: ${resourceAbsolutePath}

Error message

Invalid resource path: ${resourceAbsolutePath}

What it means

A path-safety guard in getResourceMetaData: the supplied resourceAbsolutePath failed the base-directory containment check (or empty check) — meaning the path does not start with the configured storage base directory, so metadata lookup is refused to prevent arbitrary path access. The faulty input is the resource absolute path; the message interpolates resourceAbsolutePath.

Source

Thrown at dolphinscheduler-storage-plugin/dolphinscheduler-storage-api/src/main/java/org/apache/dolphinscheduler/plugin/storage/api/AbstractStorageOperator.java:45

import com.google.common.base.Preconditions;
import com.google.common.io.Files;

public abstract class AbstractStorageOperator implements StorageOperator {

    protected final String resourceBaseAbsolutePath;

    public AbstractStorageOperator(String resourceBaseAbsolutePath) {
        Preconditions.checkNotNull(resourceBaseAbsolutePath, "Resource upload path should not be null");
        this.resourceBaseAbsolutePath = resourceBaseAbsolutePath;
    }

    @Override
    public ResourceMetadata getResourceMetaData(String resourceAbsolutePath) {
        String storageBaseDirectory = getStorageBaseDirectory();
        String resourceSegment = StringUtils.substringAfter(resourceAbsolutePath, storageBaseDirectory);
        String[] segments = StringUtils.split(resourceSegment, File.separator, 3);
        if (segments.length == 0) {
            throw new IllegalArgumentException("Invalid resource path: " + resourceAbsolutePath);
        }
        return ResourceMetadata.builder()
                .resourceAbsolutePath(resourceAbsolutePath)
                .resourceBaseDirectory(storageBaseDirectory)
                .isDirectory(Files.getFileExtension(resourceAbsolutePath).isEmpty())
                .tenant(segments[0])
                .resourceType(ResourceType.FILE)
                .resourceRelativePath(segments.length == 2 ? "/" : segments[2])
                .resourceParentAbsolutePath(StringUtils.substringBeforeLast(resourceAbsolutePath, File.separator))
                .build();
    }

    @Override
    public String getStorageBaseDirectory() {
        // All directory should end with File.separator
        return resourceBaseAbsolutePath;
    }

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Normalize the resource path and ensure it is constructed from getStorageBaseDirectory(tenantCode, resourceType)
  2. Verify the resource upload path configuration matches the path stored in the resource records (a changed resource.storage.upload.base.path invalidates old paths)
  3. Reject user-supplied paths containing '..' or leading '/' before they reach storage APIs
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at dolphinscheduler-storage-plugin/dolphinscheduler-storage-api/src/main/java/org/apache/dolphinscheduler/plugin/storage/api/AbstractStorageOperator.java:45 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/be45f433b6b45ee9. Report an issue: GitHub.