-
Notifications
You must be signed in to change notification settings - Fork 21
feat: Add security-gates and update README #1310
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| name: Security Gates | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, master] | ||
| pull_request: | ||
| branches: [main, master] | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| validate: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Validate Workflow | ||
| run: echo "Validation successful" | ||
|
|
||
| security-gates: | ||
| uses: Trendyol/security-actions/.github/workflows/security-gates.yml@master | ||
| permissions: | ||
| actions: read | ||
| contents: read | ||
| security-events: write | ||
| secrets: inherit | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
sha="$(gh api repos/Trendyol/security-actions/commits/master --jq '.sha')"
gh api "repos/Trendyol/security-actions/contents/.github/workflows/security-gates.yml?ref=$sha" \
--jq '.content' | base64 --decode | rg -n 'workflow_call|secrets:|secrets\.'Repository: Trendyol/stove Length of output: 447 🏁 Script executed: #!/bin/bash
set -euo pipefail
sha="$(gh api repos/Trendyol/security-actions/commits/master --jq '.sha')"
echo "called workflow:"
gh api "repos/Trendyol/security-actions/contents/.github/workflows/security-gates.yml?ref=$sha" \
--jq '.content' | base64 --decode | nl -ba | sed -n '1,180p'
echo
echo "caller usage:"
if [ -f .github/workflows/security-gates.yml ]; then
nl -ba .github/workflows/security-gates.yml | sed -n '1,120p'
fiRepository: Trendyol/stove Length of output: 209 🏁 Script executed: #!/bin/bash
set -euo pipefail
caller_file=".github/workflows/security-gates.yml"
echo "caller file:"
if [ -f "$caller_file" ]; then
awk '{printf "%6d\t%s\n", NR, $0}' "$caller_file" | sed -n '1,120p'
else
echo "missing $caller_file"
fi
echo
echo "called workflow refs/secrets:"
sha="$(gh api repos/Trendyol/security-actions/commits/master --jq '.sha')"
for f in .github/workflows/*.yml; do
if [ "$(gh api -XGET "repos/Trendyol/security-actions/contents/$f?ref=$sha" --jq '.type == \"file\"" 2>/dev/null || true)" == "true" ]; then
content="$(gh api "repos/Trendyol/security-actions/contents/$f?ref=$sha" --jq '.type == "file" and .content' 2>/dev/null || true)"
if [ "$content" = "true" ]; then
echo "--- $f (maybe no content) ---"
else
echo "--- $f ---"
fi
fi
done
echo
echo "called workflow security-gates.yml:"
gh api "repos/Trendyol/security-actions/contents/.github/workflows/security-gates.yml?ref=$sha" \
--jq '.content' | awk '{printf "%6d\t%s\n", NR, $0}' | sed -n '1,180p'
echo
echo "called workflow env var usages:"
gh api "repos/Trendyol/security-actions/contents/.github/workflows/security-gates.yml?ref=$sha" \
--jq '.content' | java -jar /dev/null 2>/dev/null || awk '
/secrets\./ || /env:/ || /curl -X POST/ || /GITHUB_EVENT_PATH/ || /POST\/|PUT\/$/ || /X-Slack|Authorization:/ {
print NR "\t" $0
}'
echo
echo "github docs excerpt via web page text unavailable here; checking if gh docs command exists"
if command -v gh >/dev/null 2>&1; then
gh --version
fiRepository: Trendyol/stove Length of output: 888 🏁 Script executed: #!/bin/bash
set -euo pipefail
sha="$(gh api repos/Trendyol/security-actions/commits/master --jq '.sha')"
echo "called workflow:"
gh api "repos/Trendyol/security-actions/contents/.github/workflows/security-gates.yml?ref=$sha" \
--jq '.content' | awk '{printf "%6d\t%s\n", NR, $0}' | sed -n '1,180p'
echo
echo "secrets/env/url matches in called workflow:"
gh api "repos/Trendyol/security-actions/contents/.github/workflows/security-gates.yml?ref=$sha" \
--jq '.content' | awk '
/secrets\./{print NR"\n"$0}
/env:/||/curl -X POST/||/POST\/|PUT\/$/||/SLACK_WEBHOOK_URL/||/APPSEC_ELASTIC/||/APPSEC_CA'Repository: Trendyol/stove Length of output: 11236 Pass only the secrets required by the called workflow. This reusable workflow reads 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: Trendyol/stove
Length of output: 7334
Pin the reusable workflow to an immutable commit.
@masterlets the called workflow change without a change inTrendyol/stove. Pin this call to the full-length commit SHA that you validate before merging.🧰 Tools
🪛 zizmor (1.29.0)
[warning] 19-19: secrets unconditionally inherited by called workflow (secrets-inherit): this reusable workflow
(secrets-inherit)
🤖 Prompt for AI Agents