Skip to content

sec: warn on plaintext SCHEDULED_TASK_SECRET when secret-name path is active#577

Open
cristim wants to merge 1 commit into
feat/multicloud-web-frontendfrom
fix/451-scheduled-task-secret-guard
Open

sec: warn on plaintext SCHEDULED_TASK_SECRET when secret-name path is active#577
cristim wants to merge 1 commit into
feat/multicloud-web-frontendfrom
fix/451-scheduled-task-secret-guard

Conversation

@cristim
Copy link
Copy Markdown
Member

@cristim cristim commented May 20, 2026

Summary

  • Fixes resolveScheduledTaskSecret in internal/server/app.go to prefer the secret-store path when SCHEDULED_TASK_SECRET_NAME is set, instead of silently returning the plaintext value
  • Adds a SECURITY WARNING log message at startup when both SCHEDULED_TASK_SECRET (plaintext, visible in Lambda env / Terraform state) and SCHEDULED_TASK_SECRET_NAME are configured together
  • Four new regression tests covering both-set (secret-store wins), plaintext-only dev path, resolver-error fallback, and standard prod path

The previous behaviour silently bypassed the Secrets Manager lookup whenever the plaintext variable was non-empty, making the production bearer-mode path identical to the dev path even in AWS Lambda deployments.

Closes #451

… active (closes #451)

resolveScheduledTaskSecret previously returned the plaintext
SCHEDULED_TASK_SECRET value immediately when both SCHEDULED_TASK_SECRET
and SCHEDULED_TASK_SECRET_NAME were set, silently bypassing the
secret-manager lookup. Lambda env vars and Terraform state are visible
in the AWS console, making the plaintext path a leak surface in
production bearer-mode deployments.

Two changes:
1. When both variables are configured, log a SECURITY WARNING at startup
   so operators know the configuration is risky. The message names the
   exact env var to remove.
2. Drop the `cfg.ScheduledTaskSecret != ""` short-circuit condition so
   the secret-name path always wins when SCHEDULED_TASK_SECRET_NAME is
   set and the resolver is available; the plaintext is only used as a
   genuine fallback when the resolver call fails.

Four regression tests cover: both-set (secret-store wins), plaintext-only
with no resolver (dev path), resolver-error fallback, and secret-name-only
(standard prod path).
@cristim cristim added bug Something isn't working triaged Item has been triaged priority/p2 Backlog-worthy severity/medium Moderate harm urgency/this-sprint Within the current sprint impact/few Limited audience labels May 20, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Warning

Rate limit exceeded

@cristim has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 28 minutes and 9 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e9aa4afd-c483-46cf-9c22-3775bad9582d

📥 Commits

Reviewing files that changed from the base of the PR and between bc8831b and 367314c.

📒 Files selected for processing (2)
  • internal/server/app.go
  • internal/server/app_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/451-scheduled-task-secret-guard

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

@cristim
Copy link
Copy Markdown
Member Author

cristim commented May 20, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim cristim added the type/security Security finding label May 20, 2026
@cristim
Copy link
Copy Markdown
Member Author

cristim commented May 20, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim
Copy link
Copy Markdown
Member Author

cristim commented May 22, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim
Copy link
Copy Markdown
Member Author

cristim commented May 22, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working impact/few Limited audience priority/p2 Backlog-worthy severity/medium Moderate harm triaged Item has been triaged type/security Security finding urgency/this-sprint Within the current sprint

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant