Skip to content

chore(install): generate the executor secret on install - #14770

Merged
HarshMN2345 merged 1 commit into
mainfrom
chore-executor-secret
Oct 22, 2026
Merged

HarshMN2345 merged 1 commit into
mainfrom
chore-executor-secret

Conversation

@HarshMN2345

Copy link
Copy Markdown
Member

What changed

  • _APP_EXECUTOR_SECRET uses the token filter, so fresh installs generate it instead of keeping the your-secret-key placeholder.
  • The API logs a warning at startup when the placeholder is still set.

Tested

  • Pint and php -l on the changed files. The installer and the startup warning were not run.

Fresh installs generate _APP_EXECUTOR_SECRET like the other token
secrets instead of keeping the placeholder, and the API warns at
startup when the placeholder is still set.
@luxor-code-review

luxor-code-review Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Review complete. No blocking issues — approved ✅; 1 nitpick below.

🧹 Nitpicks (1) — 🟢 1 low
  • 🟢 Executor-secret warning only fires in app/http.php (http.php:43) — The new insecure-default warning for _APP_EXECUTOR_SECRET exists only in the HTTP bootstrap (app/http.php:43-45), while app/worker.php, app/realtime.php, app/mqtt.php, and app/cli.php run the sibling _APP_OPENSSL_KEY_V1 assertProduction check but never warn about the executor secret.

This PR registers _APP_EXECUTOR_SECRET with a token filter in app/config/variables.php and adds an insecure-default warning beside the existing _APP_OPENSSL_KEY_V1 checks in app/http.php, so operators running the public default get a startup log line instead of silence.

Files Change
app/config/variables.php Declares _APP_EXECUTOR_SECRET with a token filter so the secret is masked in logs and payload dumps.
app/http.php Warns at startup when _APP_EXECUTOR_SECRET is missing, empty, or the placeholder via EncryptionKey::isInsecure().

Reviewed commit: 745ccdf

@ghost

ghost commented Oct 22, 2026 •

Copy link
Copy Markdown

🔵 Tier A · Mergeable after minor fixes

The only finding is a minor misleading startup warning for unset or blank secrets.

The installer now generates _APP_EXECUTOR_SECRET for fresh installs, and the API checks the configured value at startup. The startup check emits a warning when the secret is insecure.

Verdict New comments Fixed Still open
💬 Commented 1 0 0

Note

Not approving while a bug finding is open: Make the warning accurate for missing secrets

Finding Where
🟡 Make the warning accurate for missing secrets app/http.php:43
Fix with agent prompt
### Issue 1
app/http.php:43-44
**Make the warning accurate for missing secrets**

`isInsecure()` also matches `null` and an empty string, so an unset or blank secret reaches this message claiming it is the public placeholder. Operators in that case may look for a placeholder value that is not present; mention the missing/empty cases too, or narrow the condition to the placeholder.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
📂 Walkthrough · 2
File Change
app/config/variables.php Enable token generation for _APP_EXECUTOR_SECRET during installation.
app/http.php Add a startup warning for an insecure executor secret.

Reviewed 745ccdf · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost 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.

🔵 Tier A · See the inline comments. Summary

Comment thread app/http.php
Comment on lines +43 to +44
if (EncryptionKey::isInsecure(System::getEnv('_APP_EXECUTOR_SECRET'))) {
Console::warning('_APP_EXECUTOR_SECRET is the public default "' . EncryptionKey::PLACEHOLDER . '". Set a unique secret.');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Make the warning accurate for missing secrets

isInsecure() also matches null and an empty string, so an unset or blank secret reaches this message claiming it is the public placeholder. Operators in that case may look for a placeholder value that is not present; mention the missing/empty cases too, or narrow the condition to the placeholder.

Prompt To Fix With AI
This is a comment left during a code review.
Path: app/http.php
Line: 43-44

Comment:
**Make the warning accurate for missing secrets**

`isInsecure()` also matches `null` and an empty string, so an unset or blank secret reaches this message claiming it is the public placeholder. Operators in that case may look for a placeholder value that is not present; mention the missing/empty cases too, or narrow the condition to the placeholder.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

🟡 Minor · error-handling · Reply if this doesn't apply.

@github-actions

Copy link
Copy Markdown

Security rules

No new WARNING or ERROR findings from security rules.

19 existing findings tracked in .semgrep/baseline.json
  • php.appwrite.guest-write-without-abuse-limit (12)
  • php.appwrite.secret-compare-timing (5)
  • php.appwrite.weak-secret-env-default (2)

Posted by Checks / Rules. Re-runs update this comment in place. Rule details and baseline: .semgrep/README.md.

@github-actions

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → chore-executor-secret (after).

Metric Before After Change
🚀 Requests/sec 191.56 189.16 ⚪ -1.3%
⏱️ Latency P50 88.08 ms 90.68 ms ⚪ +3%
⏱️ Latency P95 214.48 ms 215.29 ms ⚪ +0.4%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 90.68 215.29 11,799 189.16 +0.82
Account 174.49 316.93 621 10.27 -11.85
TablesDB 87.78 167.3 6,417 104.9 +5.35
Storage 83.81 197.03 3,105 52.77 -0.52
Functions 131.35 250.26 1,656 28.86 -2.71

Top API waits (after)

API request Max wait (ms)
account.prefs.update 464.72
account.name.update 464.01
functions.variables.update 432.27
functions.variables.create 363.87
storage.files.create 359.57

@HarshMN2345
HarshMN2345 merged commit c89c143 into main Oct 22, 2026
69 checks passed
Tapraj-Pathak pushed a commit to Tapraj-Pathak/appwrite that referenced this pull request Oct 24, 2026
chore(install): generate the executor secret on install

(cherry picked from commit c89c143)
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.

1 participant