diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..f9ecf8de --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,45 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + + # Maintain dependencies for go modules + - package-ecosystem: "gomod" + directory: "/" + schedule: + interval: "weekly" + target-branch: "main" + commit-message: + prefix: "chore" + include: "scope" + labels: + - "Type: Maintenance" + allow: + - dependency-name: "github.com/projectdiscovery/*" + +# # Maintain dependencies for docker +# - package-ecosystem: "docker" +# directory: "/" +# schedule: +# interval: "weekly" +# target-branch: "dev" +# commit-message: +# prefix: "chore" +# include: "scope" +# labels: +# - "Type: Maintenance" +# +# # Maintain dependencies for GitHub Actions +# - package-ecosystem: "github-actions" +# directory: "/" +# schedule: +# interval: "weekly" +# target-branch: "dev" +# commit-message: +# prefix: "chore" +# include: "scope" +# labels: +# - "Type: Maintenance" \ No newline at end of file diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 00000000..596ba07b --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,17 @@ +changelog: + exclude: + authors: + - dependabot + categories: + - title: 🎉 New Features + labels: + - "Type: Enhancement" + - title: 🐞 Bugs Fixes + labels: + - "Type: Bug" + - title: 🔨 Maintenance + labels: + - "Type: Maintenance" + - title: Other Changes + labels: + - "*" \ No newline at end of file diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index dd68bf9c..db524608 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: pull_request: branches: - - dev + - main paths: - '**.go' - '**.mod' @@ -14,8 +14,8 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, windows-latest, macOS-12] - go-version: [1.19.x, 1.20.x] + os: [ubuntu-latest, windows-latest, macOS-latest] + go-version: [1.20.x] steps: - name: Set up Go uses: actions/setup-go@v4 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 90c913a9..8cbfee66 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: pull_request: branches: - - dev + - main paths: - '**.go' - '**.mod' diff --git a/.github/workflows/dep-auto-merge.yml b/.github/workflows/dep-auto-merge.yml new file mode 100644 index 00000000..fc26472d --- /dev/null +++ b/.github/workflows/dep-auto-merge.yml @@ -0,0 +1,26 @@ +name: 🤖 dep auto merge + +on: + pull_request: + branches: + - main + workflow_dispatch: + +permissions: + pull-requests: write + issues: write + repository-projects: write + +jobs: + automerge: + runs-on: ubuntu-latest + if: github.actor == 'dependabot[bot]' + steps: + - uses: actions/checkout@v3 + with: + token: ${{ secrets.DEPENDABOT_PAT }} + + - uses: ahmadnassri/action-dependabot-auto-merge@v2 + with: + github-token: ${{ secrets.DEPENDABOT_PAT }} + target: all \ No newline at end of file diff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint-test.yml index 44158a33..a276e024 100644 --- a/.github/workflows/lint-test.yml +++ b/.github/workflows/lint-test.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: pull_request: branches: - - dev + - main paths: - '**.go' - '**.mod' @@ -19,7 +19,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: 1.20.x cache: true - name: Run golangci-lint diff --git a/.github/workflows/release-binary.yml b/.github/workflows/release-binary.yml index 12382a7d..a4b181dc 100644 --- a/.github/workflows/release-binary.yml +++ b/.github/workflows/release-binary.yml @@ -10,21 +10,21 @@ jobs: release: runs-on: ubuntu-latest-16-cores steps: - - name: "Check out code" + - name: Check out code uses: actions/checkout@v3 with: fetch-depth: 0 - - name: "Set up Go" + - name: Set up Go uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: 1.20.x cache: true - name: "Create release on GitHub" uses: goreleaser/goreleaser-action@v4 with: - args: "release --rm-dist" + args: "release --clean" version: latest workdir: . env: diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml new file mode 100644 index 00000000..3b1f37f6 --- /dev/null +++ b/.github/workflows/release-test.yml @@ -0,0 +1,30 @@ +name: 🔨 Release Test + +on: + pull_request: + paths: + - '**.go' + - '**.mod' + - '**.yml' + workflow_dispatch: + +jobs: + release-test: + runs-on: ubuntu-latest-16-cores + steps: + - name: Check out code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: 1.20.x + + - name: release test + uses: goreleaser/goreleaser-action@v4 + with: + args: "release --clean --snapshot" + version: latest + workdir: . \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml index a27d2141..e84b342f 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -16,6 +16,8 @@ builds: - arm64 ignore: + - goos: darwin + goarch: 386 - goos: windows goarch: arm - goos: windows @@ -26,8 +28,7 @@ builds: archives: - format: zip - replacements: - darwin: macOS + name_template: '{{ .ProjectName }}_{{ .Version }}_{{ if eq .Os "darwin" }}macOS{{ else }}{{ .Os }}{{ end }}_{{ .Arch }}' checksum: algorithm: sha256 @@ -37,7 +38,7 @@ announce: enabled: true channel: '#release' username: GoReleaser - message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}' + message_template: 'New Release: {{ .ProjectName }} {{.Tag}} is published! Check it out at {{ .ReleaseURL }}' discord: enabled: true diff --git a/inputs_test.go b/inputs_test.go index 56277105..98d853a1 100644 --- a/inputs_test.go +++ b/inputs_test.go @@ -62,9 +62,10 @@ func TestExtractVar(t *testing.T) { }{ {statement: "{{sub}}.something.{{tld}}", expected: []string{"sub", "tld"}}, {statement: "{{sub}}.{{sub1}}.{{sub2}}.{{root}}", expected: []string{"sub", "sub1", "sub2", "root"}}, - {statement: "no variables", expected: []string{}}, + {statement: "no variables", expected: nil}, } for _, v := range testcases { - require.Equal(t, v.expected, getAllVars(v.statement)) + actual := getAllVars(v.statement) + require.Equal(t, v.expected, actual) } } diff --git a/internal/runner/banner.go b/internal/runner/banner.go index 201d05db..a2f6f753 100644 --- a/internal/runner/banner.go +++ b/internal/runner/banner.go @@ -12,7 +12,7 @@ var banner = ` /_/ |_/_/\__/\__/_/ /_/|_| ` -var version = "v0.0.2" +var version = "v0.0.3" // showBanner is used to show the banner to the user func showBanner() { diff --git a/mutator_test.go b/mutator_test.go index b62fb44c..4471457d 100644 --- a/mutator_test.go +++ b/mutator_test.go @@ -2,6 +2,7 @@ package alterx import ( "bytes" + "math" "strings" "testing" @@ -39,6 +40,7 @@ func TestMutatorResults(t *testing.T) { } opts.Patterns = testConfig.Patterns opts.Payloads = testConfig.Payloads + opts.MaxSize = math.MaxInt m, err := New(opts) require.Nil(t, err) var buff bytes.Buffer