@@ -295,7 +295,7 @@ function processCustomPolicy(iam_def, tags) {
295295 return ;
296296 }
297297 }
298-
298+
299299 var condition = null ;
300300 if ( statement [ 'Condition' ] ) {
301301 condition = statement [ 'Condition' ] ;
@@ -627,6 +627,21 @@ async function processReferencePage() {
627627 let tags_data = await fetch ( 'https://iann0036.github.io/iam-dataset/aws/tags.json' ) ;
628628 let tags = await tags_data . json ( ) ;
629629
630+ const managedpolicies_data = await fetch ( 'https://raw.githubusercontent.com/iann0036/iam-dataset/main/aws/managed_policies.json' ) ;
631+ const managedpolicies = await managedpolicies_data . json ( ) ;
632+ for ( const managedpolicy of managedpolicies [ 'policies' ] ) {
633+ // Enrich for search
634+ managedpolicy [ 'effective_action_names' ] = managedpolicy [ 'effective_action_names' ] . map ( a => {
635+ const fullpriv = a . toLowerCase ( ) ;
636+ const [ prefix , privilege ] = fullpriv . split ( ":" ) ;
637+ return {
638+ fullpriv,
639+ prefix,
640+ privilege,
641+ }
642+ } ) ;
643+ }
644+
630645 $ ( '#actions-table tbody' ) . html ( '' ) ;
631646
632647 iam_def . sort ( ( a , b ) => a [ 'service_name' ] . replace ( "Amazon " , "" ) . replace ( "AWS " , "" ) < b [ 'service_name' ] . replace ( "Amazon " , "" ) . replace ( "AWS " , "" ) ? - 1 : 1 )
@@ -721,7 +736,7 @@ async function processReferencePage() {
721736 html = '' ;
722737 results = [ ] ;
723738 for ( let managedpolicy of managedpolicies [ 'policies' ] ) {
724- if ( managedpolicy [ 'name' ] . toLowerCase ( ) . includes ( searchterm ) ) {
739+ if ( managedpolicy [ 'name' ] . toLowerCase ( ) . includes ( searchterm ) || managedpolicy [ 'effective_action_names' ] . some ( a => a [ 'fullpriv' ] . startsWith ( searchterm ) || a [ 'prefix' ] . startsWith ( searchterm ) || a [ 'privilege' ] . startsWith ( searchterm ) ) ) {
725740 results . push ( managedpolicy [ 'name' ] ) ;
726741 }
727742 if ( results . length >= 10 ) break ;
@@ -843,7 +858,7 @@ async function processReferencePage() {
843858 }
844859
845860 actions_table_content += '<tr id="' + service [ 'prefix' ] + '-' + privilege [ 'privilege' ] + '">\
846- <td rowspan="' + rowspan + '" class="tx-medium"><span class="tx-color-03">' + service [ 'prefix' ] + ':</span>' + privilege [ 'privilege' ] + ( privilege [ 'access_level' ] == "Unknown" ? ' <span class="badge badge-danger">undocumented</span>' : '' ) + '</td>\
861+ <td rowspan="' + rowspan + '" class="tx-medium"><a href="/actions/' + service [ 'prefix' ] + ':' + privilege [ 'privilege' ] + '">< span class="tx-color-03">' + service [ 'prefix' ] + ':</span>' + privilege [ 'privilege' ] + ( privilege [ 'access_level' ] == "Unknown" ? ' <span class="badge badge-danger">undocumented</span>' : '' ) + '</a> </td>\
847862 <td rowspan="' + rowspan + '" class="tx-normal">' + privilege [ 'description' ] + '</td>\
848863 <td rowspan="' + rowspan + '" class="tx-medium">' + used_by + '</td>\
849864 <td rowspan="' + rowspan + '" class="' + access_class + '">' + privilege [ 'access_level' ] + '</td>\
@@ -1000,8 +1015,6 @@ async function processReferencePage() {
10001015
10011016 // managed policies
10021017 let managedpolicies_table_content = '' ;
1003- let managedpolicies_data = await fetch ( 'https://raw.githubusercontent.com/iann0036/iam-dataset/main/aws/managed_policies.json' ) ;
1004- let managedpolicies = await managedpolicies_data . json ( ) ;
10051018
10061019 managedpolicies [ 'policies' ] . sort ( function ( a , b ) {
10071020 if ( a [ 'name' ] < b [ 'name' ] ) {
@@ -1068,7 +1081,7 @@ async function processReferencePage() {
10681081 processCustomPolicy ( iam_def , tags ) ;
10691082 } , 800 ) ;
10701083 } ) ;
1071-
1084+
10721085 $ ( '#custompolicy-considerarn' ) . change ( function ( ) {
10731086 clearTimeout ( custom_policy_timer ) ;
10741087 custom_policy_timer = setTimeout ( function ( ) {
0 commit comments