Skip to content

feat: onboarding commit-comment action - #1

Open
Raj-StepSecurity wants to merge 2 commits into
mainfrom
release
Open

Raj-StepSecurity wants to merge 2 commits into
mainfrom
release

Conversation

@Raj-StepSecurity

Copy link
Copy Markdown
Collaborator

No description provided.

@Raj-StepSecurity Raj-StepSecurity added the review-required Request Claude AI code review on the PR label Nov 18, 2026
Comment thread .github/workflows/ci.yml

permissions:
pull-requests: write
contents: write

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

contents write is required to pass this workflow as it comments on commit.
if dont want contents: write, need to remove test: step

@github-actions

Copy link
Copy Markdown

PR Review

Action Type

Node-based action (runs on node24, entry point dist/index.js).


Passed Checks

  • License: MIT license present with both original author (Peter Evans, 2019) and StepSecurity copyright (2026).
  • SECURITY.md: Present with correct reporting email.
  • No FUNDING.yml / funding.yml: Not present.
  • No renovate.json: Not present.
  • No PULL_REQUEST.md: Not present.
  • No ISSUE_TEMPLATE folder: Not present.
  • No CHANGELOG.md: Not present.
  • No .vscode folder: Not present.
  • Workflow files: Both auto_cherry_pick.yml and actions_release.yml are present under .github/workflows/.
  • README.md banner: StepSecurity maintained action banner is present at the top of the file.
  • README.md version tags: All usage examples correctly use major version only (step-security/commit-comment@v4), not a full semver tag.
  • Subscription check URL: Correctly calls the maintained-actions-subscription endpoint with GITHUB_REPOSITORY.
  • Upstream variable: peter-evans/commit-comment in src/main.ts correctly matches original-owner + repo-name from auto_cherry_pick.yml.
  • package.json author: Set to "step-security".
  • package.json repository: URL references step-security/commit-comment.
  • dist folder: Present with dist/index.js.
  • package.json build script: Present; script-input check for actions_release.yml does not apply.

Failed Checks

  • Missing await on createOrUpdateCommitComment (src/main.ts:134): The async function is called without await, so any rejection it throws will not be caught by the surrounding try/catch. The action will silently appear to succeed even when the core operation fails.

  • Dead error branch in getReactionsSet (src/commit-comment.ts:44): if (!reactionsSet) can never be true because an empty array [] is truthy in JavaScript. The intended guard ("No valid reactions are contained") can never be thrown, leaving invalid-only reaction inputs silently ignored.


Warnings

  • Undocumented legacy input body-file (src/main.ts:85): core.getInput('body-file') is used as a fallback for body-path but body-file is not declared in action.yml. This creates hidden behaviour not visible to users.
  • permissions placement in audit_package.yml: The permissions block appears after the jobs key (lines 29-34) instead of at the top of the workflow. The non-standard placement may be misread as job-level permissions.
  • Workflow actions pinned to floating version tags: ci.yml uses actions/checkout@v7 and actions/setup-node@v7. Pinning to a commit SHA is the supply-chain security best practice.

Security Findings

  • Unhandled promise rejection via missing await (src/main.ts:134): Without await, a failure in createOrUpdateCommitComment (e.g., failed API call or auth error) produces an unhandled promise rejection. The action exits with code 0 (success), so any downstream gate relying on this action's exit code will not be alerted to the failure.
  • No other exploitable security vulnerabilities were found. Input validation, subscription bypass protection, and API calls are correctly implemented.

Summary

The action is well-structured and passes most onboarding checks. Two code-correctness bugs must be fixed before merging: the missing await on the core action call (which silently swallows all failures) and the unreachable error guard in getReactionsSet.

Comment thread src/main.ts
}
}

createOrUpdateCommitComment(inputs, body)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: missing await

createOrUpdateCommitComment is an async function that returns Promise<void>, but it is called here without await. Any error it throws will produce an unhandled promise rejection that escapes the surrounding try/catch, causing the action to exit with code 0 (success) even when the core operation failed.

Suggested change
createOrUpdateCommitComment(inputs, body)
await createOrUpdateCommitComment(inputs, body)

Comment thread src/commit-comment.ts
})
)
]
if (!reactionsSet) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: dead code — this condition is always false

reactionsSet is typed as string[]. An empty array [] is truthy in JavaScript, so if (!reactionsSet) can never be true. The error "No valid reactions are contained" is unreachable, and callers silently receive an empty array when every supplied reaction is invalid.

Fix by checking the length instead:

Suggested change
if (!reactionsSet) {
if (!reactionsSet.length) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-required Request Claude AI code review on the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant