Skip to content

fix(ci): use env vars instead of secrets in cron workflow run: blocks#28564

Open
camgrimsec wants to merge 2 commits intocalcom:mainfrom
camgrimsec:security/fix-cicd-secrets-exposure
Open

fix(ci): use env vars instead of secrets in cron workflow run: blocks#28564
camgrimsec wants to merge 2 commits intocalcom:mainfrom
camgrimsec:security/fix-cicd-secrets-exposure

Conversation

@camgrimsec
Copy link

Move secret references from direct ${{ secrets.* }} interpolation in run: steps to shell environment variables ($APP_URL, $CRON_API_KEY).

The env: block at job level already populates these from secrets, so the run: blocks should reference the environment variables instead of re-interpolating the secrets. This prevents secrets from appearing in /proc/PID/cmdline (process argument lists) where they could be harvested by a compromised action sharing the same runner.

Affected workflows (10 files):

  • cron-bookingReminder.yml
  • cron-changeTimeZone.yml
  • cron-checkSmsPrices.yml
  • cron-downgradeUsers.yml
  • cron-monthlyDigestEmail.yml
  • cron-scheduleEmailReminders.yml
  • cron-scheduleSMSReminders.yml
  • cron-scheduleWhatsappReminders.yml
  • cron-syncAppMeta.yml
  • cron-webhooks-triggers.yml

Breaking changes: None. Behavioral equivalent — same values flow to the same commands through safer channels.

What does this PR do?

  • Fixes #XXXX (GitHub issue number)
  • Fixes CAL-XXXX (Linear issue number - should be visible at the bottom of the GitHub issue description)

Visual Demo (For contributors especially)

A visual demonstration is strongly recommended, for both the original and new change (video / image - any one).

Video Demo (if applicable):

  • Show screen recordings of the issue or feature.
  • Demonstrate how to reproduce the issue, the behavior before and after the change.

Image Demo (if applicable):

  • Add side-by-side screenshots of the original and updated change.
  • Highlight any significant change(s).

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Are there environment variables that should be set?
  • What are the minimal test data to have?
  • What is expected (happy path) to have (input and output)?
  • Any other important info that could help to test that PR

Checklist

  • I haven't read the contributing guide
  • My code doesn't follow the style guidelines of this project
  • I haven't commented my code, particularly in hard-to-understand areas
  • I haven't checked if my changes generate no new warnings
  • My PR is too large (>500 lines or >10 files) and should be split into smaller PRs

Move secret references from direct ${{ secrets.* }} interpolation in
run: steps to shell environment variables ($APP_URL, $CRON_API_KEY).

The env: block at job level already populates these from secrets, so
the run: blocks should reference the environment variables instead of
re-interpolating the secrets. This prevents secrets from appearing in
/proc/PID/cmdline (process argument lists) where they could be
harvested by a compromised action sharing the same runner.

Affected workflows (10 files):
- cron-bookingReminder.yml
- cron-changeTimeZone.yml
- cron-checkSmsPrices.yml
- cron-downgradeUsers.yml
- cron-monthlyDigestEmail.yml
- cron-scheduleEmailReminders.yml
- cron-scheduleSMSReminders.yml
- cron-scheduleWhatsappReminders.yml
- cron-syncAppMeta.yml
- cron-webhooks-triggers.yml

Breaking changes: None. Behavioral equivalent — same values flow to
the same commands through safer channels.
@camgrimsec camgrimsec requested a review from a team as a code owner March 24, 2026 15:48
@CLAassistant
Copy link

CLAassistant commented Mar 24, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ camgrimsec
❌ DevSecOps Pipeline


DevSecOps Pipeline seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

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

Choose a reason for hiding this comment

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

10 issues found across 10 files

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/cron-downgradeUsers.yml">

<violation number="1" location=".github/workflows/cron-downgradeUsers.yml:23">
P1: Authorization header uses single quotes, so `$CRON_API_KEY` is sent literally and cron authentication fails.</violation>
</file>

