Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzmish committed Jan 12, 2024
0 parents commit 1648fb6
Show file tree
Hide file tree
Showing 38 changed files with 4,830 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"image": "node:20-bookworm",
"containerEnv": {
"GIT_EDITOR": "code --wait"
},
"customizations": {
"vscode": {
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"mhutchie.git-graph"
]
}
},
"mounts": [
{
"type": "volume",
"source": "cw-iam-cache-node_modules",
"target": "${containerWorkspaceFolder}/node_modules"
}
]
}
26 changes: 26 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: deploy

on:
workflow_dispatch:
push:
branches:
- main

jobs:
deploy:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: yarn
- run: yarn install --immutable
- run: yarn build
- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
allow_empty_commit: true
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/dist

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"arrowParens": "avoid",
"printWidth": 120,
"semi": false,
"trailingComma": "none"
}
18 changes: 18 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true,
"**/data/iam-dataset": true
},
"[javascript][javascriptreact][typescript][typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
}
},
"eslint.experimental.useFlatConfig": true,
"typescript.updateImportsOnFileMove.enabled": "always"
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 fuzmish

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# cw-iam
1 change: 1 addition & 0 deletions data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/iam-dataset
17 changes: 17 additions & 0 deletions data/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -euxo pipefail

cd "$(dirname $0)"

if [ -d ./iam-dataset ]; then
rm -fr ./iam-dataset
fi

git clone --depth=1 --no-checkout --filter=tree:0 https://github.com/iann0036/iam-dataset.git
cd iam-dataset
git sparse-checkout set --no-cone \
'gcp/role_permissions.json' \
'aws/managed_policies.json' \
'aws/iam_definition.json'
git checkout
cd ..
41 changes: 41 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const typescript = require("@typescript-eslint/eslint-plugin")
const typescriptParser = require("@typescript-eslint/parser")
const prettier = require("eslint-config-prettier")
const react = require("eslint-plugin-react")

module.exports = [
{
ignores: ["./dist"]
},
{
files: ["**/*.{ts,tsx}"],
languageOptions: {
parser: typescriptParser
},
plugins: {
"@typescript-eslint": typescript
},
rules: {
...typescript.configs["eslint-recommended"].rules,
...typescript.configs["recommended"].rules,
"@typescript-eslint/no-unused-vars": ["error", { varsIgnorePattern: "^_" }]
}
},
{
files: ["**/*.{js,jsx,ts,tsx}"],
settings: {
react: {
version: "detect"
}
},
plugins: {
react: react
},
rules: {
...react.configs.recommended.rules,
"react/jsx-sort-props": "error",
"react/react-in-jsx-scope": "off", // it should be disabled when tsconfig.json/compilerOptions.jsx is "react-jsx"
...prettier.rules
}
}
]
14 changes: 14 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="data:image/svg+xml;charset=UTF-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNTEyIiB3aWR0aD0iNTEyIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+PCEtLSFGb250IEF3ZXNvbWUgRnJlZSA2LjUuMSBieSBAZm9udGF3ZXNvbWUgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbSBMaWNlbnNlIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20vbGljZW5zZS9mcmVlIENvcHlyaWdodCAyMDI0IEZvbnRpY29ucywgSW5jLi0tPjxwYXRoIGZpbGw9IiNkNDIyMGYiIGQ9Ik0xN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y4yLTE2IDE2djE2SDM1MlYyMDhjMC04LjgtNy4yLTE2LTE2LTE2SDMyMGMtOC44IDAtMTYgNy4yLTE2IDE2em04MCA5NmMwLTguOCA3LjItMTYgMTYtMTZzMTYgNy4yIDE2IDE2djMySDM4NFYzMDR6Ii8+PC9zdmc+" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>cw-iam</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
49 changes: 49 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"name": "cw-iam",
"version": "0.0.1",
"private": true,
"homepage": "https://fuzmish.github.io/cw-iam",
"type": "module",
"dependencies": {
"fuse.js": "^7.0.0",
"highlight.js": "^11.9.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^4.12.0",
"react-resizable-panels": "^1.0.8",
"react-router-dom": "^6.21.1",
"react-virtuoso": "^4.6.2",
"sanitize-html": "^2.11.0",
"swr": "^2.2.4"
},
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@types/react-dom": "^18.2.18",
"@types/sanitize-html": "^2.9.5",
"@typescript-eslint/eslint-plugin": "^6.18.1",
"@typescript-eslint/parser": "^6.18.1",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-react": "^7.33.2",
"prettier": "^3.1.1",
"typescript": "^5.3.3",
"vite": "^5.0.11"
}
}
24 changes: 24 additions & 0 deletions src/components/amazon/actions/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { useParams } from "react-router-dom"
import { useAmazonActions } from "../../../data"
import { CommonDetail, CommonPanel } from "../../common"

export function AmazonActions() {
const { data, error } = useAmazonActions()
return <CommonPanel data={data} error={error} keys={[{ displayName: "action", primary: true, noSelection: true }]} />
}

export function AmazonActionsDetail() {
const { key } = useParams()
const { data, error } = useAmazonActions()
return (
<CommonDetail
data={data}
displayProperties={["action", "description"]}
displayPropertiesForJson={["action", "description", "privilege", "resource_types", "conditions", "service"]}
entryKey={key}
error={error}
noSelection={true}
titleForKey="AWS / IAM Actions / Detail"
/>
)
}
59 changes: 59 additions & 0 deletions src/components/amazon/policies/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { useParams } from "react-router-dom"
import { useAmazonPolicies } from "../../../data"
import { CommonCompare, CommonDetail, CommonPanel } from "../../common"

export function AmazonPolicies() {
const { data, error } = useAmazonPolicies()
return (
<CommonPanel
data={data}
error={error}
keys={[
{ primary: true, displayName: "name" },
{ name: "actions", getFn: ({ value }) => value.effective_action_names.toSorted().join("\n") }
]}
/>
)
}

export function AmazonPoliciesDetail() {
const { data, error } = useAmazonPolicies()
const { key } = useParams()
return (
<CommonDetail
data={data}
displayProperties={["name", "arn", "createdate", "updatedate", "version", "deprecated"]}
displayPropertiesForJson={[
"arn",
"createdate",
"deprecated",
"effective_action_names",
"name",
"updatedate",
"version"
]}
entryKey={key}
entryToItems={entry => entry.effective_action_names}
error={error}
filterKeyForItems="actions"
routePrefixForItemsDetail="../../actions/"
titleForItems="Actions"
titleForKey="AWS / Managed Policies / Detail"
/>
)
}

export function AmazonPoliciesCompare() {
const { data, error } = useAmazonPolicies()
return (
<CommonCompare
data={data}
entryToItems={entry => entry.effective_action_names.map(key => ({ key }))}
error={error}
routePrefixForItemsDetail="../../actions/"
title="AWS / Managed Policies / Compare"
titleForComparison="Actions"
titleForSelection="Selected policies"
/>
)
}
Loading

0 comments on commit 1648fb6

Please sign in to comment.