Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new attribution github workflow #9856

Merged
merged 4 commits into from
Jun 5, 2024

Conversation

cryptodev-2s
Copy link
Contributor

@cryptodev-2s cryptodev-2s commented Jun 5, 2024

Description

This pull request introduces a GitHub Action workflow dedicated to managing attributions effectively within our project. The key components of this new workflow include:

  • Local Scripts for Attributions Management:
    • yarn build:attribution: Updates attributions to reflect current dependencies.
    • yarn test:attribution-check: Checks if attributions are up-to-date with the latest changes.
  • GitHub Actions:
    • A check to ensure attributions are up-to-date on all pull requests.
    • An action that allows team members to update attributions directly by commenting @metamskbot update-attributions on any PR.

Related issues

Fixes: #1550

Manual testing steps

Locally

  • Run yarn build:attribution to update the attributions file.
  • Run yarn test:attribution-check to ensure all attributions are current.

On GitHub (CI/PR)

  • Open and push changes to a PR.
  • Intentionally remove an entry from attribution.txt to simulate an error.
  • Observe that CI fails due to missing attributions.
  • Comment @metmaskbot update-attributions on the PR.
  • A bot will respond with a thumbs up, followed by a comment indicating whether the attributions were successfully updated.

For a practical demonstration, refer to the pull request in my fork: PR Demonstration

Note

This functionality is currently operational only on a fork as it depends on the integration of the bot action into the develop branch.

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've completed the PR template to the best of my ability
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@cryptodev-2s cryptodev-2s requested a review from a team as a code owner June 5, 2024 13:29
Copy link
Contributor

github-actions bot commented Jun 5, 2024

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Copy link

socket-security bot commented Jun 5, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/glob@10.4.1 Transitive: environment +2 911 kB isaacs
npm/minipass@7.1.2 None 0 286 kB isaacs

🚮 Removed packages: npm/@lavamoat/allow-scripts@2.5.1

View full report↗︎

Copy link

socket-security bot commented Jun 5, 2024

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package NoteSource
New author npm/validate-npm-package-name@5.0.1
Network access npm/agentkeepalive@4.5.0
Network access npm/agentkeepalive@4.5.0
New author npm/@npmcli/fs@2.1.2
Deprecated npm/@npmcli/move-file@2.0.1
  • Reason: This functionality has been moved to @npmcli/fs
Network access npm/make-fetch-happen@10.2.1
Network access npm/make-fetch-happen@10.2.1
Network access npm/make-fetch-happen@10.2.1
Network access npm/make-fetch-happen@10.2.1
New author npm/unique-slug@3.0.0
New author npm/@lavamoat/aa@3.1.5
New author npm/node-gyp@9.4.1
Shell access npm/@lavamoat/allow-scripts@2.5.1
New author npm/@lavamoat/allow-scripts@2.5.1

View full report↗︎

Next steps

What is new author?

A new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.

Scrutinize new collaborator additions to packages because they now have the ability to publish code into your dependency tree. Packages should avoid frequent or unnecessary additions or changes to publishing rights.

What is network access?

This module accesses the network.

Packages should remove all network access that is functionally unnecessary. Consumers should audit network access to ensure legitimate use.

What is a deprecated package?

The maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.

Research the state of the package and determine if there are non-deprecated versions that can be used, or if it should be replaced with a new, supported solution.

What is shell access?

This module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.

Packages should avoid accessing the shell which can reduce portability, and make it easier for malicious shell access to be introduced.

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/foo@1.0.0 or ignore all packages with @SocketSecurity ignore-all

  • @SocketSecurity ignore npm/validate-npm-package-name@5.0.1
  • @SocketSecurity ignore npm/agentkeepalive@4.5.0
  • @SocketSecurity ignore npm/@npmcli/fs@2.1.2
  • @SocketSecurity ignore npm/@npmcli/move-file@2.0.1
  • @SocketSecurity ignore npm/make-fetch-happen@10.2.1
  • @SocketSecurity ignore npm/unique-slug@3.0.0
  • @SocketSecurity ignore npm/@lavamoat/aa@3.1.5
  • @SocketSecurity ignore npm/node-gyp@9.4.1
  • @SocketSecurity ignore npm/@lavamoat/allow-scripts@2.5.1

@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Jun 5, 2024
Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

Makes sense to me, but I had one question.

.github/workflows/check-attributions.yml Outdated Show resolved Hide resolved
@cryptodev-2s cryptodev-2s requested a review from mcmire June 5, 2024 20:12
Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Copy link

sonarqubecloud bot commented Jun 5, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@cryptodev-2s cryptodev-2s merged commit d63fcbf into main Jun 5, 2024
32 of 33 checks passed
@cryptodev-2s cryptodev-2s deleted the feature/add-attribution-workflow branch June 5, 2024 20:28
@github-actions github-actions bot locked and limited conversation to collaborators Jun 5, 2024
@metamaskbot metamaskbot added the release-7.25.0 Issue or pull request that will be included in release 7.25.0 label Jun 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
INVALID-PR-TEMPLATE PR's body doesn't match template release-7.25.0 Issue or pull request that will be included in release 7.25.0 team-wallet-framework
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants