csm-actions/securefix-action
csm-actions/securefix-action has 44 GitHub stars and 1 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-16 04:34 UTC. Last push 2026-11-12.
What you can do
- πͺ Increase the developer productivity by fixing code in CI
- You don't need to pass a GitHub App private key with strong permissions to GitHub Actions workflows on the client side
- You don't need to allow external services to access your code
- You can define custom validation before creating a commit
Measured star growth
- in 24h
- 0
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
About
GitHub Action to fix code securely
SecurityREADME.md
OriginalSecurefix Action
| Versioning Policy | NotebookLM
Securefix Action is GitHub Actions to fix code securely.
Securefix Action allows you to fix code securely without sharing a GitHub App private key with strong permissions such as contents:write across GitHub Actions workflows.
You don't need to allow external services to access your code.
It elevates the security of your workflows to the next level.
Furthermore, it's easy to use. You don't need to host a server application. It achieves a server/client architecture using GitHub Actions by unique approach.
:bulb: NotebookLM And DeepWiki
:rocket: Recent Important Updates
- v0.5.6 (2026-03)
- :bug: v0.5.5 (2026-02) Fix a bug that Git Submodules are broken
- :warning: v0.5.3 (2026-01) pull_request.base_branches in configuration files were abandoned
- πͺ v0.4.2 (2025-12) You can write Configuration files more simply
- :rocket: v0.4.1 (2025-11) The performance was drastically improved
- :warning: v0.3.0 (2025-10) If the repository or branch is changed, the source branch must be protected for security.
See also Release Notes.
Features
- πͺ Increase the developer productivity by fixing code in CI
- π‘ Secure
- You don't need to pass a GitHub App private key with strong permissions to GitHub Actions workflows on the client side
- You don't need to allow external services to access your code
- You can define custom validation before creating a commit
- Commits are verified (signed)
- π Easy to use
- You can create a commit by one action on the client side
- You don't need to host a server application
Overview
Sometimes you want to fix code in CI:
- Format code
- Generate document from code
- etc
In case of public repositories, we strongly recommend autofix.ci. autofix.ci allows you to fix code in CI of pull requests including pull requests from fork repositories securely. autofix.ci is easy to use, and it's free in public repositories. We love it.
autofix.ci is also available in private repositories, but perhaps it's a bit hard to use it in your private repositories for your business.
- It's not free, so you may have to submit a request to your company
- You need to allow the external server of autofix.ci to access your code. Perhaps you can't accept it
- If you don't receive pull requests from fork repositories, the reason to use autofix.ci might not be so string because you can fix code using actions such as commit-action
We think autofix.ci is valuable in private repositories too, but perhaps you can't use it.
If you use fix code in CI, you need to use an access token with contents:write permission.
But if the token is abused, malicious code can be committed.
For instance, an attacker can create a malicious commit to a pull request, and he may be able to approve and merge the pull request.
It's so dangerous.
To prevent such a threat, you should protect personal access tokens and GitHub Apps having strong permissions securely.
One solution is the Client/Server Model. Clients are GitHub Actions workflows that want to fix code. They send a request to the server, then the server fix code. You don't need to pass an access token with strong permissions to clients (GitHub Actions Workflows).
Then how do you build the server? For instance, you would be able to build the server using AWS Lambda, Google Cloud Function, or k8s, and so on. But we don't want to host such a server application.
So we build a server using GitHub Actions workflow by unique approach. You don't need to host a server application.
Example
Architecture
Securefix Action adopts the Client/Server Model. It uses following GitHub Apps, repositories, and workflows:
- two GitHub Apps
- a Server GitHub App: a GitHub App to create commits
- a Client GitHub App: a GitHub App to send requests to a server workflow
- Repositories
- a Server repository: a repository where a server workflow works
- Client repositories: repositories where client workflows work
- Workflows
- a Server Workflow: Receive requests from client workflows and create commits
- a Client Workflow: Request to fix code to the Server Workflow
- Server: 1 GitHub App, 1 Repository
- Client: 1 GitHub App, N Repositories
- The client workflow uploads fixed files and metadata to GitHub Actions Artifacts
- The client workflow triggers the server workflow by a
workflow_dispatchevent or a label - The server workflow downloads fixed files and metadata from GitHub Actions Artifacts
- The server workflow validates the request
- The server workflow pushes a commit to the client repository
How to trigger the server workflow
There are two ways to trigger the server workflow:
workflow_dispatch(v0.6.5): The client workflow runs the server workflow by the workflow_dispatch API. The Client GitHub App requiresactions:write. Set the inputserver_workflow_refto use this- label: The client workflow creates an issue label in the server repository, and the server workflow is triggered by the
label:createdevent and deletes the label. The Client GitHub App requiresissues:write. Set the inputserver_repositoryto use this
We recommend workflow_dispatch:
- No label needs to be created and deleted just to trigger the server workflow
- The client action outputs a link to the server workflow run
- Parameters are passed as workflow inputs instead of a label description
The Client GitHub App is installed into only the server repository, so actions:write is limited to the server repository.
But actions:write allows more than running workflows, and the server workflow must run only on the default branch.
If you use labels now, see the migration guide.
[!NOTE] We don't use
repository_dispatchbecause creating a repository_dispatch event requirescontents:write.contents:writeof the server repository would let clients rewrite the server workflow. The point of Securefix Action is to let clients create commits withoutcontents:write.
Getting Started
- Create two repositories from templates demo-server and demo-client
- Create a GitHub App for server
- Create a GitHub App for client
- Create GitHub App private keys
- Add GitHub App's id and private keys to GitHub Secrets and Variables
- Fix the server workflow if necessary
- Fix the client workflow if necessary
- Add a new file
bar.yamlto client' repository and create a pull request
GitHub App for server
Deactivate Webhook.
Permissions:
contents:write: To create commitsactions:read: To download GitHub Actions Artifacts to fix codepull_requests:write: To notify problems on the server side to pull requestsworkflows:write: Optional. This is required if you want to fix GitHub Actions workflowsmembers:read: Optional. This is required if you want to request reviews to teams- Organization's
projects:write: Optional. This is required if you want to add pull requests to GitHub Organization Projects
Installed Repositories: Install the app into the server repository and client repositories.
GitHub App for client
Deactivate Webhook.
Permissions:
actions:write: To run the server workflow byworkflow_dispatch
Installed Repositories: Install the app into only the server repository. You don't need to install it into client repositories, because client workflows run the server workflow only in the server repository.
Add GitHub App's id and private keys to GitHub Secrets and Variables
Add GitHub App's private keys and ID to Repository Secrets and Variables
- client
- id: client repository's variable
DEMO_CLIENT_APP_ID - private key: client repository's Repository Secret
DEMO_CLIENT_PRIVATE_KEY
- id: client repository's variable
- server
- id: server repository's variable
DEMO_SERVER_APP_ID - private key: server repository's Repository Secret
DEMO_SERVER_PRIVATE_KEY
- id: server repository's variable
[!WARNING] In the getting started, we add private keys to Repository Secrets simply. But when you use Securefix Action actually, you must manage the Server GitHub App's private key and the server workflow securely. Only the server workflow must be able to access the server app's private key. See also
How to manage a server GitHub App and a server workflow.
Fix the server workflow if necessary
If you change a variable name and a secret name, please fix the workflow.
Fix the client workflow if necessary
- If you change a variable name and a secret name, please fix the workflow
- If you change the server repository name or the server workflow file name, please fix the input
server_workflow_ref. Managing it with an organization variable lets you change it without fixing client workflows
Add a new file bar.yaml to client' repository and create a pull request
- Add
bar.yamlto client repository (Example)
bar.yaml:
names:
- bar
- Create a pull request (Example):
Then workflows are run and bar.yaml is fixed automatically:
--- a/bar.yaml
+++ b/bar.yaml
@@ -1,2 +1,2 @@
names:
-- bar
+ - bar
Push to other repository and branch
Securefix Action >= v0.2.0 #123
By default, Securefix Action pushes a commit to the repository and branch where the action is run. But actually there are usecases that you want to push a commit to other repository and branch.
- Scaffold a pull request by
workflow_dispatch - Update GitHub Pages
- Create a pull request to the repository A when the repository B is updated
- etc
Securefix Action can push a commit to the other repository and branch securely. Allowing to push any repository and branch without any restriction is dangerous, so by default changing the repository and branch isn't allowed, meaning the action fails. You can push a commit from only allowed repositories and branches to only allowed repositories and branches. From Securefix Action v0.3.0, the source branch must be protected.
Create pull requests
When pushing a commit to the other repository and branch, you can also create a pull request.
Actions
Securefix Action is a single JavaScript Action.
It has an input action, which accepts the following values:
client: Client Actionserver: Server Actionvalidate-config: Validate the configuration file of the server side
The server action is a single action that consolidates the prepare, commit, and notify actions.
In most cases, you can simply use the server action.
If you need more flexibility, you can use the individual prepare, commit, and notify actions instead.
For example, you can insert your own validation logic between prepare and commit, or implement custom notification handling instead of using the default notify action.
Actions' Available Versions
As of Securefix Action v0.2.0, Securefix Action is released using release-js-action. About available versions, please see the document.
Security
- You don't need to pass a GitHub App private key having strong permissions to GitHub Actions workflows on the client side
- You don't need to allow external services to access your code
- You can define custom validation before creating a commit
- Commits are verified (signed)
Client workflows can use a Client GitHub App, but it has only actions:write (or issues:write if you use labels) permission of the server repository.
It doesn't allow clients to change code or read secrets, so even if the app is abused, the risk is much lower than granting contents:write to clients.
That said, actions:write allows more than running the server workflow, so you should understand what it allows.
Server action creates a commit to the same repository and branch with the GitHub Actions Artifact.
So it doesn't allow attackers to create a malicious commit to a different repository or a different branch.
Server action also rejects a request for an old client workflow run, which could revert changes pushed after it: the commit is created on top of the head commit of the client workflow run, so the push fails if the branch has been updated since then.
For the same reason, if a client workflow run sends multiple requests, e.g. from multiple jobs, only the first fix is pushed in that run. The fix commit runs the client workflow again, and the other fixes are pushed then.
How to manage a server GitHub App and a server workflow
You must protect a server GitHub App and a server workflow from attacks securely. There are several ideas:
- GitHub App Private Key:
- Use GitHub Environment Secret
- Restrict the branch
- Import the private key into AWS KMS and restrict the access to the KMS key by OIDC claims (repository, event, branch, workflow, etc)
- Workflows never read the private key, so it can't leak
- Use GitHub Environment Secret
- Server Workflow
- Restrict members having the write permission of the server repository
- For instance, grant the write permission to only system administrators
- Restrict members having the write permission of the server repository
workflow_dispatch and actions:write
actions:write of the server repository doesn't allow clients to change the server repository's code or secrets.
But it allows more than running workflows:
- Disable and enable workflows (DoS of the server workflow)
- Cancel and re-run workflow runs
- Delete workflow runs and logs
- Delete artifacts and caches
The private key of the Client GitHub App is shared widely, so anyone who can write to a client repository should be assumed to be able to do these. We consider these acceptable as long as secrets are available only on the default branch of the server repository and the default branch is protected properly.
Run the server workflow only on the default branch
A label event always runs the workflow on the default branch, but workflow_dispatch lets clients choose any branch or tag of the server repository.
If an old branch or tag has a vulnerable server workflow, it could be run.
- The
prepareandserveractions fail if the event isworkflow_dispatchandgithub.refisn't the default branch. Note that this check runs in the workflow on the dispatched ref, so it doesn't protect a branch or tag whose workflow uses an older action or doesn't use the action at all. The following measures are enforced outside the workflow, so use them too - Restrict the deployment branches of the environment to the default branch
- If the private key is managed in AWS KMS, restrict the access by OIDC claims. When the job uses an environment, the
subclaim doesn't include the ref, so customize the subject claim to includejob_workflow_ref, for instance
Re-run
actions:write allows re-running server workflow runs.
A re-run uses the workflow at the same commit as the original run, and both the deployment branch policy of the environment and job_workflow_ref see only the branch name.
So even after a vulnerability of the server workflow is fixed, re-running a run from before the fix runs the old workflow (re-runs are allowed within 30 days).
When you fix a vulnerability of the server workflow, delete the server workflow runs from before the fix.
Custom Validation
You can insert custom validation between prepare action and commit action.
You can use prepare action's outputs.
- uses: csm-actions/securefix-action@latest
id: prepare
with:
action: prepare
app_id: ${{ vars.DEMO_SERVER_APP_ID }}
app_private_key: ${{ secrets.DEMO_SERVER_PRIVATE_KEY }}
# Custom Validation
- if: fromJson(steps.prepare.outputs.pull_request).user.login != 'suzuki-shunsuke'
run: |
exit 1
- uses: csm-actions/securefix-action@latest
with:
action: commit
outputs: ${{ toJson(steps.prepare.outputs) }}
- uses: csm-actions/securefix-action@latest
if: failure()
with:
action: notify
outputs: ${{ toJson(steps.prepare.outputs) }}
Troubleshooting
Client Workflow Name
By default, the client workflow name must be securefix for security.
Otherwise, the prepare action fails.
You can change the workflow name or remove the restriction using prepare action's workflow_name input.
How To Fix Workflow Files
By default, Serverfix Action doesn't allow you to fix workflow files for security.
By default, the server action fails if fixed files include workflow files.
You can allow it by setting prepare action's allow_workflow_fix to true.
GitHub API Rate Limiting
If you use Server Action in many client repositories and face GitHub API limiting, you can avoid the rate limiting by creating new GitHub Apps and a server repository and splitting clients:
Reference:
Private keys in AWS KMS
A GitHub App private key in GitHub Secrets never expires, so anyone who obtains it can generate installation access tokens indefinitely. Importing the key into AWS KMS removes that path: the key can never be exported, and only the JSON Web Token signing is delegated to it.
Set aws_kms_key_id instead of app_private_key. Passing it as a key ARN is
enough, since an ARN carries its region; for an alias or a bare key id, set
aws_region, or set AWS_REGION.
Set aws_role_to_assume and this action assumes the IAM role itself with the
GitHub OIDC token. The AWS credentials then stay inside the action and are never
exported, so later steps of the job can't see them.
Leaving aws_role_to_assume unset reads the credentials from
AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN, which is
what aws-actions/configure-aws-credentials exports, so running that action
first works as well. Those environment variables are the only other source: a
profile in ~/.aws/credentials, IMDS on a self-hosted EC2 runner and the
credentials of an ECS or EKS task are not read, so reach for
aws-actions/configure-aws-credentials to use any of them.
permissions:
id-token: write # Required to assume the AWS IAM role via OIDC
contents: read
steps:
- uses: csm-actions/securefix-action@6da661e4377faf2d71294c1c09b1c03c161ce7c1 # v0.6.8
with:
client_id: ${{vars.APP_CLIENT_ID}}
aws_kms_key_id: ${{vars.KMS_KEY_ID}}
aws_role_to_assume: ${{vars.ROLE_TO_ASSUME}}
The app can be identified by either client_id or app_id. client_id takes
precedence when both are set.