<file name=".github/workflows/cron-scheduleWhatsappReminders.yml">

<violation number="1" location=".github/workflows/cron-scheduleWhatsappReminders.yml:15">
P2: US cron API key is mapped from an undefined env var, causing the US cron step condition to evaluate false and skip execution.</violation>
</file>

<file name=".github/workflows/cron-syncAppMeta.yml">

<violation number="1" location=".github/workflows/cron-syncAppMeta.yml:23">
P1: Authorization header uses single quotes, so `$CRON_API_KEY` is not expanded and cron auth fails.</violation>
</file>

<file name=".github/workflows/cron-scheduleEmailReminders.yml">

<violation number="1" location=".github/workflows/cron-scheduleEmailReminders.yml:24">
P1: Authorization header uses single quotes, so `$CRON_API_KEY` is not expanded and cron authentication will fail.</violation>
</file>

<file name=".github/workflows/cron-checkSmsPrices.yml">

<violation number="1" location=".github/workflows/cron-checkSmsPrices.yml:22">
P1: Authorization header is single-quoted, so `$CRON_API_KEY` is not expanded and cron auth will fail.</violation>
</file>

<file name=".github/workflows/cron-monthlyDigestEmail.yml">

<violation number="1" location=".github/workflows/cron-monthlyDigestEmail.yml:32">
P1: Authorization header uses single quotes, so `$CRON_API_KEY` is not expanded and cron auth fails.</violation>
</file>

<file name=".github/workflows/cron-bookingReminder.yml">

<violation number="1" location=".github/workflows/cron-bookingReminder.yml:22">
P1: Authorization header uses single quotes, so `$CRON_API_KEY` is not expanded and the cron request sends a literal token string.</violation>
</file>

<file name=".github/workflows/cron-changeTimeZone.yml">

<violation number="1" location=".github/workflows/cron-changeTimeZone.yml:23">
P1: Authorization header uses single quotes, so `$CRON_API_KEY` is not expanded and cron authentication will fail.</violation>
</file>

<file name=".github/workflows/cron-scheduleSMSReminders.yml">

<violation number="1" location=".github/workflows/cron-scheduleSMSReminders.yml:14">
P2: CRON_API_KEY_US is sourced from env.CRON_API_KEY, but CRON_API_KEY isn’t defined anywhere in this workflow. That leaves CRON_API_KEY_US empty and causes the US cron step to be skipped.</violation>
</file>

<file name=".github/workflows/cron-webhooks-triggers.yml">

<violation number="1" location=".github/workflows/cron-webhooks-triggers.yml:14">
P2: `CRON_API_KEY_US` now references `env.CRON_API_KEY`, but this workflow does not define `CRON_API_KEY` in any env scope. That leaves `CRON_API_KEY_US` empty and the US curl step is skipped by its `if` guard.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

-X POST \
-H 'content-type: application/json' \
-H 'authorization: ${{ secrets.CRON_API_KEY }}' \
-H 'authorization: $CRON_API_KEY' \
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 24, 2026

Choose a reason for hiding this comment

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

P1: Authorization header uses single quotes, so $CRON_API_KEY is not expanded and cron auth fails.

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

<comment>Authorization header uses single quotes, so `$CRON_API_KEY` is not expanded and cron auth fails.</comment>

<file context>
@@ -17,8 +17,8 @@ jobs:
             -X POST \
             -H 'content-type: application/json' \
-            -H 'authorization: ${{ secrets.CRON_API_KEY }}' \
+            -H 'authorization: $CRON_API_KEY' \
             -sSf
</file context>
Fix with Cubic

-X POST \
-H 'content-type: application/json' \
-H 'authorization: ${{ secrets.CRON_API_KEY }}' \
-H 'authorization: $CRON_API_KEY' \
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 24, 2026

Choose a reason for hiding this comment

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

