spring-cloud / spring-cloud/spring-cloud-config

Config server - native profile - relative path denied by GenericResourceRepository

Open
#1,655 1 comment 0 reactions 1 assignee View on GitHub

@ryanjbaxter is already working on this.

Since Jul 27, 2020.

enhancement
Dominant language
Java
Stars
2k
Forks
1.3k
Avg merge
2d 59m
Merged PRs (30d)
16

Description

Describe the bug
Using relative path in seachLocations for native profile of Config server:


spring:
  profiles: native
  cloud:
    config:
      server:
        native:
          searchLocations: ../../config/localhost

Everything seems fine - get properties works correctly:
GET https://localhost:8888/config/app-name/default
..returns correctly properties. See log:

[nio-8888-exec-5] o.s.c.c.s.e.NativeEnvironmentRepository  : [] Adding property source: file:../../config/localhost/application.properties

But when trying to obtain any other resource file, we got validation error from GenericResourceRepository:
GET https://localhost:8888/config/app-name/default/default/some-file.xml

[nio-8888-exec-9] o.s.c.c.s.r.GenericResourceRepository    : [] Location contains ".."

I assume this is a buggy behaviour - Eighter path should be normalized (canonical path) before full path is constructed with reuest file or only requested part of path should be checked.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.