Skip to content

Create ethicalcheck.yml - #200

Closed
marlon-costa-dc wants to merge 1 commit into
developfrom
marlon-costa-dc-patch-2
Closed

Create ethicalcheck.yml#200
marlon-costa-dc wants to merge 1 commit into
developfrom
marlon-costa-dc-patch-2

Conversation

@marlon-costa-dc

@marlon-costa-dc marlon-costa-dc commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Summary by cubic

Adds a GitHub Actions workflow to run EthicalCheck API security tests for our API. Helps catch OWASP-style issues early with automated checks and reports.

  • New Features

    • Runs apisec-inc/ethicalcheck-action against the provided OpenAPI spec.
    • Triggers on push and PR to develop, weekly cron, and manual dispatch.
    • Uploads ethicalcheck-results.sarif via github/codeql-action/upload-sarif to Code Scanning.
    • Uses a pinned commit for the third-party action and minimal required permissions.
  • Migration

    • Update oas-url to your API’s OpenAPI/Swagger or public Postman collection URL.
    • Set email to a valid recipient for the test report.

Written for commit e820c15. Summary will update on new commits.

Review in cubic

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@marlon-costa-dc, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 55 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7aeaebbb-e8bb-4fcd-ae88-f05c706c8349

📥 Commits

Reviewing files that changed from the base of the PR and between 04ed185 and e820c15.

📒 Files selected for processing (1)
  • .github/workflows/ethicalcheck.yml

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Add EthicalCheck GitHub Action to run API security scans and upload SARIF

✨ Enhancement ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Add a scheduled and on-PR GitHub Actions workflow for EthicalCheck API security testing.
• Generate SARIF output and upload results to GitHub code scanning.
• Limit execution to the develop branch with optional manual runs.
Diagram

graph TD
  A["Push/PR on develop"] --> B["EthicalCheck workflow"] --> C["GitHub runner"] --> D["EthicalCheck action"] --> E["ethicalcheck-results.sarif"] --> F["upload-sarif"] --> G["GitHub code scanning"]
  H["Scheduled cron"] --> B
  I["Manual dispatch"] --> B
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Use GitHub-native CodeQL (or dependency scanning) for baseline coverage
  • ➕ First-party integration and support
  • ➕ No external service dependency for results ingestion
  • ➕ Familiar governance controls for many organizations
  • ➖ May not provide the same API-focused dynamic testing as EthicalCheck
  • ➖ Requires language support and correct build configuration
2. Run an in-repo DAST tool (e.g., OWASP ZAP) against a test environment
  • ➕ Keeps tooling and configuration fully under repo control
  • ➕ Can be targeted to ephemeral preview environments
  • ➖ More setup/maintenance and longer CI runtime
  • ➖ Requires reliable deployment of a testable environment
3. Keep EthicalCheck but parameterize inputs via secrets/vars and environments
  • ➕ Retains the intended EthicalCheck scanning approach
  • ➕ Reduces risk from hard-coded URLs/emails and eases per-env targeting
  • ➕ Aligns with standard GitHub Actions security practices
  • ➖ Slightly more workflow complexity (vars, environments, documentation)
  • ➖ Requires org/repo configuration for secrets and approvals

Recommendation: The overall approach (run EthicalCheck and upload SARIF) is reasonable and already benefits from commit-SHA pinning for the third-party action. To make it production-ready, parameterize oas-url and email using GitHub Actions secrets/vars (and consider environment scoping/approvals), and confirm that triggering only on develop plus a weekly schedule matches your DevSecOps expectations. Alternatives like CodeQL or OWASP ZAP are viable depending on whether you want static analysis, dynamic API testing, or both.

Files changed (1) +69 / -0

Other (1) +69 / -0
ethicalcheck.ymlIntroduce EthicalCheck security scan workflow with SARIF upload +69/-0

Introduce EthicalCheck security scan workflow with SARIF upload

• Adds a new GitHub Actions workflow triggered on develop branch pushes/PRs, a weekly cron schedule, and manual dispatch. Runs the apisec-inc EthicalCheck action against a provided OpenAPI URL and uploads the generated SARIF report via github/codeql-action/upload-sarif.

.github/workflows/ethicalcheck.yml

@qodo-code-review

qodo-code-review Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (4) 📘 Rule violations (0) 📜 Skill insights (1)

Grey Divider


Action required

1. Hardcoded oas-url and email 📜 Skill insight ≡ Correctness ⭐ New
Description
The workflow hardcodes oas-url and email values (including template/sample endpoints and a
placeholder external recipient) instead of sourcing them from configurable GitHub Actions
vars/secrets. This makes environment changes/rotation harder and can cause normal scheduled/push/PR
runs to scan the wrong target and potentially disclose penetration-test reports outside the project.
Code

.github/workflows/ethicalcheck.yml[R60-62]

+          oas-url: "http://netbanking.apisec.ai:8080/v2/api-docs"
+          # The email address to which the penetration test report will be sent.
+          email: "xxx@apisec.ai"
Relevance

●● Moderate

Config/secrets refactor is plausible, but team has previously rejected some “avoid hardcoding”
workflow tweaks.

PR-#90
PR-#86

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 2634353 forbids hardcoding configurable values, and the new
.github/workflows/ethicalcheck.yml sets both oas-url and email as string literals. The
EthicalCheck step indicates the email is the destination for the penetration-test report, and
because the workflow runs automatically on push/PR and via cron, these hard-coded values will be
used during normal executions, leading to scans against a non-project OpenAPI target and reports
being sent to the configured external address.

.github/workflows/ethicalcheck.yml[60-62]
.github/workflows/ethicalcheck.yml[32-44]
.github/workflows/ethicalcheck.yml[58-63]
Skill: flext-law

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`.github/workflows/ethicalcheck.yml` hardcodes configurable values (`oas-url` and `email`), including template/sample values, rather than sourcing them from GitHub Actions configuration. This violates compliance requirements and risks running scans against the wrong endpoint and sending penetration-test reports to an unintended/external recipient during normal scheduled and push/PR runs.

## Issue Context
- PR Compliance ID 2634353 forbids hardcoding configurable values.
- The EthicalCheck step uses `email` as the address where the penetration-test report will be sent.
- The workflow triggers automatically on push/PR to `develop` and on a weekly cron, so once merged these hard-coded values will be exercised routinely.
- These values are environment/deployment-specific and should be changeable without code edits via GitHub Actions `vars`/`secrets` (and optionally `workflow_dispatch` inputs), and it’s advisable to fail fast if values are unset/placeholder to prevent accidental external scans/reporting.

## Fix Focus Areas
- .github/workflows/ethicalcheck.yml[32-44]
- .github/workflows/ethicalcheck.yml[56-63]
- .github/workflows/ethicalcheck.yml[58-63]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Plaintext HTTP scan URL 🐞 Bug ⛨ Security
Description
The workflow fetches the OpenAPI spec from a plaintext http:// URL, which allows interception or
tampering of the spec in transit and can change what the scan tests. This weakens the
integrity/confidentiality of the security scan inputs and results.
Code

.github/workflows/ethicalcheck.yml[R59-62]

+          # The OpenAPI Specification URL or Swagger Path or Public Postman collection URL.
+          oas-url: "http://netbanking.apisec.ai:8080/v2/api-docs"
+          # The email address to which the penetration test report will be sent.
+          email: "xxx@apisec.ai"
Relevance

●● Moderate

http→https is reasonable but may break if endpoint lacks TLS; no strong workflow precedent found.

PR-#105

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The EthicalCheck step is configured to pull an OpenAPI spec over http://, which is inherently
vulnerable to on-path modification and observation.

.github/workflows/ethicalcheck.yml[56-63]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`oas-url` is configured with an `http://` endpoint, which is not transport-secure.

### Issue Context
This workflow runs on push/PR to `develop` and on a schedule, so the scan input is repeatedly fetched over plaintext.

### Fix Focus Areas
- .github/workflows/ethicalcheck.yml[59-63]

### Suggested fix
- Change `oas-url` to an `https://` endpoint.
- Make `oas-url` (and `email`) configurable via repo variables/secrets (e.g., `${{ vars.ETHICALCHECK_OAS_URL }}`, `${{ secrets.ETHICALCHECK_EMAIL }}`) so production targets/recipients aren’t hardcoded in the workflow file.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Overprivileged third-party action 🐞 Bug ⛨ Security
Description
The job grants security-events: write at job scope, so apisec-inc/ethicalcheck-action runs with
a token able to publish/alter code-scanning (SARIF) security events. If that third-party action is
compromised, it can write arbitrary security alerts/results to the repo without further review.
Code

