这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 41 additions & 41 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@cdcdbb579706841c47f7063dda365e292e5cad7a # codeql-bundle-v2.13.4
uses: github/codeql-action/init@7b6664fa89524ee6e3c3e9749402d5afd69b3cd8 # codeql-bundle-v2.14.1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -57,7 +57,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@cdcdbb579706841c47f7063dda365e292e5cad7a # codeql-bundle-v2.13.4
uses: github/codeql-action/autobuild@7b6664fa89524ee6e3c3e9749402d5afd69b3cd8 # codeql-bundle-v2.14.1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -70,4 +70,4 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@cdcdbb579706841c47f7063dda365e292e5cad7a # codeql-bundle-v2.13.4
uses: github/codeql-action/analyze@7b6664fa89524ee6e3c3e9749402d5afd69b3cd8 # codeql-bundle-v2.14.1
3 changes: 3 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ jobs:
platform: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.platform }}
steps:
- uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3
with:
terraform_version: 1.5.4
- name: Checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Install Go
Expand Down
20 changes: 17 additions & 3 deletions src/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,26 @@ func GetBlockAttributes(attributes []string, block *hclsyntax.Block) []string {
for _, attribute := range block.Body.Attributes {
attributes = append(attributes, attribute.Name)
}

for _, block := range block.Body.Blocks {
// Also add in block names
if block.Type != "resource" {
attributes = append(attributes, block.Type)

switch block.Type {
case "dynamic":
{
attributes = append(attributes, block.Labels...)
}
case "resource":
{
//do nothing
}
default:
{
attributes = append(attributes, block.Type)
attributes = GetBlockAttributes(attributes, block)
}
}

attributes = GetBlockAttributes(attributes, block)
}

return attributes
Expand All @@ -174,6 +187,7 @@ func GetBlockAttributes(attributes []string, block *hclsyntax.Block) []string {
// GetPermission determines the IAM permissions required and returns a list of permission
func GetPermission(result ResourceV2) (Sorted, error) {
var err error

var myPermission Sorted

switch result.Provider {
Expand Down
46 changes: 23 additions & 23 deletions src/mapping/aws/resource/autoscaling/aws_autoscaling_group.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
[
{
"apply": [
"autoscaling:CreateAutoScalingGroup",
"autoscaling:DescribeAutoScalingGroups",
"autoscaling:DescribeScalingActivities",
"autoscaling:UpdateAutoScalingGroup",
"autoscaling:DeleteAutoScalingGroup"
],
"attributes": {
"tags": [
"autoscaling:CreateOrUpdateTags",
"autoscaling:DeleteTags"
]
},
"destroy": [
"autoscaling:UpdateAutoScalingGroup",
"autoscaling:DeleteAutoScalingGroup"
],
"modify": [],
"plan": []
}
]
[
{
"apply": [
"autoscaling:CreateAutoScalingGroup",
"autoscaling:DescribeAutoScalingGroups",
"autoscaling:DescribeScalingActivities",
"autoscaling:UpdateAutoScalingGroup",
"autoscaling:DeleteAutoScalingGroup"
],
"attributes": {
"tag": [
"autoscaling:CreateOrUpdateTags",
"autoscaling:DeleteTags"
]
},
"destroy": [
"autoscaling:UpdateAutoScalingGroup",
"autoscaling:DeleteAutoScalingGroup"
],
"modify": [],
"plan": []
}
]
10 changes: 9 additions & 1 deletion src/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/rs/zerolog/log"
)

const tfVersion = "1.3.5"
const tfVersion = "1.5.4"

// Scan looks for resources in a given directory
func Scan(dirName string, output string, file *string, init bool, write bool) error {
Expand All @@ -41,11 +41,13 @@ func Scan(dirName string, output string, file *string, init bool, write bool) er
func WriteOutput(OutPolicy OutputPolicy, output, location string) error {
newPath, _ := filepath.Abs(location + "/.pike")
err := os.MkdirAll(newPath, os.ModePerm)

if err != nil {
return err
}

var outFile string

d1 := []byte(OutPolicy.AsString(output))

switch strings.ToLower(output) {
Expand Down Expand Up @@ -98,10 +100,12 @@ func Init(dirName string) (*string, []string, error) {

//filter
var found []string

for _, module := range modules {
if module.Name() == "modules.json" || module.Name() == ".DS_Store" {
continue
}

found = append(found, module.Name())
}

Expand Down Expand Up @@ -131,6 +135,7 @@ func LocateTerraform() (string, error) {
return "", err
}
}

return tfPath, nil
}

Expand Down Expand Up @@ -179,6 +184,7 @@ func MakePolicy(dirName string, file *string, init bool) (OutputPolicy, error) {
}

var resources []ResourceV2

for _, tfFile := range files {

resource, err := GetResources(tfFile, dirName)
Expand All @@ -191,6 +197,7 @@ func MakePolicy(dirName string, file *string, init bool) (OutputPolicy, error) {
resources = append(resources, resource...)
}
}

var PermissionBag Sorted

var newPerms Sorted
Expand All @@ -212,6 +219,7 @@ func MakePolicy(dirName string, file *string, init bool) (OutputPolicy, error) {
if err2 != nil {
return Output, err2
}

return Output, nil
}

Expand Down
Loading