AWS Security ChangesHomeSearch

AWS code-library documentation change

Service: code-library · 2025-06-28 · Documentation low

File: code-library/latest/ug/iam_example_iam_GetUserPolicy_section.md

Summary

Added PowerShell V5 example for retrieving user policy with URL decoding

Security assessment

Shows how to inspect user policies which is security-related configuration, but not a vulnerability fix

Diff

diff --git a/code-library/latest/ug/iam_example_iam_GetUserPolicy_section.md b/code-library/latest/ug/iam_example_iam_GetUserPolicy_section.md
index b635566a6..499469f62 100644
--- a//code-library/latest/ug/iam_example_iam_GetUserPolicy_section.md
+++ b//code-library/latest/ug/iam_example_iam_GetUserPolicy_section.md
@@ -95,0 +96,39 @@ PowerShell
+**Tools for PowerShell V5**
+    
+
+**Example 1: This example retrieves the details of the inline policy named`Davids_IAM_Admin_Policy` that is embedded in the IAM user named `David`. The policy document is URL encoded.**
+    
+    
+    $results = Get-IAMUserPolicy -PolicyName Davids_IAM_Admin_Policy -UserName David
+    $results
+    
+
+**Output:**
+    
+    
+    PolicyDocument                                            PolicyName                    UserName
+    --------------                                            ----------                    --------
+    %7B%0A%20%20%22Version%22%3A%20%222012-10-17%22%2C%...    Davids_IAM_Admin_Policy       David
+    
+    [System.Reflection.Assembly]::LoadWithPartialName("System.Web.HttpUtility")
+    [System.Web.HttpUtility]::UrlDecode($results.PolicyDocument)
+    {
+      "Version": "2012-10-17",
+      "Statement": [
+        {
+          "Effect": "Allow",
+          "Action": [
+            "iam:*"
+          ],
+          "Resource": [
+            "*"
+          ]
+        }
+      ]
+    }
+
+  * For API details, see [GetUserPolicy](https://docs.aws.amazon.com/powershell/v5/reference) in _AWS Tools for PowerShell Cmdlet Reference (V5)_. 
+
+
+
+