.github/workflows/ethicalcheck.yml[R50-52]

+    permissions:
+      security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
+      actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
Relevance

●● Moderate

Workflow permission-hardening has been rejected before; third-party + security-events write likely
debated.

PR-#107

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The workflow explicitly grants security-events: write for the job that runs the third-party
action, which means the third-party step executes with the same write-capable token. Other repo
workflows show a pattern of keeping permissions minimal read-only by default.

.github/workflows/ethicalcheck.yml[49-58]
.github/workflows/ci.yml[28-32]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`.github/workflows/ethicalcheck.yml` grants `security-events: write` at the **job** level, which unintentionally gives the same write-capable `GITHUB_TOKEN` to the third-party `apisec-inc/ethicalcheck-action` step.

### Issue Context
The permission is only needed for the later `github/codeql-action/upload-sarif` step, not for generating the SARIF.

### Fix Focus Areas
- .github/workflows/ethicalcheck.yml[45-68]

### Suggested fix
1. Split into two jobs:
  - **scan job**: runs `apisec-inc/ethicalcheck-action` with minimal permissions (e.g., `contents: read` only), outputs `ethicalcheck-results.sarif`, and uploads it as an artifact.
  - **upload job**: depends on scan job, downloads the artifact, and runs `github/codeql-action/upload-sarif` with `permissions: { security-events: write }`.
2. Keep the workflow-level permissions minimal (as the repo does elsewhere).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

4. Yamllint rule violations 🐞 Bug ⚙ Maintainability ⭐ New
Description
The new workflow likely violates the repository’s yamllint rules (missing YAML document start marker
and non-2-space sequence indentation), which can trigger lint failures where yamllint is enforced.
This also makes the workflow inconsistent with other repo workflows that follow the established
style.
Code

.github/workflows/ethicalcheck.yml[R55-57]

+    steps:
+       - name: EthicalCheck  Free & Automated API Security Testing Service
+         uses: apisec-inc/ethicalcheck-action@005fac321dd843682b1af6b72f30caaf9952c641
Relevance

●●● Strong

Workflow YAML formatting issues are deterministic and likely to be fixed to satisfy repo lint/style
checks.

PR-#105
PR-#106

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The repo’s yamllint config explicitly requires document-start and 2-space indentation, while the
new workflow’s first non-comment line is name: with no preceding --- and its steps list is
indented irregularly compared to the configured style.

.yamllint.yml[19-23]
.github/workflows/ethicalcheck.yml[27-33]
.github/workflows/ethicalcheck.yml[55-57]
.github/workflows/pages.yml[1-3]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The repository includes a `.yamllint.yml` that requires a YAML document start marker and 2-space indentation. The new workflow does not include `---` before the first non-comment line and uses inconsistent indentation for the `steps` sequence.

## Issue Context
Other workflows in this repo commonly include `---` and/or yamllint suppression for `on:` and use consistent 2-space indentation.

## Fix Focus Areas
- .github/workflows/ethicalcheck.yml[1-4]
- .github/workflows/ethicalcheck.yml[29-40]
- .github/workflows/ethicalcheck.yml[55-68]
- .yamllint.yml[19-23]

## Suggested fix
- Add `---` at the top (before the first non-comment key).
- Normalize indentation to 2 spaces throughout (especially list items under `steps:`).
- Consider matching existing workflow conventions for `on:` (e.g., quoting `"on":` or adding `# yamllint disable-line rule:truthy`).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

5. Unpinned upload-sarif action 🐞 Bug ⛨ Security
Description
The workflow uses github/codeql-action/upload-sarif@v3 (a floating tag) instead of pinning to a
commit SHA, reducing supply-chain integrity compared to the repo’s existing SHA-pinning practice.
This can change behavior without any workflow diff.
Code

.github/workflows/ethicalcheck.yml[R65-66]

+       - name: Upload sarif file to repository
+         uses: github/codeql-action/upload-sarif@v3
Relevance

●●● Strong

Repo consistently pins actions and updates pinned SHAs via Dependabot; floating @v3 likely changed.

PR-#98
PR-#142

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new workflow uses a floating major version tag, while existing workflows in the repo
consistently pin actions to specific commit SHAs.

.github/workflows/ethicalcheck.yml[65-68]
.github/workflows/ci.yml[50-61]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`github/codeql-action/upload-sarif` is referenced via `@v3` instead of a commit SHA.

### Issue Context
Other workflows in this repo pin actions to commit SHAs for reproducibility and supply-chain hardening.

### Fix Focus Areas
- .github/workflows/ethicalcheck.yml[65-68]
- .github/workflows/ci.yml[50-61]

### Suggested fix
- Replace `github/codeql-action/upload-sarif@v3` with a full commit SHA (optionally keep a comment indicating the version), consistent with the rest of the repository workflows.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context used
✅ Compliance rules (platform): 13 rules
✅ Skills: flext-law

Grey Divider

Tip of the day
💡 Did you know, you can reply 'qodo' on any finding to push back, ask questions, or dig deeper

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous review results

Review updated until commit e820c15 ⚖️ Balanced

Results up to commit e820c15 ⚖️ Balanced


🐞 Bugs (3) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required
1. Overprivileged third-party action 🐞 Bug ⛨ Security
Description
The job grants security-events: write at job scope, so apisec-inc/ethicalcheck-action runs with
a token able to publish/alter code-scanning (SARIF) security events. If that third-party action is
compromised, it can write arbitrary security alerts/results to the repo without further review.
Code

.github/workflows/ethicalcheck.yml[R50-52]

+    permissions:
+      security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
+      actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
Relevance

●● Moderate

Workflow permission-hardening has been rejected before; third-party + security-events write likely
debated.

PR-#107

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The workflow explicitly grants security-events: write for the job that runs the third-party
action, which means the third-party step executes with the same write-capable token. Other repo
workflows show a pattern of keeping permissions minimal read-only by default.

.github/workflows/ethicalcheck.yml[49-58]
.github/workflows/ci.yml[28-32]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`.github/workflows/ethicalcheck.yml` grants `security-events: write` at the **job** level, which unintentionally gives the same write-capable `GITHUB_TOKEN` to the third-party `apisec-inc/ethicalcheck-action` step.

### Issue Context
The permission is only needed for the later `github/codeql-action/upload-sarif` step, not for generating the SARIF.

### Fix Focus Areas
- .github/workflows/ethicalcheck.yml[45-68]

### Suggested fix
1. Split into two jobs:
  - **scan job**: runs `apisec-inc/ethicalcheck-action` with minimal permissions (e.g., `contents: read` only), outputs `ethicalcheck-results.sarif`, and uploads it as an artifact.
  - **upload job**: depends on scan job, downloads the artifact, and runs `github/codeql-action/upload-sarif` with `permissions: { security-events: write }`.
2. Keep the workflow-level permissions minimal (as the repo does elsewhere).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Plaintext HTTP scan URL 🐞 Bug ⛨ Security
Description
The workflow fetches the OpenAPI spec from a plaintext http:// URL, which allows interception or
tampering of the spec in transit and can change what the scan tests. This weakens the
integrity/confidentiality of the security scan inputs and results.
Code

.github/workflows/ethicalcheck.yml[R59-62]

+          # The OpenAPI Specification URL or Swagger Path or Public Postman collection URL.
+          oas-url: "http://netbanking.apisec.ai:8080/v2/api-docs"
+          # The email address to which the penetration test report will be sent.
+          email: "xxx@apisec.ai"
Relevance

●● Moderate

http→https is reasonable but may break if endpoint lacks TLS; no strong workflow precedent found.

PR-#105

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The EthicalCheck step is configured to pull an OpenAPI spec over http://, which is inherently
vulnerable to on-path modification and observation.

.github/workflows/ethicalcheck.yml[56-63]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`oas-url` is configured with an `http://` endpoint, which is not transport-secure.

### Issue Context
This workflow runs on push/PR to `develop` and on a schedule, so the scan input is repeatedly fetched over plaintext.

### Fix Focus Areas
- .github/workflows/ethicalcheck.yml[59-63]

