Skip to content

Commit

Permalink
feat(CG-1291): add gcp cis 130 boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
james-zhou-inspire11 committed Oct 20, 2022
1 parent 2f8b0c7 commit f7d6418
Show file tree
Hide file tree
Showing 9 changed files with 209 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/gcp/cis-1.3.0/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
rules/
tests/
*.bak
.*
jest.config.js
tsconfig.json
**/*.ts
!dist/**/*.d.ts
!dist/**/*.js
39 changes: 39 additions & 0 deletions src/gcp/cis-1.3.0/.releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
branches:
- name: alpha
channel: alpha
prerelease: true
- name: beta
channel: beta
prerelease: true
- name: main

dryRun: false

plugins:
- "@semantic-release/commit-analyzer"
- "@semantic-release/release-notes-generator"
- - "@semantic-release/changelog"
- changelogFile: CHANGELOG.md
- - "@semantic-release/git"
- assets:
- CHANGELOG.md
- package.json
- - "semantic-release-pnpm"
- npmPublish: true
- "@semantic-release/github"
verifyConditions:
- "@semantic-release/changelog"
- "@semantic-release/github"
- "semantic-release-pnpm"
prepare:
- "@semantic-release/changelog"
- "semantic-release-pnpm"
- - "@semantic-release/git"
- message: "chore(release): @cloudgraph/policy-pack-gcp-cis-1.3.0 ${nextRelease.version} \n\n${nextRelease.notes}"
publish:
- "@semantic-release/github"
- "semantic-release-pnpm"
success: false
fail: false
tagFormat: "@cloudgraph/policy-pack-gcp-cis-1.3.0@${version}"
3 changes: 3 additions & 0 deletions src/gcp/cis-1.3.0/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Features

### Bug Fixes
57 changes: 57 additions & 0 deletions src/gcp/cis-1.3.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# CIS Google Cloud Platform Foundations 1.3.0

Policy Pack based on the GCP Foundations 1.3.0 benchmark provided by the [Center for Internet Security (CIS)](https://www.cisecurity.org/benchmark/google_cloud_computing_platform/)

## First Steps

1. Install [Cloud Graph CLI](https://docs.cloudgraph.dev/quick-start).
2. Set up the [GCP Provider](https://www.npmjs.com/package/@cloudgraph/cg-provider-gcp) for CG with the `cg init gcp` command.
3. Add Policy Pack for CIS Google Cloud Platform Foundations benchmark using `cg policy add gcp-cis-1.3.0` command.
4. Execute the ruleset using the scan command `cg scan gcp`.
5. Query the findings using the different options:

5a. Querying findings by provider:

```graphql
query {
querygcpFindings {
CISFindings {
id
resourceId
result
}
}
}
```

5b. Querying findings by specific benchmark:

```graphql
query {
querygcpCISFindings {
id
resourceId
result
}
}
```

5c. Querying findings by resource:

```graphql
query {
querygcpIamPolicy {
id
CISFindings {
id
resourceId
result
}
}
}
```

## Available Ruleset

| Rule | Description |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
7 changes: 7 additions & 0 deletions src/gcp/cis-1.3.0/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import PolicyPacksRules from './rules'

export default {
provider: 'gcp',
entity: 'CIS',
rules: PolicyPacksRules,
}
7 changes: 7 additions & 0 deletions src/gcp/cis-1.3.0/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['<rootDir>/tests/**/*.test.ts'],
testPathIgnorePatterns: ['<rootDir>/lib/', '<rootDir>/node_modules/'],
}
64 changes: 64 additions & 0 deletions src/gcp/cis-1.3.0/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "@cloudgraph/policy-pack-gcp-cis-1.3.0",
"description": "Policy pack implementing CIS Google Cloud Platform Foundations 1.3.0 Benchmark",
"version": "1.0.0",
"author": "AutoCloud",
"license": "MPL-2.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"repository": {
"type": "git",
"url": "git+/~https://github.com/cloudgraphdev/cloudgraph-policy-packs.git",
"directory": "src/gcp/cis-1.2.0"
},
"bugs": {
"url": "/~https://github.com/cloudgraphdev/cloudgraph-policy-packs/issues"
},
"publishConfig": {
"access": "public"
},
"directories": {
"test": "tests"
},
"devDependencies": {
"@autocloud/eslint-config": "^0.1.0",
"@cloudgraph/sdk": "^0.21.1",
"@types/jest": "^27.4.0",
"@types/node": "^17.0.8",
"@types/pino": "^6.3.11",
"@typescript-eslint/eslint-plugin": "^4.28.5",
"@typescript-eslint/parser": "^4.28.5",
"cpx": "^1.5.0",
"cuid": "^2.1.8",
"eslint": "^7.25.0",
"eslint-config-airbnb-base": "14.2.1",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^3.4.0",
"jest": "^27.0.6",
"prettier": "^2.5.1",
"shx": "^0.3.3",
"ts-jest": "^27.0.4",
"tslib": "^1",
"typescript": "^4.3.5"
},
"engines": {
"node": ">=16.0.0"
},
"homepage": "https://www.cloudgraph.dev/",
"keywords": [
"cloudgraph"
],
"prettier": {
"semi": false,
"singleQuote": true,
"arrowParens": "avoid"
},
"scripts": {
"build": "pnpm prepack",
"clean": "rm -rf dist",
"lint": "eslint",
"prepack": "pnpm clean && tsc -b",
"test": "NODE_ENV=test jest"
}
}
3 changes: 3 additions & 0 deletions src/gcp/cis-1.3.0/rules/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default [

]
20 changes: 20 additions & 0 deletions src/gcp/cis-1.3.0/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"declaration": true,
"importHelpers": true,
"module": "commonjs",
"outDir": "dist",
"rootDir": "./",
"strict": true,
"target": "es2020",
"lib": ["esnext.array", "ES2020.Promise"],
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": [
"**/*"
],
"exclude": ["dist", "./tests"]
}

0 comments on commit f7d6418

Please sign in to comment.