1import{r as c,i as M,l as I,j as e,P as $,L as T}from"./index-Dyb6OM34.js";import{A as R,L as W}from"./AlternativeSubmissionMethods-FjjxYhmU.js";import"./info-_-dNPtcb.js";import"./lock-CUge5ZSL.js";function D(){const[x,y]=c.useState(""),[p,u]=c.useState(!1),[i,b]=c.useState(null),[g,d]=c.useState(""),[v,f]=c.useState(!1),{isAuthenticated:j,getValidToken:w}=M(),{refreshCreditBalance:_,seatLicensed:A}=I(),k=/^[a-zA-Z0-9-]+:[a-zA-Z0-9]+$/,C=/^[a-zA-Z]+\.[a-zA-Z]+\/([a-zA-Z0-9-]+\/)*[a-zA-Z0-9-*]+$/,P=/^[a-z]+\.[a-z.]+\.[a-z]+$/,S=/^[A-Z][a-zA-Z]+\.[A-Z][a-zA-Z.]+$/,m=t=>k.test(t)?"AWS":C.test(t)?"Azure":S.test(t)?"Graph":P.test(t)?"GCP":null,L=t=>{let n=[];if(Array.isArray(t))n=t;else if(typeof t=="string")try{n=JSON.parse(t)}catch{n=t.replace(/[[\]"']/g,"").split(",").map(s=>s.trim()).filter(Boolean)}return!n||n.length===0?e.jsx("span",{className:"text-slate-500 italic",children:"None"}):e.jsx("div",{className:"flex flex-wrap gap-2",children:n.map((l,s)=>e.jsx("span",{className:"px-2 py-1 rounded bg-slate-800 border border-slate-700 text-xs font-mono text-cyan-300",children:l},s))})},z=t=>{if(!t)return null;const n=t.split("-------");return n.length>1?e.jsx("div",{className:"col-span-full space-y-4",children:n.map((l,s)=>{const r=l.trim();if(!r)return null;const a=r.indexOf(":");if(a===-1)return e.jsx("p",{className:"text-slate-300",children:r},s);const o=r.substring(0,a).trim(),h=r.substring(a+1).trim();return e.jsxs("div",{children:[e.jsx("h4",{className:"text-slate-500 text-xs uppercase tracking-wider font-semibold mb-1",children:o}),e.jsx("p",{className:"text-slate-300",children:h})]},s)})}):e.jsxs("div",{className:"col-span-full",children:[e.jsx("h4",{className:"text-slate-500 text-xs uppercase tracking-wider font-semibold mb-2",children:"Description"}),e.jsx("p",{className:"text-slate-300",children:t})]})},N=t=>{switch(t){case"AWS":return"bg-orange-500/10 text-orange-400 border-orange-500/20";case"Azure":return"bg-blue-500/10 text-blue-400 border-blue-500/20";case"GCP":return"bg-yellow-500/10 text-yellow-400 border-yellow-500/20";case"Graph":return"bg-violet-500/10 text-violet-400 border-violet-500/20";default:return"bg-slate-700 text-slate-300 border-slate-600"}},G=async()=>{if(d(""),b(null),!x.trim()){d("Please enter a permission string.");return}if(!m(x)){d("Invalid permission format. Please check the examples below.");return}if(!j){f(!0);return}u(!0);const n=w();if(!n){u(!1);return}try{const l=await fetch("https://api.bluelanternsecurity.io/cloud-permissions-context",{method:"POST",headers:{Authorization:`${n}`,"Content-Type":"application/json"},body:JSON.stringify({permission:x})}),s=await l.json();l.ok?(b(s),_()):d(s.message||"An error occurred while fetching data.")}catch(l){console.error("API Error:",l),d("Failed to connect to the server.")}finally{u(!1)}};return e.jsxs("div",{className:"min-h-screen bg-slate-950 text-white",children:[e.jsx($,{title:"Cloud IAM permission lookup | AWS, Azure, GCP, Graph | Blue Lantern",description:"Look up effective cloud IAM permissions across AWS, Azure, GCP, and Microsoft Graph. Understand allowed actions, resource types, and permission risk at a glance.",path:"/cloud-permissions-context"}),e.jsxs("div",{className:"relative max-w-4xl mx-auto px-4 pb-16 pt-24 sm:px-6 sm:pt-28",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsxs(T,{to:"/saas-offerings",className:"inline-flex items-center text-slate-400 hover:text-cyan-400 mb-6 transition-colors",children:[e.jsx("svg",{className:"w-4 h-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 19l-7-7m0 0l7-7m-7 7h18"})}),"Back to SaaS"]}),e.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-white mb-3",children:"Cloud Permissions Context"}),e.jsx("p",{className:"text-base text-slate-300 max-w-2xl mx-auto",children:"Retrieve details for Cloud Permissions across AWS, Azure, GCP, and Microsoft Graph."})]}),e.jsx("div",{className:"rounded-[14px] bg-slate-900/60 border border-slate-800/80 mb-8",children:e.jsxs("div",{className:"p-6 sm:p-8",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{htmlFor:"permission",className:"block text-sm font-medium text-slate-300 mb-2",children:"Permission String"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"text",id:"permission",value:x,onChange:t=>y(t.target.value),placeholder:"e.g., Microsoft.Compute/virtualMachines/write",className:"w-full px-4 py-3 pr-40 bg-slate-900/80 border border-slate-700/60 rounded-[10px] text-white placeholder-slate-500 focus:outline-none focus:border-cyan-400/50 focus:ring-2 focus:ring-cyan-400/20 transition-colors font-mono text-sm"}),e.jsx("button",{onClick:G,disabled:p,className:`absolute right-2 top-2 bottom-2 px-5 rounded-md text-sm font-semibold transition-colors ${p?"bg-slate-700 text-slate-400 cursor-not-allowed":"bg-cyan-500 text-slate-950 hover:bg-cyan-400"}`,children:p?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Checkingâ¦"]}):"Check Permission"})]}),g&&e.jsxs("div",{className:"mt-3 text-red-400 text-sm flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),g]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 text-xs text-slate-400 bg-slate-950/50 p-4 rounded-md border border-slate-800",children:[e.jsxs("div",{children:[e.jsx("strong",{className:"text-slate-300 block mb-1",children:"AWS pattern"}),e.jsx("code",{className:"font-mono bg-slate-900 px-1 py-0.5 rounded",children:"service:action"})]}),e.jsxs("div",{children:[e.jsx("strong",{className:"text-slate-300 block mb-1",children:"Azure pattern"}),e.jsx("code",{className:"font-mono bg-slate-900 px-1 py-0.5 rounded",children:"Provider/Res
1ource/Action"})]}),e.jsxs("div",{children:[e.jsx("strong",{className:"text-slate-300 block mb-1",children:"GCP pattern"}),e.jsx("code",{className:"font-mono bg-slate-900 px-1 py-0.5 rounded",children:"service.resource.verb"})]}),e.jsxs("div",{children:[e.jsx("strong",{className:"text-slate-300 block mb-1",children:"Graph pattern"}),e.jsx("code",{className:"font-mono bg-slate-900 px-1 py-0.5 rounded",children:"Resource.Action.Scope"})]})]}),e.jsx("p",{className:"mt-4 text-xs text-slate-500 text-center",children:A?"Included in your Seat License.":e.jsx(e.Fragment,{children:"Free on the Free Tier: each check counts as one scan."})})]})}),i&&e.jsxs("div",{className:"animate-fade-in-up",children:[e.jsxs("h2",{className:"text-2xl font-bold mb-6 flex items-center gap-3",children:[e.jsx("span",{className:"text-cyan-400",children:"Permission Lookup"}),e.jsx("span",{className:"px-3 py-1 rounded-full bg-green-500/10 text-green-400 text-xs font-medium border border-green-500/20",children:i.message||"Success"})]}),e.jsxs("div",{className:"space-y-4",children:[(()=>{const t=i.result?.filter(s=>s.application_delegated)||[],n=i.result?.filter(s=>!s.application_delegated)||[],l=t.reduce((s,r)=>(s[r.permission_name]||(s[r.permission_name]=[]),s[r.permission_name].push(r),s),{});return e.jsxs(e.Fragment,{children:[Object.entries(l).map(([s,r])=>{const a=r[0];return e.jsxs("div",{className:"rounded-[14px] bg-slate-900/60 border border-slate-800/80 p-6 hover:border-cyan-400/30 transition-colors",children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-start md:justify-between gap-4 mb-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[e.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-bold border ${N("Graph")}`,children:"Graph"}),e.jsx("div",{className:"text-cyan-400 text-sm font-semibold",children:a.service})]}),e.jsx("h3",{className:"text-xl font-bold text-white font-mono break-all",children:s})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:a.allowed_action&&e.jsx("span",{className:`px-3 py-1 rounded-full text-sm font-medium border ${a.allowed_action.toLowerCase().includes("write")||a.allowed_action.toLowerCase().includes("delete")?"bg-red-500/10 text-red-400 border-red-500/20":"bg-blue-500/10 text-blue-400 border-blue-500/20"}`,children:a.allowed_action})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[a.resource_type&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-slate-500 text-xs uppercase tracking-wider font-semibold mb-2",children:"Resource Type"}),e.jsx("span",{className:"px-2 py-1 rounded bg-slate-800 border border-slate-700 text-xs font-mono text-cyan-300",children:a.resource_type})]}),a.data_access_type&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-slate-500 text-xs uppercase tracking-wider font-semibold mb-2",children:"Data Access Type"}),e.jsx("div",{className:"text-white",children:a.data_access_type})]})]}),e.jsx("div",{className:"space-y-4",children:r.map((o,h)=>e.jsxs("div",{className:`rounded-lg border p-4 ${o.application_delegated==="Application"?"bg-emerald-500/5 border-emerald-500/20":"bg-amber-500/5 border-amber-500/20"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-bold border ${o.application_delegated==="Application"?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:o.application_delegated}),o.display_text&&e.jsxs("span",{className:"text-slate-300 text-sm font-medium",children:['"',o.display_text,'"']})]}),o.description&&e.jsx("p",{className:"text-slate-400 text-sm mb-3",children:o.description}),o.admin_consent_required&&o.admin_consent_required!=="-"&&e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-slate-500",children:"Admin Consent:"}),e.jsx("span",{className:`px-2 py-0.5 rounded font-medium ${o.admin_consent_required.toLowerCase()==="yes"?"bg-red-500/10 text-red-400 border border-red-500/20":"bg-green-500/10 text-green-400 border border-green-500/20"}`,children:o.admin_consent_required})]})]},h))}),a.last_updated&&e.jsxs("div",{className:"pt-4 mt-4 border-t border-slate-800 text-xs text-slate-500 flex justify-end",children:["Last Updated: ",new Date(a.last_updated).toLocaleStr
1ing()]})]},s)}),n.map((s,r)=>e.jsxs("div",{className:"rounded-[14px] bg-slate-900/60 border border-slate-800/80 p-6 hover:border-cyan-400/30 transition-colors",children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-start md:justify-between gap-4 mb-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[m(s.permission_name)&&e.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-bold border ${N(m(s.permission_name))}`,children:m(s.permission_name)}),e.jsx("div",{className:"text-cyan-400 text-sm font-semibold",children:s.service})]}),e.jsx("h3",{className:"text-xl font-bold text-white font-mono break-all",children:s.permission_name})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.allowed_action&&e.jsx("span",{className:`px-3 py-1 rounded-full text-sm font-medium border ${s.allowed_action.toLowerCase().includes("write")||s.allowed_action.toLowerCase().includes("delete")?"bg-red-500/10 text-red-400 border-red-500/20":"bg-blue-500/10 text-blue-400 border-blue-500/20"}`,children:s.allowed_action})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-4",children:[s.description&&z(s.description),s.data_access_type&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-slate-500 text-xs uppercase tracking-wider font-semibold mb-2",children:"Data Access Type"}),e.jsx("div",{className:"text-white",children:s.data_access_type})]}),s.resource_types&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-slate-500 text-xs uppercase tracking-wider font-semibold mb-2",children:"Resource Types"}),L(s.resource_types)]})]}),s.last_updated&&e.jsxs("div",{className:"pt-4 border-t border-slate-800 text-xs text-slate-500 flex justify-end",children:["Last Updated: ",new Date(s.last_updated).toLocaleString()]})]},r))]})})(),(!i.result||i.result.length===0)&&e.jsxs("div",{className:"text-center py-8 text-slate-500 bg-slate-900/30 rounded-[14px] border border-slate-800/80",children:[e.jsx("p",{className:"text-lg font-medium text-slate-400 mb-2",children:"Sorry, we don't have additional context on this permission."}),e.jsx("p",{className:"text-sm text-slate-600 max-w-md mx-auto",children:"We prioritize providing context for the riskiest and most impactful permissions. This permission may be considered lower risk or standard."})]})]})]}),e.jsx(R,{isAuthenticated:j,intro:"Cloud Permissions Context is lightweight and well suited for automation. We recommend integrating it as an API call into your IAM review workflows.",api:{endpoint:"https://api.bluelanternsecurity.io/cloud-permissions-context",method:"POST",description:"Send a JSON body with the cloud IAM permission to look up. Requires an API key from API Access.",note:"Best used as an API call. Eac
1h lookup is lightweight, so batching from your own scripts or pipelines is the most efficient way to enrich many permissions at once.",body:{type:"json",json:{permission:"iam:PassRole"}},docsLink:{to:"/documentation/saas-tools/cloud-permissions-context",label:"Cloud Permissions Context docs"}}})]}),e.jsx(W,{open:v,onClose:()=>f(!1),toolName:"Cloud Permissions Context"})]})}export{D as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.