Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/endorlabs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@ name: Endor Labs

on:
workflow_dispatch:
inputs:
namespace:
description: Endor Labs namespace to scan
required: true
default: OCodejs
Comment on lines +6 to +9

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · One namespace's alerts replace another's

When two manual scans for the same ref use different namespaces and their SARIF uploads overlap or complete out of order, both manual runs upload SARIF for the same ref without specifying separate categories; the later upload replaces the code-scanning analysis, so the other namespace's findings disappear.

Assign each namespace a distinct SARIF category, or otherwise ensure only the intended namespace's analysis is uploaded for a ref.

Prompt for AI agents
In `.github/workflows/endorlabs.yml` at lines 6-9:

**One namespace's alerts replace another's**

When two manual scans for the same ref use different namespaces and their SARIF uploads overlap or complete out of order, both manual runs upload SARIF for the same ref without specifying separate categories; the later upload replaces the code-scanning analysis, so the other namespace's findings disappear.

Assign each namespace a distinct SARIF category, or otherwise ensure only the intended namespace's analysis is uploaded for a ref.

type: string

permissions:
contents: read
security-events: write

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · SARIF results fail to upload

When the repository is private, github/codeql-action/upload-sarif cannot read the workflow-run status without actions: read, so the final upload step fails and the SARIF results do not reach code scanning.

Grant actions: read alongside the existing permissions.

Prompt for AI agents
In `.github/workflows/endorlabs.yml` at line 14:

**SARIF results fail to upload**

When the repository is private, `github/codeql-action/upload-sarif` cannot read the workflow-run status without `actions: read`, so the final upload step fails and the SARIF results do not reach code scanning.

Grant `actions: read` alongside the existing permissions.


jobs:
scan:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Endor Labs dependency scan
uses: endorlabs/github-action@b51bd06466b545f01a6ac788e3e1147695d3936c

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 High · Endor scan lacks credentials

When the workflow is manually dispatched, the action receives a namespace but no Endor Labs API key or secret, so it cannot authenticate to run the scan and the manual workflow fails.

Pass the Endor Labs credentials to the action through repository or organization secrets.

Prompt for AI agents
In `.github/workflows/endorlabs.yml` at line 23:

**Endor scan lacks credentials**

When the workflow is manually dispatched, the action receives a namespace but no Endor Labs API key or secret, so it cannot authenticate to run the scan and the manual workflow fails.

Pass the Endor Labs credentials to the action through repository or organization secrets.

with:
Expand Down
41 changes: 0 additions & 41 deletions .github/workflows/linter.yml

This file was deleted.

23 changes: 4 additions & 19 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,17 @@
# This is a basic workflow that is manually triggered

name: Manual workflow

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
inputs:
name:
description: 'Person to greet'
default: 'World'
required: true
type: string
inputs:
name:
description: 'Person to greet'
default: 'World'
description: Person to greet
default: World
required: true
type: string

jobs:
# This workflow contains a single job called "greet"
greet:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a single command using the runners shell
- name: Send greeting
run: echo "Hello ${{ inputs.name }}"
- name: Send greeting
run: echo "Hello ${{ inputs.name }}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Greeting input executes shell commands

When a user with permission to dispatch the workflow supplies shell syntax in the name input, the dispatcher-controlled inputs.name is substituted into the run script before the shell parses it, so shell metacharacters become commands and execute on the runner instead of being printed as a greeting.

Pass the input through an environment variable and print it as data rather than interpolating it into the script.

Prompt for AI agents
In `.github/workflows/manual.yml` at line 17:

**Greeting input executes shell commands**

When a user with permission to dispatch the workflow supplies shell syntax in the `name` input, the dispatcher-controlled `inputs.name` is substituted into the `run` script before the shell parses it, so shell metacharacters become commands and execute on the runner instead of being printed as a greeting.

Pass the input through an environment variable and print it as data rather than interpolating it into the script.

38 changes: 18 additions & 20 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
# This workflow executes several linters on changed files based on languages used in your code base whenever
# you push a code or open a pull request.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/github/super-linter
name: Lint Code Base

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]

permissions:
contents: read

jobs:
run-lint:
name: run-lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0

- name: Lint Code Base
uses: github/super-linter@v4
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: "main"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
- name: Parse all workflow YAML files
run: |
ruby - <<'RUBY'
require "yaml"
Dir.glob(".github/workflows/*.{yml,yaml}").sort.each do |path|
YAML.parse_file(path)
puts "Validated #{path}"
end
RUBY
14 changes: 14 additions & 0 deletions tests/repository-config.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,25 @@ test("manual Endor Labs workflow runs a scan and uploads SARIF only when present
const workflow = read(".github/workflows/endorlabs.yml");
assert.match(workflow, /^on:\s*\n\s+workflow_dispatch:/m);
assert.match(workflow, /namespace:\s*\n\s+description:/);
assert.match(workflow, /default:\s*OCodejs/);
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
Resolved
assert.match(workflow, /uses:\s*endorlabs\/github-action@/);
assert.doesNotMatch(workflow, /if:\s*github\.event_name\s*==\s*'(?:push|pull_request)'/);
assert.match(workflow, /if:\s*always\(\)\s*&&\s*hashFiles\('findings\.sarif'\)\s*!=\s*''/);
});

test("workflow validation parses GitHub Actions YAML without scanning vendored docs", () => {
const workflow = read(".github/workflows/super-linter.yml");
assert.ok(workflow.includes("YAML.parse_file"), "Every workflow YAML file must be parsed");
assert.ok(workflow.includes(".github/workflows/*.{yml,yaml}"));
assert.ok(workflow.includes("ruby -"));
});

test("manual greeting workflow has one well-formed workflow_dispatch input map", () => {
const workflow = read(".github/workflows/manual.yml");
assert.match(workflow, /^on:\s*\n\s+workflow_dispatch:\s*\n\s+inputs:/m);
assert.equal((workflow.match(/^ inputs:$/gm) || []).length, 1);
});

test("manual dependency review receives explicit base and head revisions", () => {
const workflow = read(".github/workflows/dependency-review.yml");
assert.match(workflow, /^on:\s*\n\s+workflow_dispatch:/m);
Expand Down
Loading