This repository was archived by the owner on Jul 26, 2022. It is now read-only.
File tree 2 files changed +29
-0
lines changed
2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -281,6 +281,15 @@ class Poller {
281
281
// Testing data property
282
282
if ( namingConvention && externalData ) {
283
283
externalData . forEach ( ( secretProperty , index ) => {
284
+ if ( secretProperty . path ) {
285
+ if ( ! reNaming . test ( secretProperty . path ) ) {
286
+ allowed = false
287
+ reason = `path ${ secretProperty . path } does not match naming convention ${ namingConvention } `
288
+ return {
289
+ allowed, reason
290
+ }
291
+ }
292
+ }
284
293
if ( ! reNaming . test ( secretProperty . key ) ) {
285
294
allowed = false
286
295
reason = `key name ${ secretProperty . key } does not match naming convention ${ namingConvention } `
Original file line number Diff line number Diff line change @@ -982,6 +982,26 @@ describe('Poller', () => {
982
982
} ,
983
983
permitted : false
984
984
} ,
985
+ {
986
+ // test regex on path
987
+ ns : { metadata : { annotations : { [ namingPermittedAnnotation ] : 'dev/team-a/.*' } } } ,
988
+ descriptor : {
989
+ data : [
990
+ { path : 'dev/team-b/secret' }
991
+ ]
992
+ } ,
993
+ permitted : false
994
+ } ,
995
+ {
996
+ // test regex on path when key is also specified
997
+ ns : { metadata : { annotations : { [ namingPermittedAnnotation ] : 'dev/team-a/.*' } } } ,
998
+ descriptor : {
999
+ data : [
1000
+ { path : 'dev/team-b/secret' , key : 'dev/team-a/secret' }
1001
+ ]
1002
+ } ,
1003
+ permitted : false
1004
+ } ,
985
1005
{
986
1006
// test regex
987
1007
ns : { metadata : { annotations : { [ namingPermittedAnnotation ] : 'dev/team-a/.*' } } } ,
You can’t perform that action at this time.
0 commit comments