@@ -3,13 +3,13 @@ import { simpleGuStackForTesting } from "../../../utils/test";
33import { GuWorkloadPolicy } from "./workload-policy" ;
44
55describe ( "GuDeveloperPolicy" , ( ) => {
6- test ( "if a single action is provided, the resulting Developer Policy resource's statement will have a single item" , ( ) => {
6+ test ( "if a single action is provided, the resulting Workload Policy resource's statement will have a single item" , ( ) => {
77 const stack = simpleGuStackForTesting ( ) ;
88 new GuWorkloadPolicy ( stack , "AllowS3GetObject" , {
99 allow : [
1010 {
1111 actions : [ "s3:GetObject" ] ,
12- resources : [ "* " ] ,
12+ resources : [ "s3:///log-bucket " ] ,
1313 } ,
1414 ] ,
1515 permission : "test123" ,
@@ -23,12 +23,28 @@ describe("GuDeveloperPolicy", () => {
2323 {
2424 Action : "s3:GetObject" ,
2525 Effect : "Allow" ,
26- Resource : "* " ,
26+ Resource : "s3:///log-bucket " ,
2727 } ,
2828 ] ,
2929 } ,
3030 } ) ;
3131 } ) ;
32+
33+ test ( "throws an error if a wide-open permissions is requested" , ( ) => {
34+ const stack = simpleGuStackForTesting ( ) ;
35+ expect ( ( ) => {
36+ new GuWorkloadPolicy ( stack , "AllowS3GetObject" , {
37+ allow : [
38+ {
39+ actions : [ "s3:GetObject" ] ,
40+ resources : [ "*" ] ,
41+ } ,
42+ ] ,
43+ permission : "test123" ,
44+ } ) ;
45+ } ) . toThrow ( "Overly broad permission present, see annotations for details" ) ;
46+ } ) ;
47+
3248 test ( "if multiple actions are provided, the resulting Managed Policy resource's action will container all items" , ( ) => {
3349 const stack = simpleGuStackForTesting ( ) ;
3450 new GuWorkloadPolicy ( stack , "AllowS3GetObject" , {
0 commit comments