diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f33a02c..617f85e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,12 +1,28 @@ -# 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 more information: -# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates -# https://containers.dev/guide/dependabot - version: 2 updates: - - package-ecosystem: "devcontainers" - directory: "/" - schedule: - interval: weekly + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + cooldown: + default-days: 7 + groups: + actions: + patterns: ["*"] + + - package-ecosystem: gomod + directory: / + schedule: + interval: weekly + cooldown: + default-days: 7 + semver-major-days: 30 + groups: + go-dependencies: + patterns: ["*"] + open-pull-requests-limit: 5 + + - package-ecosystem: devcontainers + directory: / + schedule: + interval: weekly diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 860146b..771558c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,20 +1,33 @@ name: CI +# Security notes: +# - Uses `pull_request` (never `pull_request_target`): fork PRs run with a +# read-only token and without access to repository secrets. +# - Third-party actions are pinned to a full commit SHA (a tag can be moved). + on: push: branches: [main] pull_request: + branches: [main] permissions: contents: read +concurrency: + group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: test: runs-on: ubuntu-latest + timeout-minutes: 15 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - - uses: actions/setup-go@v5 + - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: go-version-file: go.mod @@ -29,3 +42,11 @@ jobs: - name: Build run: go build ./... + + - name: Verify module checksums + run: go mod verify + + - name: Vulnerability scan (govulncheck) + run: | + go install golang.org/x/vuln/cmd/govulncheck@v1.1.4 + govulncheck ./... diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..c1ac2c0 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,36 @@ +name: CodeQL + +on: + push: + branches: [main] + pull_request: + branches: [main] + schedule: + - cron: '23 4 * * 1' + +permissions: + contents: read + +jobs: + analyze: + runs-on: ubuntu-latest + timeout-minutes: 30 + permissions: + contents: read + security-events: write + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 + with: + go-version-file: go.mod + + - uses: github/codeql-action/init@24c54180a607b1449ed407dd24f251e4e9147c8d # v4.38.3 + with: + languages: go + + - uses: github/codeql-action/autobuild@24c54180a607b1449ed407dd24f251e4e9147c8d # v4.38.3 + + - uses: github/codeql-action/analyze@24c54180a607b1449ed407dd24f251e4e9147c8d # v4.38.3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8e1d04f..7ede566 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,46 +1,61 @@ -# .github/workflows/release.yml name: Release Go Binaries +# Security notes: +# - Default token is read-only; only the release job elevates to contents: write. +# - Third-party actions are pinned to a full commit SHA. +# - The tag name is passed through an env var, never interpolated into the shell. + on: push: tags: - 'v*' workflow_dispatch: +permissions: + contents: read + jobs: build-and-release: name: Build and Release runs-on: ubuntu-latest + timeout-minutes: 20 permissions: contents: write + env: + REF_NAME: ${{ github.ref_name }} steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Setup Go - uses: actions/setup-go@v5 + uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: go-version-file: go.mod - name: Build binaries - run: make build VERSION=${{ github.ref_name }} - + run: make build VERSION="${REF_NAME}" + - name: Package artifacts run: | - # Crea un directorio para los archivos comprimidos mkdir -p release_packages - - # Comprime cada conjunto de binarios en un archivo tar.gz o .zip - cd dist/${{ github.ref_name }} + + cd "dist/${REF_NAME}" tar -czf ../../release_packages/azdevops_linux_amd64.tar.gz -C linux-amd64 . tar -czf ../../release_packages/azdevops_linux_arm64.tar.gz -C linux-arm64 . tar -czf ../../release_packages/azdevops_darwin_amd64.tar.gz -C darwin-amd64 . tar -czf ../../release_packages/azdevops_darwin_arm64.tar.gz -C darwin-arm64 . zip -r ../../release_packages/azdevops_windows_amd64.zip windows-amd64 + - name: Generate checksums + run: | + cd release_packages + sha256sum * > checksums.txt + - name: Create GitHub Release - uses: ncipollo/release-action@v1 + uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21.0 with: artifacts: "release_packages/*" bodyFile: "RELEASE_NOTES.md" diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..6662a53 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,20 @@ +# Security Policy + +## Supported versions + +Only the latest release receives security fixes. + +## Reporting a vulnerability + +Please do **not** open a public issue for security problems. + +Use GitHub's private reporting: **Security → Report a vulnerability** in this repository. +If that is unavailable, contact the maintainer through the email on their GitHub profile. + +You can expect an initial response within 7 days. Please include the affected version, +steps to reproduce and the potential impact. + +## Scope notes + +This tool handles Azure DevOps Personal Access Tokens. Never paste a real PAT in an issue or log. +If you believe a token was leaked, revoke it in Azure DevOps immediately. diff --git a/go.mod b/go.mod index aeeebaf..84083bd 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module azuredevops -go 1.23.9 +go 1.26.9 require ( github.com/charmbracelet/huh v1.0.0 @@ -9,7 +9,7 @@ require ( github.com/mattn/go-isatty v0.0.20 github.com/spf13/cobra v1.9.1 github.com/zalando/go-keyring v0.2.8 - golang.org/x/text v0.23.0 + golang.org/x/text v0.42.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -39,6 +39,6 @@ require ( github.com/rivo/uniseg v0.4.7 // indirect github.com/spf13/pflag v1.0.6 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect - golang.org/x/sync v0.15.0 // indirect + golang.org/x/sync v0.23.0 // indirect golang.org/x/sys v0.33.0 // indirect ) diff --git a/go.sum b/go.sum index b561494..cf39d85 100644 --- a/go.sum +++ b/go.sum @@ -93,14 +93,14 @@ github.com/zalando/go-keyring v0.2.8 h1:6sD/Ucpl7jNq10rM2pgqTs0sZ9V3qMrqfIIy5YPc github.com/zalando/go-keyring v0.2.8/go.mod h1:tsMo+VpRq5NGyKfxoBVjCuMrG47yj8cmakZDO5QGii0= golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= -golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8= -golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk= +golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= -golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= +golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= +golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=