Skip to content

Commit 9d3c8cb

Browse files
authored
Add overall timeout of 10 seconds (#135)
*Issue #, if available:* Currently there is no timeout set when plugin is executed as binary. *Description of changes:* This PR implements a 10-second overall execution time limit for the plugin to execute signing and verification. #### TODO: Have better timeout for GenerateEnvelope and Verify operations. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. Signed-off-by: Pritesh Bandi <[email protected]>
1 parent 7679f42 commit 9d3c8cb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cmd/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"context"
1818
"fmt"
1919
"os"
20+
"time"
2021

2122
"github.com/aws/aws-signer-notation-plugin/internal/logger"
2223
"github.com/aws/aws-signer-notation-plugin/plugin"
@@ -28,7 +29,9 @@ const debugFlag = "AWS_SIGNER_NOTATION_PLUGIN_DEBUG"
2829

2930
func main() {
3031
awsPlugin := plugin.NewAWSSignerForCLI()
31-
ctx := context.Background()
32+
// plugin should finish execution in 10 seconds
33+
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
34+
defer cancel()
3235

3336
var pluginCli *cli.CLI
3437
var err error

0 commit comments

Comments
 (0)