### Suggested fix
- Change `oas-url` to an `https://` endpoint.
- Make `oas-url` (and `email`) configurable via repo variables/secrets (e.g., `${{ vars.ETHICALCHECK_OAS_URL }}`, `${{ secrets.ETHICALCHECK_EMAIL }}`) so production targets/recipients aren’t hardcoded in the workflow file.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational
3. Unpinned upload-sarif action 🐞 Bug ⛨ Security
Description
The workflow uses github/codeql-action/upload-sarif@v3 (a floating tag) instead of pinning to a
commit SHA, reducing supply-chain integrity compared to the repo’s existing SHA-pinning practice.
This can change behavior without any workflow diff.
Code

.github/workflows/ethicalcheck.yml[R65-66]

+       - name: Upload sarif file to repository
+         uses: github/codeql-action/upload-sarif@v3
Relevance

●●● Strong

Repo consistently pins actions and updates pinned SHAs via Dependabot; floating @v3 likely changed.

PR-#98
PR-#142

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new workflow uses a floating major version tag, while existing workflows in the repo
consistently pin actions to specific commit SHAs.

.github/workflows/ethicalcheck.yml[65-68]
.github/workflows/ci.yml[50-61]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`github/codeql-action/upload-sarif` is referenced via `@v3` instead of a commit SHA.

### Issue Context
Other workflows in this repo pin actions to commit SHAs for reproducibility and supply-chain hardening.

### Fix Focus Areas
- .github/workflows/ethicalcheck.yml[65-68]
- .github/workflows/ci.yml[50-61]

### Suggested fix
- Replace `github/codeql-action/upload-sarif@v3` with a full commit SHA (optionally keep a comment indicating the version), consistent with the rest of the repository workflows.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Qodo Logo

Comment on lines +50 to +52
permissions:
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

1. Overprivileged third-party action 🐞 Bug ⛨ Security

The job grants security-events: write at job scope, so apisec-inc/ethicalcheck-action runs with
a token able to publish/alter code-scanning (SARIF) security events. If that third-party action is
compromised, it can write arbitrary security alerts/results to the repo without further review.
Agent Prompt
### Issue description
`.github/workflows/ethicalcheck.yml` grants `security-events: write` at the **job** level, which unintentionally gives the same write-capable `GITHUB_TOKEN` to the third-party `apisec-inc/ethicalcheck-action` step.

### Issue Context
The permission is only needed for the later `github/codeql-action/upload-sarif` step, not for generating the SARIF.

### Fix Focus Areas
- .github/workflows/ethicalcheck.yml[45-68]

### Suggested fix
1. Split into two jobs:
   - **scan job**: runs `apisec-inc/ethicalcheck-action` with minimal permissions (e.g., `contents: read` only), outputs `ethicalcheck-results.sarif`, and uploads it as an artifact.
   - **upload job**: depends on scan job, downloads the artifact, and runs `github/codeql-action/upload-sarif` with `permissions: { security-events: write }`.
2. Keep the workflow-level permissions minimal (as the repo does elsewhere).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +59 to +62
# The OpenAPI Specification URL or Swagger Path or Public Postman collection URL.
oas-url: "http://netbanking.apisec.ai:8080/v2/api-docs"
# The email address to which the penetration test report will be sent.
email: "xxx@apisec.ai"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

2. Plaintext http scan url 🐞 Bug ⛨ Security

The workflow fetches the OpenAPI spec from a plaintext http:// URL, which allows interception or
tampering of the spec in transit and can change what the scan tests. This weakens the
integrity/confidentiality of the security scan inputs and results.
Agent Prompt
### Issue description
`oas-url` is configured with an `http://` endpoint, which is not transport-secure.

### Issue Context
This workflow runs on push/PR to `develop` and on a schedule, so the scan input is repeatedly fetched over plaintext.

### Fix Focus Areas
- .github/workflows/ethicalcheck.yml[59-63]

### Suggested fix
- Change `oas-url` to an `https://` endpoint.
- Make `oas-url` (and `email`) configurable via repo variables/secrets (e.g., `${{ vars.ETHICALCHECK_OAS_URL }}`, `${{ secrets.ETHICALCHECK_EMAIL }}`) so production targets/recipients aren’t hardcoded in the workflow file.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +65 to +66
- name: Upload sarif file to repository
uses: github/codeql-action/upload-sarif@v3

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Informational

3. Unpinned upload-sarif action 🐞 Bug ⛨ Security

