mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 18:48:08 +00:00 
			
		
		
		
	Allowing Unwrap w/ Newline files (#13044)
This commit is contained in:
		| @@ -8,6 +8,7 @@ import ( | |||||||
| 	"net/http" | 	"net/http" | ||||||
| 	"net/url" | 	"net/url" | ||||||
| 	"os" | 	"os" | ||||||
|  | 	"strings" | ||||||
|  |  | ||||||
| 	"github.com/hashicorp/errwrap" | 	"github.com/hashicorp/errwrap" | ||||||
| 	"github.com/hashicorp/vault/sdk/helper/jsonutil" | 	"github.com/hashicorp/vault/sdk/helper/jsonutil" | ||||||
| @@ -235,12 +236,13 @@ func (c *Logical) DeleteWithData(path string, data map[string][]string) (*Secret | |||||||
|  |  | ||||||
| func (c *Logical) Unwrap(wrappingToken string) (*Secret, error) { | func (c *Logical) Unwrap(wrappingToken string) (*Secret, error) { | ||||||
| 	var data map[string]interface{} | 	var data map[string]interface{} | ||||||
|  | 	wt := strings.TrimSpace(wrappingToken) | ||||||
| 	if wrappingToken != "" { | 	if wrappingToken != "" { | ||||||
| 		if c.c.Token() == "" { | 		if c.c.Token() == "" { | ||||||
| 			c.c.SetToken(wrappingToken) | 			c.c.SetToken(wt) | ||||||
| 		} else if wrappingToken != c.c.Token() { | 		} else if wrappingToken != c.c.Token() { | ||||||
| 			data = map[string]interface{}{ | 			data = map[string]interface{}{ | ||||||
| 				"token": wrappingToken, | 				"token": wt, | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|   | |||||||
							
								
								
									
										3
									
								
								changelog/13044.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								changelog/13044.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | |||||||
|  | ```release-note:improvement | ||||||
|  | api: Trim newline character from wrapping token in logical.Unwrap from the api package | ||||||
|  | ``` | ||||||
		Reference in New Issue
	
	Block a user
	 AnPucel
					AnPucel