@htekdev/actions-debugger 1.0.19 → 1.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,104 @@
1
+ id: permissions-auth-024
2
+ title: "Fine-Grained PATs Blocked by Organization Policy — 'forbidden from accessing this repository'"
3
+ category: permissions-auth
4
+ severity: error
5
+ tags:
6
+ - fine-grained-pat
7
+ - organization-policy
8
+ - personal-access-token
9
+ - authentication
10
+ - 403
11
+ patterns:
12
+ - regex: "Fine-grained personal access tokens are forbidden from accessing this repository"
13
+ flags: "i"
14
+ - regex: "fine.grained.*forbidden|forbidden.*fine.grained"
15
+ flags: "i"
16
+ - regex: "personal access tokens.*not permitted|PAT.*restricted"
17
+ flags: "i"
18
+ error_messages:
19
+ - "remote: Fine-grained personal access tokens are forbidden from accessing this repository."
20
+ - "fatal: unable to access 'https://github.com/org/repo.git/': The requested URL returned error: 403"
21
+ - "Fine-grained personal access tokens are forbidden from accessing this repository."
22
+ root_cause: |
23
+ GitHub organizations can restrict which types of PATs are allowed to access their
24
+ resources. When an organization enables "Restrict access via fine-grained personal
25
+ access tokens" (or sets PAT policy to "Disable fine-grained personal access tokens"),
26
+ any fine-grained PAT — regardless of its scopes or permissions — will be rejected
27
+ with a 403 error containing the message "Fine-grained personal access tokens are
28
+ forbidden from accessing this repository."
29
+
30
+ This policy applies even if:
31
+ - The fine-grained PAT has all required permissions (contents: write, etc.)
32
+ - The PAT was created by an org owner
33
+ - The repository is public
34
+ - The user is an org admin
35
+
36
+ Common confusion: developers who switch from classic PATs to fine-grained PATs
37
+ for better security/granularity hit this org-level block and cannot understand
38
+ why a seemingly correct token still fails with 403.
39
+
40
+ Sources: stackoverflow.com/questions/79471500,
41
+ GitHub Docs on PAT policies for organizations
42
+ fix: |
43
+ Option 1 (Immediate fix): Use a classic PAT with the required scopes instead of
44
+ a fine-grained PAT. Classic PATs are not subject to the fine-grained restriction.
45
+
46
+ Option 2 (Organization change — requires admin): Have an org admin update the
47
+ organization's PAT policy to allow fine-grained PATs:
48
+ Settings → Developer Settings → Personal access token policy
49
+ → Allow fine-grained personal access tokens
50
+ → (optionally require approval for each token)
51
+
52
+ Option 3 (Recommended long-term): Replace the PAT with a GitHub App token.
53
+ GitHub App tokens are not subject to org-level PAT restrictions and provide
54
+ better auditability and short-lived credentials.
55
+ fix_code:
56
+ - language: yaml
57
+ label: "Use classic PAT (immediate workaround)"
58
+ code: |
59
+ # Replace the fine-grained PAT secret with a classic PAT:
60
+ # GitHub.com > Settings > Developer settings > Personal access tokens > Tokens (classic)
61
+ # Create new token with required scopes (e.g., repo)
62
+ # Add to repo secrets as CLASSIC_PAT
63
+
64
+ jobs:
65
+ deploy:
66
+ runs-on: ubuntu-latest
67
+ steps:
68
+ - uses: actions/checkout@v4
69
+ with:
70
+ token: ${{ secrets.CLASSIC_PAT }}
71
+ # Classic PATs work even when org blocks fine-grained PATs
72
+ - language: yaml
73
+ label: "Use a GitHub App token (recommended)"
74
+ code: |
75
+ jobs:
76
+ deploy:
77
+ runs-on: ubuntu-latest
78
+ steps:
79
+ - name: Generate GitHub App token
80
+ id: app-token
81
+ uses: actions/create-github-app-token@v1
82
+ with:
83
+ app-id: ${{ vars.APP_ID }}
84
+ private-key: ${{ secrets.APP_PRIVATE_KEY }}
85
+ owner: ${{ github.repository_owner }}
86
+ # GitHub App tokens bypass org-level PAT restrictions entirely
87
+
88
+ - uses: actions/checkout@v4
89
+ with:
90
+ token: ${{ steps.app-token.outputs.token }}
91
+ prevention:
92
+ - "Before using fine-grained PATs for org repositories, verify the org allows them via Settings → Third-party access → Personal access tokens."
93
+ - "Document the org's PAT policy in your CI/onboarding docs so contributors know which token types are accepted."
94
+ - "Prefer GitHub App tokens over any PAT type — they are not subject to PAT restriction policies and provide short-lived, auditable credentials."
95
+ - "When a PAT fails with 403, check if the error message contains 'fine-grained' before debugging scopes — the token type itself may be blocked."
96
+ docs:
97
+ - url: "https://docs.github.com/en/organizations/managing-programmatic-access-to-your-organization/setting-a-personal-access-token-policy-for-your-organization"
98
+ label: "Setting a PAT policy for your organization"
99
+ - url: "https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens"
100
+ label: "Managing personal access tokens"
101
+ - url: "https://stackoverflow.com/questions/79471500/github-actions-authentication-failed-for-pushing-to-repository"
102
+ label: "SO: GitHub Actions — Authentication Failed for Pushing to Repository (fine-grained PAT forbidden)"
103
+ - url: "https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/making-authenticated-api-requests-with-a-github-app-in-a-github-actions-workflow"
104
+ label: "Using GitHub App tokens in GitHub Actions"
@@ -0,0 +1,107 @@
1
+ id: permissions-auth-023
2
+ title: "PAT Fails with 'Not Found' on SSO-Protected Organization Repository"
3
+ category: permissions-auth
4
+ severity: error
5
+ tags:
6
+ - personal-access-token
7
+ - saml-sso
8
+ - organization
9
+ - checkout
10
+ - authentication
11
+ patterns:
12
+ - regex: "Not Found - https://docs\\.github\\.com/rest/repos/repos#get-a-repository"
13
+ flags: "i"
14
+ - regex: "fatal: unable to access.*403|Syncing repository.*Not Found"
15
+ flags: "i"
16
+ - regex: "could not read Username.*https://github\\.com"
17
+ flags: "i"
18
+ error_messages:
19
+ - "Not Found - https://docs.github.com/rest/repos/repos#get-a-repository"
20
+ - "Retrieving the default branch name"
21
+ - " Not Found - https://docs.github.com/rest/repos/repos#get-a-repository"
22
+ - "Error: Not Found - https://docs.github.com/rest/repos/repos#get-a-repository"
23
+ root_cause: |
24
+ When a GitHub organization enforces SAML SSO (Single Sign-On), every PAT
25
+ (Personal Access Token) used to access that organization's resources must be
26
+ explicitly authorized for the SSO organization — even if the token has all the
27
+ correct scopes (repo, read:org, etc.).
28
+
29
+ A PAT that hasn't been authorized for the SSO org will receive a 404 "Not Found"
30
+ response when attempting to access org resources via the API or when cloning/
31
+ checking out a repository. The response is 404 (not 401/403) because GitHub
32
+ treats an unauthorized SSO request as "resource doesn't exist for this token."
33
+
34
+ Common symptoms:
35
+ - `actions/checkout` fails with "Not Found" on the default branch retrieval step
36
+ - The PAT works locally in a browser (which has an active SSO session) but fails
37
+ in GitHub Actions
38
+ - The token has `repo` scope or `contents: read` permission but still 404s
39
+
40
+ Sources: stackoverflow.com/questions/79874764,
41
+ stackoverflow.com/questions/77957649,
42
+ GitHub Docs on SAML SSO authorization
43
+ fix: |
44
+ Authorize the PAT for the SSO organization:
45
+
46
+ 1. Go to GitHub → Settings → Developer settings → Personal access tokens
47
+ 2. Select the PAT used in the workflow
48
+ 3. Click "Configure SSO" next to the token
49
+ 4. Click "Authorize" next to the target organization
50
+ 5. Complete any SSO prompts
51
+
52
+ The PAT is now authorized for that org and will work in Actions workflows.
53
+
54
+ For fine-grained PATs: ensure the token's "Resource owner" is the organization
55
+ (not your personal account) and that the org admin has approved it.
56
+ fix_code:
57
+ - language: yaml
58
+ label: "Authorize the PAT for SSO org (no workflow change needed)"
59
+ code: |
60
+ # This is a GitHub settings action, not a workflow change.
61
+ # GitHub.com > Settings > Developer settings > Personal access tokens
62
+ # > (select token) > Configure SSO > Authorize > (org name)
63
+ #
64
+ # After authorizing, your workflow using the PAT will work:
65
+ jobs:
66
+ build:
67
+ runs-on: ubuntu-latest
68
+ steps:
69
+ - uses: actions/checkout@v4
70
+ with:
71
+ repository: my-org/private-repo
72
+ token: ${{ secrets.MY_ORG_PAT }}
73
+ # MY_ORG_PAT must have 'repo' scope AND be SSO-authorized for my-org
74
+ - language: yaml
75
+ label: "Use a GitHub App token instead (recommended for SSO orgs)"
76
+ code: |
77
+ jobs:
78
+ build:
79
+ runs-on: ubuntu-latest
80
+ steps:
81
+ - name: Generate GitHub App token
82
+ id: app-token
83
+ uses: actions/create-github-app-token@v1
84
+ with:
85
+ app-id: ${{ vars.APP_ID }}
86
+ private-key: ${{ secrets.APP_PRIVATE_KEY }}
87
+ owner: my-org
88
+ # GitHub App tokens for org installations are not subject to
89
+ # SAML SSO PAT authorization requirements
90
+ - uses: actions/checkout@v4
91
+ with:
92
+ repository: my-org/private-repo
93
+ token: ${{ steps.app-token.outputs.token }}
94
+ prevention:
95
+ - "After creating a new PAT for use with an SSO-enforcing organization, always authorize it via Configure SSO before adding it to Actions secrets."
96
+ - "Test PAT access locally with `gh auth login --with-token` and `gh repo view my-org/repo` to confirm SSO authorization before using in CI."
97
+ - "Prefer GitHub App tokens over PATs for organization repositories — they are not subject to SAML SSO authorization requirements."
98
+ - "Document which secrets require SSO authorization in your repo's CONTRIBUTING or CI documentation to prevent the same issue for new contributors."
99
+ docs:
100
+ - url: "https://docs.github.com/en/enterprise-cloud@latest/authentication/authenticating-with-saml-single-sign-on/authorizing-a-personal-access-token-for-use-with-saml-single-sign-on"
101
+ label: "Authorizing a PAT for use with SAML SSO"
102
+ - url: "https://docs.github.com/en/enterprise-cloud@latest/organizations/managing-saml-single-sign-on-for-your-organization/about-identity-and-access-management-with-saml-single-sign-on"
103
+ label: "About SAML SSO for organizations"
104
+ - url: "https://stackoverflow.com/questions/79874764/github-actions-checkout-fails-with-not-found-error-for-sso-protected-enterprise"
105
+ label: "SO: checkout fails with Not Found for SSO-protected enterprise repo"
106
+ - url: "https://stackoverflow.com/questions/77957649/repository-not-found-error-while-using-actions-checkoutv4-to-clone-a-private-re"
107
+ label: "SO: Repository not found error with actions/checkout@v4 on private repo"
@@ -0,0 +1,143 @@
1
+ id: runner-environment-052
2
+ title: "Docker Multi-Platform Build Uses Matrix per Platform — Tags Overwrite Each Other"
3
+ category: runner-environment
4
+ severity: silent-failure
5
+ tags:
6
+ - docker
7
+ - buildx
8
+ - multi-platform
9
+ - matrix
10
+ - ghcr
11
+ - manifest
12
+ patterns:
13
+ - regex: "no matching manifest for .* in the manifest list entries"
14
+ flags: "i"
15
+ - regex: "image operating system .* does not match host operating system"
16
+ flags: "i"
17
+ - regex: "manifest unknown"
18
+ flags: "i"
19
+ error_messages:
20
+ - "no matching manifest for linux/amd64 in the manifest list entries"
21
+ - "Error response from daemon: manifest unknown: manifest unknown"
22
+ - "image operating system \"linux\" does not match host operating system \"linux\""
23
+ root_cause: |
24
+ A common pattern for multi-platform Docker images in GitHub Actions is to use
25
+ `strategy.matrix` with one platform per job and `docker/build-push-action` in
26
+ each job. This approach is incorrect: each job pushes a single-platform image
27
+ to the same tag, and each push *overwrites* the previous one. There is no merging
28
+ of single-platform images into a multi-platform manifest list.
29
+
30
+ After all matrix jobs complete, the tag only contains the image from the last
31
+ job to push — typically whichever platform finished last. All other platforms are
32
+ silently lost.
33
+
34
+ When another host tries to pull the image on a different architecture (e.g.,
35
+ linux/arm64 pulling after linux/amd64 was last to write), they receive:
36
+ "no matching manifest for linux/arm64 in the manifest list entries"
37
+
38
+ The workflow itself reports success — all matrix jobs push successfully. The
39
+ failure is silent until image consumers on other architectures try to pull.
40
+
41
+ Sources: stackoverflow.com/questions/79315376,
42
+ Docker multi-platform build documentation
43
+ fix: |
44
+ Use a single `docker/build-push-action` step with comma-separated platforms
45
+ instead of a matrix. Docker Buildx handles building all platforms in one job
46
+ and pushes a proper multi-platform manifest list.
47
+
48
+ If you need dedicated builders for each platform (e.g., native ARM runners),
49
+ use the "bake + merge manifest" pattern with `docker buildx imagetools create`
50
+ to merge per-platform digests into a single manifest after all builds complete.
51
+ fix_code:
52
+ - language: yaml
53
+ label: "Single buildx job with comma-separated platforms (recommended)"
54
+ code: |
55
+ jobs:
56
+ build-and-push:
57
+ runs-on: ubuntu-latest
58
+ permissions:
59
+ packages: write
60
+ contents: read
61
+ steps:
62
+ - uses: actions/checkout@v4
63
+
64
+ - name: Set up QEMU
65
+ uses: docker/setup-qemu-action@v3
66
+
67
+ - name: Set up Docker Buildx
68
+ uses: docker/setup-buildx-action@v3
69
+
70
+ - name: Login to GHCR
71
+ uses: docker/login-action@v3
72
+ with:
73
+ registry: ghcr.io
74
+ username: ${{ github.actor }}
75
+ password: ${{ secrets.GITHUB_TOKEN }}
76
+
77
+ - name: Build and push multi-platform image
78
+ uses: docker/build-push-action@v6
79
+ with:
80
+ push: true
81
+ platforms: linux/amd64,linux/arm64,linux/arm/v7
82
+ # All platforms in one step → proper manifest list created
83
+ tags: ghcr.io/${{ github.repository_owner }}/myapp:latest
84
+ - language: yaml
85
+ label: "Native-builder pattern: build per platform, merge manifest (advanced)"
86
+ code: |
87
+ # Build per-platform in parallel jobs, then merge into a manifest list
88
+ jobs:
89
+ build:
90
+ strategy:
91
+ matrix:
92
+ include:
93
+ - platform: linux/amd64
94
+ runner: ubuntu-latest
95
+ - platform: linux/arm64
96
+ runner: ubuntu-24.04-arm # native ARM runner
97
+ runs-on: ${{ matrix.runner }}
98
+ outputs:
99
+ digest: ${{ steps.push.outputs.digest }}
100
+ steps:
101
+ - uses: actions/checkout@v4
102
+ - uses: docker/setup-buildx-action@v3
103
+ - uses: docker/login-action@v3
104
+ with:
105
+ registry: ghcr.io
106
+ username: ${{ github.actor }}
107
+ password: ${{ secrets.GITHUB_TOKEN }}
108
+ - name: Build and push by digest (no tag yet)
109
+ id: push
110
+ uses: docker/build-push-action@v6
111
+ with:
112
+ push: true
113
+ platforms: ${{ matrix.platform }}
114
+ # Push by digest only — do NOT set a tag here
115
+ outputs: type=image,name=ghcr.io/${{ github.repository_owner }}/myapp,push-by-digest=true,name-canonical=true
116
+
117
+ merge:
118
+ needs: build
119
+ runs-on: ubuntu-latest
120
+ steps:
121
+ - uses: docker/login-action@v3
122
+ with:
123
+ registry: ghcr.io
124
+ username: ${{ github.actor }}
125
+ password: ${{ secrets.GITHUB_TOKEN }}
126
+ - name: Create and push multi-platform manifest
127
+ run: |
128
+ docker buildx imagetools create \
129
+ -t ghcr.io/${{ github.repository_owner }}/myapp:latest \
130
+ ${{ needs.build.outputs.digest }}
131
+ # Merges per-platform digests into one manifest list
132
+ prevention:
133
+ - "Never use strategy.matrix to build separate platforms and push to the same tag — each push overwrites the previous."
134
+ - "Use a single build-push-action step with comma-separated platforms for most multi-platform use cases."
135
+ - "Validate multi-platform images after push with `docker buildx imagetools inspect ghcr.io/owner/image:tag` to confirm all platforms are present."
136
+ - "When matrix builds are needed for native performance, use push-by-digest and a fan-in merge job."
137
+ docs:
138
+ - url: "https://docs.docker.com/build/ci/github-actions/multi-platform/"
139
+ label: "Docker: Multi-platform image with GitHub Actions"
140
+ - url: "https://github.com/docker/build-push-action"
141
+ label: "docker/build-push-action — multi-platform examples"
142
+ - url: "https://stackoverflow.com/questions/79315376/docker-multiplatform-image-pushed-successfully-to-ghcr-but-pulling-image-result"
143
+ label: "SO: Docker multiplatform image pushed successfully but pulling results in manifest not found"
@@ -0,0 +1,99 @@
1
+ id: silent-failures-026
2
+ title: "Docker Run Exit Code Masked When Output Is Piped to tee"
3
+ category: silent-failures
4
+ severity: silent-failure
5
+ tags:
6
+ - docker
7
+ - exit-code
8
+ - pipe
9
+ - tee
10
+ - bash
11
+ - pipefail
12
+ patterns:
13
+ - regex: "docker run.*\\|.*tee"
14
+ flags: "i"
15
+ - regex: "PIPESTATUS|pipefail"
16
+ flags: "i"
17
+ error_messages:
18
+ - "Pipe status: 0"
19
+ - "Exit status: 0"
20
+ - "The command succeeded."
21
+ root_cause: |
22
+ When a `docker run` command is piped to `tee` for dual-output (file + console),
23
+ the shell's `$?` variable captures the exit code of the *last command in the
24
+ pipeline* — which is `tee`. Since `tee` always exits 0 (unless it cannot write
25
+ to the output file), the workflow step always reports success even when the
26
+ container process exits with a non-zero code.
27
+
28
+ Example:
29
+ docker run myimage pytest tests/ 2>&1 | tee output.txt
30
+ echo $? # Always 0 — tee's exit code, not docker's
31
+
32
+ GitHub Actions enables `set -e` and `set -o pipefail` by default for bash steps,
33
+ but `pipefail` only propagates failures if the pipeline command itself fails.
34
+ When the output of `docker run` is piped, the runner still sees `tee`'s exit code
35
+ as the step's result.
36
+
37
+ `${PIPESTATUS[0]}` is the bash array of exit codes for each pipeline segment, but
38
+ it must be captured *immediately* after the pipeline — it is overwritten by the
39
+ next command.
40
+
41
+ Sources: stackoverflow.com/questions/79075923
42
+ fix: |
43
+ Option 1 (Recommended): Capture the docker exit code via PIPESTATUS immediately
44
+ after the pipeline, before running any other command.
45
+
46
+ Option 2: Run docker without piping, capturing output to a variable first, then
47
+ echo it and write to file. This avoids the PIPESTATUS problem entirely.
48
+
49
+ Option 3: Enable `set -o pipefail` in the step shell (note: GitHub Actions bash
50
+ steps do NOT enable pipefail by default despite documentation implying otherwise —
51
+ test explicitly).
52
+ fix_code:
53
+ - language: yaml
54
+ label: "Capture docker exit code via PIPESTATUS[0]"
55
+ code: |
56
+ - name: Run tests in Docker
57
+ run: |
58
+ docker run myimage pytest tests/ 2>&1 | tee output.txt
59
+ DOCKER_EXIT=${PIPESTATUS[0]}
60
+ # PIPESTATUS must be captured immediately after the pipeline
61
+ echo "Docker exit code: $DOCKER_EXIT"
62
+ if [ "$DOCKER_EXIT" -ne 0 ]; then
63
+ echo "Tests failed inside container."
64
+ exit "$DOCKER_EXIT"
65
+ fi
66
+ - language: yaml
67
+ label: "Avoid piping: capture output in variable, then write and echo"
68
+ code: |
69
+ - name: Run tests in Docker
70
+ run: |
71
+ # Capture output without piping — preserves $? correctly
72
+ docker_output=$(docker run myimage pytest tests/ 2>&1)
73
+ DOCKER_EXIT=$?
74
+ echo "$docker_output" # Show in Actions log
75
+ echo "$docker_output" > output.txt # Also write to file
76
+ if [ "$DOCKER_EXIT" -ne 0 ]; then
77
+ echo "Tests failed (exit $DOCKER_EXIT)"
78
+ exit "$DOCKER_EXIT"
79
+ fi
80
+ - language: yaml
81
+ label: "Use process substitution to write to file without a pipeline"
82
+ code: |
83
+ - name: Run tests in Docker
84
+ run: |
85
+ # tee via process substitution — preserves docker's exit code
86
+ docker run myimage pytest tests/ 2>&1 > >(tee output.txt)
87
+ # $? is now docker's exit code, not tee's
88
+ prevention:
89
+ - "Never check $? after a piped command to determine success — always use ${PIPESTATUS[0]} or avoid piping."
90
+ - "Add an explicit exit-code check after any docker run step, especially when the step uses | tee or redirections."
91
+ - "Consider adding `set -o pipefail` at the top of multi-command run steps to catch pipeline failures automatically."
92
+ - "Test workflows with a deliberately failing container command to confirm the step actually fails as expected."
93
+ docs:
94
+ - url: "https://www.gnu.org/software/bash/manual/bash.html#index-PIPESTATUS"
95
+ label: "Bash manual — PIPESTATUS"
96
+ - url: "https://stackoverflow.com/questions/79075923/how-can-i-get-the-error-codes-in-github-actions-shell-when-a-docker-run-command"
97
+ label: "SO: Get error codes in github-actions shell when docker run command fails while piping output"
98
+ - url: "https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions"
99
+ label: "GitHub Actions workflow commands"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@htekdev/actions-debugger",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "65+ real GitHub Actions errors, queryable by agents. MCP server + Copilot skills + error database.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",