The workflow uses github/codeql-action/upload-sarif@v3 (a floating tag) instead of pinning to a
commit SHA, reducing supply-chain integrity compared to the repo’s existing SHA-pinning practice.
This can change behavior without any workflow diff.
Agent Prompt
### Issue description
`github/codeql-action/upload-sarif` is referenced via `@v3` instead of a commit SHA.

### Issue Context
Other workflows in this repo pin actions to commit SHAs for reproducibility and supply-chain hardening.

### Fix Focus Areas
- .github/workflows/ethicalcheck.yml[65-68]
- .github/workflows/ci.yml[50-61]

### Suggested fix
- Replace `github/codeql-action/upload-sarif@v3` with a full commit SHA (optionally keep a comment indicating the version), consistent with the rest of the repository workflows.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +60 to +62
oas-url: "http://netbanking.apisec.ai:8080/v2/api-docs"
# The email address to which the penetration test report will be sent.
email: "xxx@apisec.ai"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

1. Hardcoded oas-url and email 📜 Skill insight ≡ Correctness

The workflow hardcodes oas-url and email values (including template/sample endpoints and a
placeholder external recipient) instead of sourcing them from configurable GitHub Actions
vars/secrets. This makes environment changes/rotation harder and can cause normal scheduled/push/PR
runs to scan the wrong target and potentially disclose penetration-test reports outside the project.
Agent Prompt
## Issue description
`.github/workflows/ethicalcheck.yml` hardcodes configurable values (`oas-url` and `email`), including template/sample values, rather than sourcing them from GitHub Actions configuration. This violates compliance requirements and risks running scans against the wrong endpoint and sending penetration-test reports to an unintended/external recipient during normal scheduled and push/PR runs.

## Issue Context
- PR Compliance ID 2634353 forbids hardcoding configurable values.
- The EthicalCheck step uses `email` as the address where the penetration-test report will be sent.
- The workflow triggers automatically on push/PR to `develop` and on a weekly cron, so once merged these hard-coded values will be exercised routinely.
- These values are environment/deployment-specific and should be changeable without code edits via GitHub Actions `vars`/`secrets` (and optionally `workflow_dispatch` inputs), and it’s advisable to fail fast if values are unset/placeholder to prevent accidental external scans/reporting.

## Fix Focus Areas
- .github/workflows/ethicalcheck.yml[32-44]
- .github/workflows/ethicalcheck.yml[56-63]
- .github/workflows/ethicalcheck.yml[58-63]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +55 to +57
steps:
- name: EthicalCheck Free & Automated API Security Testing Service
uses: apisec-inc/ethicalcheck-action@005fac321dd843682b1af6b72f30caaf9952c641

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remediation recommended

2. Yamllint rule violations 🐞 Bug ⚙ Maintainability

The new workflow likely violates the repository’s yamllint rules (missing YAML document start marker
and non-2-space sequence indentation), which can trigger lint failures where yamllint is enforced.
This also makes the workflow inconsistent with other repo workflows that follow the established
style.
Agent Prompt
## Issue description
The repository includes a `.yamllint.yml` that requires a YAML document start marker and 2-space indentation. The new workflow does not include `---` before the first non-comment line and uses inconsistent indentation for the `steps` sequence.

## Issue Context
Other workflows in this repo commonly include `---` and/or yamllint suppression for `on:` and use consistent 2-space indentation.

## Fix Focus Areas
- .github/workflows/ethicalcheck.yml[1-4]
- .github/workflows/ethicalcheck.yml[29-40]
- .github/workflows/ethicalcheck.yml[55-68]
- .yamllint.yml[19-23]

## Suggested fix
- Add `---` at the top (before the first non-comment key).
- Normalize indentation to 2 spaces throughout (especially list items under `steps:`).
- Consider matching existing workflow conventions for `on:` (e.g., quoting `"on":` or adding `# yamllint disable-line rule:truthy`).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit e820c15

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

4 issues found across 1 file

Confidence score: 2/5

  • In .github/workflows/ethicalcheck.yml, the EthicalCheck scan is pointed at a hardcoded third-party demo oas-url (netbanking.apisec.ai) that does not match this repository, so the job can produce misleading “pass/fail” signals and no real coverage of your codebase — point oas-url to this repo’s actual API spec/source of truth or gate the job until one exists.
  • In .github/workflows/ethicalcheck.yml, the report destination is still the template placeholder (xxx@apisec.ai), which means security findings may be sent to the wrong party or never reach maintainers, reducing incident response value — replace it with the correct monitored security mailbox/team channel.
  • In .github/workflows/ethicalcheck.yml, security-events: write is granted for the whole job, including the third-party apisec-inc/ethicalcheck-action step, increasing blast radius if that step is compromised — scope security-events: write to only the SARIF upload step (or split steps into separate jobs with least privilege).
  • In .github/workflows/ethicalcheck.yml, github/codeql-action/upload-sarif@v3 is pinned to a mutable major tag, which can change behavior unexpectedly and weaken supply-chain reproducibility — pin to a full commit SHA like the EthicalCheck action.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".github/workflows/ethicalcheck.yml">

<violation number="1" location=".github/workflows/ethicalcheck.yml:51">
P2: The security-events: write permission is granted at the job level, so it also applies to the third-party apisec-inc/ethicalcheck-action step, not just the later upload-sarif step that actually needs it. If that action is compromised, it could write arbitrary code-scanning alerts to the repo. Consider splitting into two jobs (scan + upload) so the write permission is scoped only to the trusted upload-sarif step.</violation>

<violation number="2" location=".github/workflows/ethicalcheck.yml:60">
P1: The `oas-url` points to a hardcoded third-party demo endpoint (`netbanking.apisec.ai`), not to this repository's own API. This repo is the MCB Rust/MCP server and contains no OpenAPI/Swagger spec, so this workflow will scan an unrelated external service rather than any API in this project. That makes every scheduled/push run produce meaningless results and send security-test traffic against an outside host you don't control. This looks like leftover starter-template content. Point the value at this repo's real OpenAPI spec (or a public Postman collection) once such an API exists, and prefer an `https://` URL.</violation>

<violation number="3" location=".github/workflows/ethicalcheck.yml:62">
P2: The penetration-test report is delivered to the placeholder address `xxx@apisec.ai`, which is the generic example value from the starter template. The security report generated by this job will be sent to / displayed for an invalid mailbox instead of the responsible engineer, so no one receives the findings. Wire this up to a real recipient, ideally via a GitHub secret (e.g. `secrets.ETHICALCHECK_REPORT_EMAIL`) rather than baking the address into the workflow.</violation>

<violation number="4" location=".github/workflows/ethicalcheck.yml:66">
P2: The upload-sarif action is referenced by the floating major-version tag `@v3`, unlike the EthicalCheck action above which is pinned to a full commit SHA (`005fac321dd843682b1af6b72f30caaf9952c641`). A mutable tag can change behavior (or be compromised) across runs, breaking reproducibility and opening a supply-chain risk for a security action that processes untrusted SARIF. Pin it to a SHA for consistency with the pinning approach already used in this file.</violation>
</file>

Shadow auto-approve: would not auto-approve because issues were found.

Re-trigger cubic

uses: apisec-inc/ethicalcheck-action@005fac321dd843682b1af6b72f30caaf9952c641
with:
# The OpenAPI Specification URL or Swagger Path or Public Postman collection URL.
oas-url: "http://netbanking.apisec.ai:8080/v2/api-docs"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1: The oas-url points to a hardcoded third-party demo endpoint (netbanking.apisec.ai), not to this repository's own API. This repo is the MCB Rust/MCP server and contains no OpenAPI/Swagger spec, so this workflow will scan an unrelated external service rather than any API in this project. That makes every scheduled/push run produce meaningless results and send security-test traffic against an outside host you don't control. This looks like leftover starter-template content. Point the value at this repo's real OpenAPI spec (or a public Postman collection) once such an API exists, and prefer an https:// URL.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/ethicalcheck.yml, line 60:

<comment>The `oas-url` points to a hardcoded third-party demo endpoint (`netbanking.apisec.ai`), not to this repository's own API. This repo is the MCB Rust/MCP server and contains no OpenAPI/Swagger spec, so this workflow will scan an unrelated external service rather than any API in this project. That makes every scheduled/push run produce meaningless results and send security-test traffic against an outside host you don't control. This looks like leftover starter-template content. Point the value at this repo's real OpenAPI spec (or a public Postman collection) once such an API exists, and prefer an `https://` URL.</comment>