P1: Authorization header uses single quotes, so $CRON_API_KEY is not expanded and cron authentication will fail.

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

<comment>Authorization header uses single quotes, so `$CRON_API_KEY` is not expanded and cron authentication will fail.</comment>

<file context>
@@ -18,8 +18,8 @@ jobs:
             -X POST \
             -H 'content-type: application/json' \
-            -H 'authorization: ${{ secrets.CRON_API_KEY }}' \
+            -H 'authorization: $CRON_API_KEY' \
             -sSf
</file context>
Suggested change
-H 'authorization: $CRON_API_KEY' \
+ -H "authorization: $CRON_API_KEY" \
Fix with Cubic

-X POST \
-H 'content-type: application/json' \
-H 'authorization: ${{ secrets.CRON_API_KEY }}' \
-H 'authorization: $CRON_API_KEY' \
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 24, 2026

Choose a reason for hiding this comment

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

P1: Authorization header is single-quoted, so $CRON_API_KEY is not expanded and cron auth will fail.

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

<comment>Authorization header is single-quoted, so `$CRON_API_KEY` is not expanded and cron auth will fail.</comment>

<file context>
@@ -16,8 +16,8 @@ jobs:
             -X POST \
             -H 'content-type: application/json' \
-            -H 'authorization: ${{ secrets.CRON_API_KEY }}' \
+            -H 'authorization: $CRON_API_KEY' \
             --fail
</file context>
Fix with Cubic

-X POST \
-H 'content-type: application/json' \
-H 'authorization: ${{ secrets.CRON_API_KEY }}' \
-H 'authorization: $CRON_API_KEY' \
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 24, 2026

Choose a reason for hiding this comment

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

P1: Authorization header uses single quotes, so $CRON_API_KEY is not expanded and cron auth fails.

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

<comment>Authorization header uses single quotes, so `$CRON_API_KEY` is not expanded and cron auth fails.</comment>

<file context>
@@ -26,8 +26,8 @@ jobs:
             -X POST \
             -H 'content-type: application/json' \
-            -H 'authorization: ${{ secrets.CRON_API_KEY }}' \
+            -H 'authorization: $CRON_API_KEY' \
             --fail
</file context>
Suggested change
-H 'authorization: $CRON_API_KEY' \
-H "authorization: $CRON_API_KEY" \
Fix with Cubic

-X POST \
-H 'content-type: application/json' \
-H 'authorization: ${{ secrets.CRON_API_KEY }}' \
-H 'authorization: $CRON_API_KEY' \
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 24, 2026

Choose a reason for hiding this comment

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

P1: Authorization header uses single quotes, so $CRON_API_KEY is not expanded and the cron request sends a literal token string.

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

<comment>Authorization header uses single quotes, so `$CRON_API_KEY` is not expanded and the cron request sends a literal token string.</comment>

<file context>
@@ -16,8 +16,8 @@ jobs:
             -X POST \
             -H 'content-type: application/json' \
-            -H 'authorization: ${{ secrets.CRON_API_KEY }}' \
+            -H 'authorization: $CRON_API_KEY' \
             -sSf
</file context>
Suggested change
-H 'authorization: $CRON_API_KEY' \
-H "authorization: $CRON_API_KEY" \
Fix with Cubic

-X POST \
-H 'content-type: application/json' \
-H 'authorization: ${{ secrets.CRON_API_KEY }}' \
-H 'authorization: $CRON_API_KEY' \
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 24, 2026

Choose a reason for hiding this comment

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

P1: Authorization header uses single quotes, so $CRON_API_KEY is not expanded and cron authentication will fail.

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

<comment>Authorization header uses single quotes, so `$CRON_API_KEY` is not expanded and cron authentication will fail.</comment>

<file context>
@@ -17,8 +17,8 @@ jobs:
             -X POST \
             -H 'content-type: application/json' \
