Deprecate GAP-Signature and add a warning on usage (#1103)
This commit is contained in:
		
							parent
							
								
									20cf033065
								
							
						
					
					
						commit
						4d9de06b1d
					
				|  | @ -4,11 +4,16 @@ | ||||||
| 
 | 
 | ||||||
| ## Important Notes | ## Important Notes | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | - [#1103](https://github.com/oauth2-proxy/oauth2-proxy/pull/1103) Upstream request signatures via `--signature-key` is | ||||||
|  |   deprecated. Support will be removed completely in v8.0.0. | ||||||
|  | 
 | ||||||
| ## Breaking Changes | ## Breaking Changes | ||||||
| 
 | 
 | ||||||
| ## Changes since v7.0.1 | ## Changes since v7.0.1 | ||||||
| 
 | 
 | ||||||
| - [#1045](https://github.com/oauth2-proxy/oauth2-proxy/pull/1045) Ensure redirect URI always has a scheme (@JoelSpeed) | - [#1045](https://github.com/oauth2-proxy/oauth2-proxy/pull/1045) Ensure redirect URI always has a scheme (@JoelSpeed) | ||||||
|  | - [#1103](https://github.com/oauth2-proxy/oauth2-proxy/pull/1103) Deprecate upstream request signatures (@NickMeves) | ||||||
| - [#914](https://github.com/oauth2-proxy/oauth2-proxy/pull/914) Extract email from id_token for azure provider when oidc is configured | - [#914](https://github.com/oauth2-proxy/oauth2-proxy/pull/914) Extract email from id_token for azure provider when oidc is configured | ||||||
| - [#1047](https://github.com/oauth2-proxy/oauth2-proxy/pull/1047) Refactor HTTP Server and add ServerGroup to handle graceful shutdown of multiple servers (@JoelSpeed) | - [#1047](https://github.com/oauth2-proxy/oauth2-proxy/pull/1047) Refactor HTTP Server and add ServerGroup to handle graceful shutdown of multiple servers (@JoelSpeed) | ||||||
| - [#1070](https://github.com/oauth2-proxy/oauth2-proxy/pull/1070) Refactor logging middleware to middleware package (@NickMeves) | - [#1070](https://github.com/oauth2-proxy/oauth2-proxy/pull/1070) Refactor logging middleware to middleware package (@NickMeves) | ||||||
|  |  | ||||||
|  | @ -1,20 +0,0 @@ | ||||||
| --- |  | ||||||
| id: request_signatures |  | ||||||
| title: Request Signatures |  | ||||||
| --- |  | ||||||
| 
 |  | ||||||
| If `signature_key` is defined, proxied requests will be signed with the |  | ||||||
| `GAP-Signature` header, which is a [Hash-based Message Authentication Code |  | ||||||
| (HMAC)](https://en.wikipedia.org/wiki/Hash-based_message_authentication_code) |  | ||||||
| of selected request information and the request body [see `SIGNATURE_HEADERS` |  | ||||||
| in `oauthproxy.go`](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/oauthproxy.go). |  | ||||||
| 
 |  | ||||||
| `signature_key` must be of the form `algorithm:secretkey`, (ie: `signature_key = "sha1:secret0"`) |  | ||||||
| 
 |  | ||||||
| For more information about HMAC request signature validation, read the |  | ||||||
| following: |  | ||||||
| 
 |  | ||||||
| - [Amazon Web Services: Signing and Authenticating REST |  | ||||||
|   Requests](https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html) |  | ||||||
| - [rc3.org: Using HMAC to authenticate Web service |  | ||||||
|   requests](http://rc3.org/2011/12/02/using-hmac-to-authenticate-web-service-requests/) |  | ||||||
|  | @ -18,7 +18,7 @@ module.exports = { | ||||||
|       type: 'category', |       type: 'category', | ||||||
|       label: 'Features', |       label: 'Features', | ||||||
|       collapsed: false, |       collapsed: false, | ||||||
|       items: ['features/endpoints', 'features/request_signatures'], |       items: ['features/endpoints'], | ||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|       type: 'category', |       type: 'category', | ||||||
|  |  | ||||||
|  | @ -2,7 +2,6 @@ package validation | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
| 	"crypto" |  | ||||||
| 	"crypto/tls" | 	"crypto/tls" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"io/ioutil" | 	"io/ioutil" | ||||||
|  | @ -30,8 +29,8 @@ func Validate(o *options.Options) error { | ||||||
| 	msgs = append(msgs, validateRedisSessionStore(o)...) | 	msgs = append(msgs, validateRedisSessionStore(o)...) | ||||||
| 	msgs = append(msgs, prefixValues("injectRequestHeaders: ", validateHeaders(o.InjectRequestHeaders)...)...) | 	msgs = append(msgs, prefixValues("injectRequestHeaders: ", validateHeaders(o.InjectRequestHeaders)...)...) | ||||||
| 	msgs = append(msgs, prefixValues("injectResponseHeaders: ", validateHeaders(o.InjectResponseHeaders)...)...) | 	msgs = append(msgs, prefixValues("injectResponseHeaders: ", validateHeaders(o.InjectResponseHeaders)...)...) | ||||||
| 	msgs = parseSignatureKey(o, msgs) |  | ||||||
| 	msgs = configureLogger(o.Logging, msgs) | 	msgs = configureLogger(o.Logging, msgs) | ||||||
|  | 	msgs = parseSignatureKey(o, msgs) | ||||||
| 
 | 
 | ||||||
| 	if o.SSLInsecureSkipVerify { | 	if o.SSLInsecureSkipVerify { | ||||||
| 		// InsecureSkipVerify is a configurable option we allow
 | 		// InsecureSkipVerify is a configurable option we allow
 | ||||||
|  | @ -355,6 +354,8 @@ func parseSignatureKey(o *options.Options, msgs []string) []string { | ||||||
| 		return msgs | 		return msgs | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	logger.Print("WARNING: `--signature-key` is deprecated. It will be removed in a future release") | ||||||
|  | 
 | ||||||
| 	components := strings.Split(o.SignatureKey, ":") | 	components := strings.Split(o.SignatureKey, ":") | ||||||
| 	if len(components) != 2 { | 	if len(components) != 2 { | ||||||
| 		return append(msgs, "invalid signature hash:key spec: "+ | 		return append(msgs, "invalid signature hash:key spec: "+ | ||||||
|  | @ -362,11 +363,9 @@ func parseSignatureKey(o *options.Options, msgs []string) []string { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	algorithm, secretKey := components[0], components[1] | 	algorithm, secretKey := components[0], components[1] | ||||||
| 	var hash crypto.Hash | 	hash, err := hmacauth.DigestNameToCryptoHash(algorithm) | ||||||
| 	var err error | 	if err != nil { | ||||||
| 	if hash, err = hmacauth.DigestNameToCryptoHash(algorithm); err != nil { | 		return append(msgs, "unsupported signature hash algorithm: "+o.SignatureKey) | ||||||
| 		return append(msgs, "unsupported signature hash algorithm: "+ |  | ||||||
| 			o.SignatureKey) |  | ||||||
| 	} | 	} | ||||||
| 	o.SetSignatureData(&options.SignatureData{Hash: hash, Key: secretKey}) | 	o.SetSignatureData(&options.SignatureData{Hash: hash, Key: secretKey}) | ||||||
| 	return msgs | 	return msgs | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue