GitHub Actions
允许的不安全命令
name: 易受攻击的工作流
on:
pull_request_target
env:
# 1. 启用不安全命令
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
ENVIRONMENT_NAME: prod
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# 2. 打印 github 上下文
- run: |
print("""${{ toJSON(github) }}""")
shell: python
- name: 创建新的 PR 部署
uses: actions/github-script@v5
with:
# 3. 创建部署
script: |
return await github.rest.repos.createDeployment({
...context.repo,
ref: context.payload.pull_request.head.sha,
auto_merge: false,
required_contexts: [],
environment: "${{ env.ENVIRONMENT_NAME }}",
transient_environment: false,
production_environment: false,
});
github-token: ${{ secrets.GITHUB_TOKEN }}
参考资料
脚本注入
参考资料
权限提升
参考资料
最后更新于