-            -H 'authorization: ${{ secrets.CRON_API_KEY }}' \
+            -H 'authorization: $CRON_API_KEY' \
             -sSf
</file context>
Fix with Cubic

APP_URL_US: ${{ vars.APP_URL_US }}
CRON_API_KEY_EU: ${{ secrets.CRON_API_KEY_EU }}
CRON_API_KEY_US: ${{ secrets.CRON_API_KEY }}
CRON_API_KEY_US: ${{ env.CRON_API_KEY }}
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 24, 2026

Choose a reason for hiding this comment

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

P2: US cron API key is mapped from an undefined env var, causing the US cron step condition to evaluate false and skip execution.

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

<comment>US cron API key is mapped from an undefined env var, causing the US cron step condition to evaluate false and skip execution.</comment>

<file context>
@@ -12,7 +12,7 @@ jobs:
       APP_URL_US: ${{ vars.APP_URL_US }}
       CRON_API_KEY_EU: ${{ secrets.CRON_API_KEY_EU }}
-      CRON_API_KEY_US: ${{ secrets.CRON_API_KEY }}
+      CRON_API_KEY_US: ${{ env.CRON_API_KEY }}
     runs-on: ubuntu-latest
     steps:
</file context>
Fix with Cubic

APP_URL_US: ${{ vars.APP_URL_US }}
APP_URL_EU: ${{ vars.APP_URL_EU }}
CRON_API_KEY_US: ${{ secrets.CRON_API_KEY }}
CRON_API_KEY_US: ${{ env.CRON_API_KEY }}
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 24, 2026

Choose a reason for hiding this comment

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

P2: CRON_API_KEY_US is sourced from env.CRON_API_KEY, but CRON_API_KEY isn’t defined anywhere in this workflow. That leaves CRON_API_KEY_US empty and causes the US cron step to be skipped.

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

<comment>CRON_API_KEY_US is sourced from env.CRON_API_KEY, but CRON_API_KEY isn’t defined anywhere in this workflow. That leaves CRON_API_KEY_US empty and causes the US cron step to be skipped.</comment>

<file context>
@@ -11,7 +11,7 @@ jobs:
       APP_URL_US: ${{ vars.APP_URL_US }}
       APP_URL_EU: ${{ vars.APP_URL_EU }}
-      CRON_API_KEY_US: ${{ secrets.CRON_API_KEY }}
+      CRON_API_KEY_US: ${{ env.CRON_API_KEY }}
       CRON_API_KEY_EU: ${{ secrets.CRON_API_KEY_EU }}
     runs-on: ubuntu-latest
</file context>
Fix with Cubic

APP_URL_US: ${{ vars.APP_URL_US }}
APP_URL_EU: ${{ vars.APP_URL_EU }}
CRON_API_KEY_US: ${{ secrets.CRON_API_KEY }}
CRON_API_KEY_US: ${{ env.CRON_API_KEY }}
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 24, 2026

Choose a reason for hiding this comment

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

P2: CRON_API_KEY_US now references env.CRON_API_KEY, but this workflow does not define CRON_API_KEY in any env scope. That leaves CRON_API_KEY_US empty and the US curl step is skipped by its if guard.

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

<comment>`CRON_API_KEY_US` now references `env.CRON_API_KEY`, but this workflow does not define `CRON_API_KEY` in any env scope. That leaves `CRON_API_KEY_US` empty and the US curl step is skipped by its `if` guard.</comment>

<file context>
@@ -11,7 +11,7 @@ jobs:
       APP_URL_US: ${{ vars.APP_URL_US }}
       APP_URL_EU: ${{ vars.APP_URL_EU }}
-      CRON_API_KEY_US: ${{ secrets.CRON_API_KEY }}
+      CRON_API_KEY_US: ${{ env.CRON_API_KEY }}
       CRON_API_KEY_EU: ${{ secrets.CRON_API_KEY_EU }}
     runs-on: ubuntu-latest
</file context>
Fix with Cubic

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants