This repository was archived by the owner on Jul 26, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -281,6 +281,15 @@ class Poller {
281281 // Testing data property
282282 if ( namingConvention && externalData ) {
283283 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+ }
284293 if ( ! reNaming . test ( secretProperty . key ) ) {
285294 allowed = false
286295 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', () => {
982982 } ,
983983 permitted : false
984984 } ,
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+ } ,
9851005 {
9861006 // test regex
9871007 ns : { metadata : { annotations : { [ namingPermittedAnnotation ] : 'dev/team-a/.*' } } } ,
You can’t perform that action at this time.
0 commit comments