Skip to content

Conversation

confusedcrib
Copy link
Contributor

No description provided.

Copy link

dryrunsecurity bot commented Jan 17, 2025

DryRun Security Summary

The pull request introduces a GitHub Actions workflow for running an Amplify Security Scanner on the repository, demonstrating a proactive approach to application security by automatically scanning code changes on pull requests and branch pushes.

Expand for full summary

Summary:

The code change introduced in this pull request is related to a GitHub Actions workflow that runs a security scan on the Amplify application. The workflow is triggered on pull requests, manual workflow dispatches, and pushes to the "master" and "main" branches, and it requires read access to the repository contents and write access to the GitHub Actions ID token. The main job in the workflow is the "amplify-security-scan" job, which runs on the latest Ubuntu environment and uses the "amplify-security/runner-action" action to likely run the Amplify Security Scanner on the codebase. The workflow also includes exclusions for forked repositories and the "dependabot[bot]" user, which is a reasonable precaution.

From an application security perspective, the inclusion of this workflow demonstrates a proactive approach to application security, as the team has set up an automated security scanning process as part of their development pipeline. However, there is a possibility of false positive findings, which may require manual review and triage, and the scope of the scanning is limited to the changes introduced in the pull request or pushed to the "master" and "main" branches. It would be beneficial to also have a scheduled or periodic full-repository scan to ensure comprehensive coverage.

Files Changed:

  • .github/workflows/amplify.yml: This file contains the GitHub Actions workflow that runs a security scan on the Amplify application. The key changes include the workflow triggers, permissions, the "amplify-security-scan" job, exclusions, and the use of the "amplify-security/runner-action" action to run the Amplify Security Scanner.

Code Analysis

We ran 9 analyzers against 1 file and 0 analyzers had findings. 9 analyzers had no findings.

View PR in the DryRun Dashboard.

path: amplify-sast.json
retention-days: 7
- name: Checkout
uses: actions/checkout@v4

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static Code Analysis Risk: Software and Data Integrity Failures - GitHub actions artipacked vulnerability

Detected local filesystem git credential storage on GitHub Actions, as well as potential avenues for unintentional persistence of credentials in artifacts. By default, using actions/checkout causes a credential to be persisted in the checked-out repo's .git/config, so that subsequent git operations can be authenticated. Subsequent steps may accidentally publicly persist .git/config, e.g. by including it in a publicly accessible artifact via actions/upload-artifact. However, even without this, persisting the credential in the .git/config is non-ideal unless actually needed. To fix, add persist-credentials: false inside a with section in this step.

Severity: Medium ⚠️
Status: Open 🔴

References:

  1. https://unit42.paloaltonetworks.com/github-repo-artifacts-leak-tokens/

Suggested reviewers 🧐: @confusedcrib

Take action by replying with an [arnica] command 💬

Actions

Use [arnica] or [a] to interact with the Arnica bot to acknowledge or dismiss code risks.

[arnica] ack <message>

Acknowledge the finding as a valid code risk.

Examples

[arnica] ack looking into it

[a] ack triaged by the security team

[arnica] dismiss <fp|accept|capacity> <message>

Dismiss the risk with a reason.

  • fp: False positive, i.e. the result is incorrect and indicates no actual risk.

  • accept: Tolerable risk, i.e. risk severity is lower than what has been reported or is accepted as it stands.

  • capacity: No capacity, i.e. leave me alone, please.

Examples

[arnica] dismiss fp test function

[arnica] dismiss accept ChatGPT assures us that we will be just fine

[a] dismiss capacity not enough caffeine to fix it

- name: Checkout
uses: actions/checkout@v4
- name: Amplify Runner
uses: amplify-security/runner-action@main

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Codacy found a medium Security issue: An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release.

The issue identified by the Semgrep linter is that the GitHub action amplify-security/runner-action@main is being referenced using a branch name (main). This practice can lead to security vulnerabilities, as the contents of the branch may change over time, potentially introducing breaking changes or malicious code. To mitigate this risk, it's recommended to pin the action to a specific commit SHA, ensuring that the action will always execute the same code.

Here's a code suggestion to fix the issue by replacing @main with a specific commit SHA (you would need to replace COMMIT_SHA with the actual SHA of the commit you want to pin to):

Suggested change
uses: amplify-security/runner-action@main
uses: amplify-security/runner-action@COMMIT_SHA

This comment was generated by an experimental AI tool.

@confusedcrib confusedcrib merged commit eb4687d into main Jan 17, 2025
20 of 22 checks passed
@confusedcrib confusedcrib deleted the amplify-runn branch January 17, 2025 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant