Skip to content

Commit 885f8aa

Browse files
committed
Document relative and absolute Vault path behavior.
Closes gh-926
1 parent abfbf87 commit 885f8aa

File tree

6 files changed

+47
-3
lines changed

6 files changed

+47
-3
lines changed

spring-vault-core/src/main/java/org/springframework/vault/core/ReactiveVaultOperations.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
import org.springframework.lang.Nullable;
2525
import org.springframework.vault.VaultException;
26+
import org.springframework.vault.client.VaultEndpoint;
2627
import org.springframework.vault.support.VaultResponse;
2728
import org.springframework.vault.support.VaultResponseSupport;
2829
import org.springframework.web.reactive.function.client.WebClient;
@@ -39,6 +40,11 @@
3940
* {@link ReactiveVaultOperations} allows execution of callback methods. Callbacks can
4041
* execute requests within a {@link #doWithSession(Function) session context} and the
4142
* {@link #doWithVault(Function) without a session}.
43+
* <p>
44+
* Paths used in this interface (and interfaces accessible from here) are considered
45+
* relative to the {@link VaultEndpoint}. Paths that are fully-qualified URI's can be used
46+
* to access Vault cluster members in an authenticated context. To prevent unwanted full
47+
* URI access, make sure to sanitize paths before passing them to this interface.
4248
*
4349
* @author Mark Paluch
4450
* @author James Luke

spring-vault-core/src/main/java/org/springframework/vault/core/ReactiveVaultTemplate.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,18 @@
5454

5555
/**
5656
* This class encapsulates main Vault interaction. {@link ReactiveVaultTemplate} will log
57-
* into Vault on initialization and use the token throughout the whole lifetime.
57+
* into Vault on initialization and use the token throughout the whole lifetime. This is
58+
* the main entry point to interact with Vault in an authenticated and unauthenticated
59+
* context.
60+
* <p>
61+
* {@link ReactiveVaultTemplate} allows execution of callback methods. Callbacks can
62+
* execute requests within a {@link #doWithSession(Function) session context} and the
63+
* {@link #doWithVault(Function) without a session}.
64+
* <p>
65+
* Paths used in this interface (and interfaces accessible from here) are considered
66+
* relative to the {@link VaultEndpoint}. Paths that are fully-qualified URI's can be used
67+
* to access Vault cluster members in an authenticated context. To prevent unwanted full
68+
* URI access, make sure to sanitize paths before passing them to this interface.
5869
*
5970
* @author Mark Paluch
6071
* @author Raoof Mohammed

spring-vault-core/src/main/java/org/springframework/vault/core/VaultOperations.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import org.springframework.lang.Nullable;
2121
import org.springframework.vault.VaultException;
22+
import org.springframework.vault.client.VaultEndpoint;
2223
import org.springframework.vault.core.VaultKeyValueOperationsSupport.KeyValueBackend;
2324
import org.springframework.vault.support.VaultResponse;
2425
import org.springframework.vault.support.VaultResponseSupport;
@@ -32,6 +33,11 @@
3233
* {@link VaultOperations} allows execution of callback methods. Callbacks can execute
3334
* requests within a {@link #doWithSession(RestOperationsCallback) session context} and
3435
* the {@link #doWithVault(RestOperationsCallback) without a session}.
36+
* <p>
37+
* Paths used in this interface (and interfaces accessible from here) are considered
38+
* relative to the {@link VaultEndpoint}. Paths that are fully-qualified URI's can be used
39+
* to access Vault cluster members in an authenticated context. To prevent unwanted full
40+
* URI access, make sure to sanitize paths before passing them to this interface.
3541
*
3642
* @author Mark Paluch
3743
* @author Lauren Voswinkel

spring-vault-core/src/main/java/org/springframework/vault/core/VaultTemplate.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,19 @@
4545
import org.springframework.web.client.RestTemplate;
4646

4747
/**
48-
* This class encapsulates main Vault interaction. {@link VaultTemplate} will log into
49-
* Vault on initialization and use the token throughout the whole lifetime.
48+
* This class encapsulates main Vault interaction. {@code VaultTemplate} will log into
49+
* Vault on initialization and use the token throughout the whole lifetime. This is the
50+
* main entry point to interact with Vault in an authenticated and unauthenticated
51+
* context.
52+
* <p>
53+
* {@code VaultTemplate} allows execution of callback methods. Callbacks can execute
54+
* requests within a {@link #doWithSession(RestOperationsCallback) session context} and
55+
* the {@link #doWithVault(RestOperationsCallback) without a session}.
56+
* <p>
57+
* Paths used in this interface (and interfaces accessible from here) are considered
58+
* relative to the {@link VaultEndpoint}. Paths that are fully-qualified URI's can be used
59+
* to access Vault cluster members in an authenticated context. To prevent unwanted full
60+
* URI access, make sure to sanitize paths before passing them to this interface.
5061
*
5162
* @author Mark Paluch
5263
* @see SessionManager

src/main/antora/modules/ROOT/pages/vault/imperative-template.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ the use of the Vault API and `VaultOperations`. A major difference in between
2323
the two APIs is that `VaultOperations` can be passed domain objects instead of
2424
JSON Key-Value pairs.
2525

26+
Paths used in `VaultTemplate` (and interfaces accessible from there) are considered
27+
relative to the `VaultEndpoint`. Paths that are fully-qualified URI's can be used
28+
to access Vault cluster members in an authenticated context. To prevent unwanted
29+
full URI access, make sure to sanitize paths before passing them to `VaultTemplate`.
30+
2631
NOTE: The preferred way to reference the operations on javadoc:org.springframework.vault.core.VaultTemplate[] instance
2732
is via its interface javadoc:org.springframework.vault.core.VaultOperations[].
2833

src/main/antora/modules/ROOT/pages/vault/reactive-template.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ the use of the Vault API and javadoc:org.springframework.vault.core.ReactiveVaul
4747
the two APIs is that javadoc:org.springframework.vault.core.ReactiveVaultOperations[] can be passed domain objects instead of
4848
JSON Key-Value pairs.
4949

50+
Paths used in `ReactiveVaultTemplate` (and interfaces accessible from there) are considered
51+
relative to the `VaultEndpoint`. Paths that are fully-qualified URI's can be used
52+
to access Vault cluster members in an authenticated context. To prevent unwanted
53+
full URI access, make sure to sanitize paths before passing them to `ReactiveVaultTemplate`.
54+
5055
NOTE: The preferred way to reference the operations on javadoc:org.springframework.vault.core.ReactiveVaultTemplate[] instance
5156
is via its interface javadoc:org.springframework.vault.core.ReactiveVaultOperations[].
5257

0 commit comments

Comments
 (0)