<file context>
@@ -0,0 +1,69 @@
+         uses: apisec-inc/ethicalcheck-action@005fac321dd843682b1af6b72f30caaf9952c641
+         with:
+          # The OpenAPI Specification URL or Swagger Path or Public Postman collection URL.
+          oas-url: "http://netbanking.apisec.ai:8080/v2/api-docs"
+          # The email address to which the penetration test report will be sent.
+          email: "xxx@apisec.ai"
</file context>

sarif-result-file: "ethicalcheck-results.sarif"

- name: Upload sarif file to repository
uses: github/codeql-action/upload-sarif@v3

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: The upload-sarif action is referenced by the floating major-version tag @v3, unlike the EthicalCheck action above which is pinned to a full commit SHA (005fac321dd843682b1af6b72f30caaf9952c641). A mutable tag can change behavior (or be compromised) across runs, breaking reproducibility and opening a supply-chain risk for a security action that processes untrusted SARIF. Pin it to a SHA for consistency with the pinning approach already used in this file.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/ethicalcheck.yml, line 66:

<comment>The upload-sarif action is referenced by the floating major-version tag `@v3`, unlike the EthicalCheck action above which is pinned to a full commit SHA (`005fac321dd843682b1af6b72f30caaf9952c641`). A mutable tag can change behavior (or be compromised) across runs, breaking reproducibility and opening a supply-chain risk for a security action that processes untrusted SARIF. Pin it to a SHA for consistency with the pinning approach already used in this file.</comment>

<file context>
@@ -0,0 +1,69 @@
+          sarif-result-file: "ethicalcheck-results.sarif"
+
+       - name: Upload sarif file to repository
+         uses: github/codeql-action/upload-sarif@v3
+         with:
+          sarif_file: ./ethicalcheck-results.sarif
</file context>

# The OpenAPI Specification URL or Swagger Path or Public Postman collection URL.
oas-url: "http://netbanking.apisec.ai:8080/v2/api-docs"
# The email address to which the penetration test report will be sent.
email: "xxx@apisec.ai"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: The penetration-test report is delivered to the placeholder address xxx@apisec.ai, which is the generic example value from the starter template. The security report generated by this job will be sent to / displayed for an invalid mailbox instead of the responsible engineer, so no one receives the findings. Wire this up to a real recipient, ideally via a GitHub secret (e.g. secrets.ETHICALCHECK_REPORT_EMAIL) rather than baking the address into the workflow.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/ethicalcheck.yml, line 62:

<comment>The penetration-test report is delivered to the placeholder address `xxx@apisec.ai`, which is the generic example value from the starter template. The security report generated by this job will be sent to / displayed for an invalid mailbox instead of the responsible engineer, so no one receives the findings. Wire this up to a real recipient, ideally via a GitHub secret (e.g. `secrets.ETHICALCHECK_REPORT_EMAIL`) rather than baking the address into the workflow.</comment>

<file context>
@@ -0,0 +1,69 @@
+          # The OpenAPI Specification URL or Swagger Path or Public Postman collection URL.
+          oas-url: "http://netbanking.apisec.ai:8080/v2/api-docs"
+          # The email address to which the penetration test report will be sent.
+          email: "xxx@apisec.ai"
+          sarif-result-file: "ethicalcheck-results.sarif"
+
</file context>
Suggested change
email: "xxx@apisec.ai"
email: ${{ secrets.ETHICALCHECK_REPORT_EMAIL }}

jobs:
Trigger_EthicalCheck:
permissions:
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: The security-events: write permission is granted at the job level, so it also applies to the third-party apisec-inc/ethicalcheck-action step, not just the later upload-sarif step that actually needs it. If that action is compromised, it could write arbitrary code-scanning alerts to the repo. Consider splitting into two jobs (scan + upload) so the write permission is scoped only to the trusted upload-sarif step.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/ethicalcheck.yml, line 51:

<comment>The security-events: write permission is granted at the job level, so it also applies to the third-party apisec-inc/ethicalcheck-action step, not just the later upload-sarif step that actually needs it. If that action is compromised, it could write arbitrary code-scanning alerts to the repo. Consider splitting into two jobs (scan + upload) so the write permission is scoped only to the trusted upload-sarif step.</comment>

<file context>
@@ -0,0 +1,69 @@
+jobs:
+  Trigger_EthicalCheck:
+    permissions:
+      security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
+      actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
+    runs-on: ubuntu-latest
</file context>

@marlonsc marlonsc closed this Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants