Skip to content

feat: connect Faust.js to WordPress with an Application Password - #2676

Merged
josephfusco merged 10 commits into
canaryfrom
feat/application-passwords
Oct 21, 2026
Merged

josephfusco merged 10 commits into
canaryfrom
feat/application-passwords

Conversation

@josephfusco

@josephfusco josephfusco commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Fixes #2678
Related: #2673, #2561, #2564, #1512, #1850, #2312

This is additive: FAUST_SECRET_KEY keeps working unchanged and still encrypts tokens, so nobody is logged out; when FAUST_APPLICATION_USER and FAUST_APPLICATION_PASSWORD are set, core and the CLI use them instead, and FaustWP checks the new faustwp_exchange_tokens and faustwp_upload_blocks capabilities. Tested end to end in the getting-started example against WordPress 7.0 with only an Application Password and no secret key: previews, logout (including ending the WordPress session from #2684) and faust generatePossibleTypes work for a user with just read and faustwp_exchange_tokens, removing that capability gets a 403 and a clear faust dev warning, and PHPUnit passes on single-site and Multisite; deprecating the secret key would be a separate, later change.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Assisting with the capability checks, the core and CLI credential handling, tests, docs, and verifying against a local WordPress.

The token exchange, health check and telemetry routes accept an Application Password whose user can faustwp_exchange_tokens, which administrators have by default. The blockset route needs faustwp_upload_blocks, which maps to manage_options, or manage_network_options on Multisite. The secret key header keeps working.
When FAUST_APPLICATION_USER and FAUST_APPLICATION_PASSWORD are set, the token exchange authenticates with them instead of FAUST_SECRET_KEY.
blockset, generatePossibleTypes, the health checks and telemetry send Basic auth when FAUST_APPLICATION_USER and FAUST_APPLICATION_PASSWORD are set, and fall back to FAUST_SECRET_KEY otherwise.
@josephfusco josephfusco reopened this Oct 20, 2026
@josephfusco
josephfusco marked this pull request as ready for review October 20, 2026 14:48
@josephfusco
josephfusco requested review from a team and colinmurphy as code owners October 20, 2026 14:48
@josephfusco josephfusco added [Type] Feature A new feature within an existing module [Area] Core Issues for the @faustwp/core package [Area] CLI Issues for the @faustwp/cli package [Area] WordPress Plugin Issues for the Faust.js WordPress plugin labels Oct 20, 2026
@josephfusco
josephfusco requested a balanced review from Copilot October 20, 2026 16:32

Copilot AI left a comment

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.

🟡 Changes recommended

Default CLI health checks block schema generation for valid Application Password users without token-exchange permission.

1 open issue
What changed in this PR

Adds Application Password authentication to Faust core and CLI, with capability checks in FaustWP, while preserving shared-secret authentication and token encryption.

Changes:

  • Prefer configured Application Passwords for server and CLI requests.
  • Separate token-exchange and block-upload permissions.
  • Add authentication tests and setup documentation.
File Description
plugins/​faustwp/​tests/​integration/​ApplicationPasswordAuthTests.php Tests authentication and capability restrictions.
plugins/​faustwp/​includes/​rest/​callbacks.php Accepts capability-checked Application Passwords.
plugins/​faustwp/​includes/​auth/​functions.php Adds Application Password authentication helpers.
plugins/​faustwp/​includes/​auth/​callbacks.php Defines capability mappings and defaults.
packages/​faustwp-core/​tests/​server/​auth/​token.test.ts Tests Application Password token exchanges.
packages/​faustwp-core/​src/​server/​auth/​token.ts Supports Application Passwords for token requests.
packages/​faustwp-core/​src/​lib/​getWpApplicationPassword.ts Builds the authorization header.
packages/​faustwp-cli/​tests/​utils/​getWpAuthHeaders.test.ts Tests credential selection.
packages/​faustwp-cli/​tests/​healthCheck/​validateFaustEnvVars.test.ts Tests credential validation and diagnostics.
packages/​faustwp-cli/​src/​utils/​index.ts Exports credential helpers.
packages/​faustwp-cli/​src/​utils/​getWpAuthHeaders.ts Centralizes CLI authentication headers.
packages/​faustwp-cli/​src/​telemetry/​sendTelemetryData.ts Supports either credential type.
packages/​faustwp-cli/​src/​index.ts Enables telemetry with either credential type.
packages/​faustwp-cli/​src/​healthCheck/​validateNextWordPressUrl.ts Uses shared authentication headers.
packages/​faustwp-cli/​src/​healthCheck/​validateFaustEnvVars.ts Validates credentials and reports authorization failures.
packages/​faustwp-cli/​src/​generatePossibleTypes.ts Authenticates introspection with selected credentials.
packages/​faustwp-cli/​src/​blockset.ts Supports authenticated block uploads.
docs/​how-to/​authentication/​index.md Documents setup, permissions, and limitations.

Review effort: Balanced

Comment thread packages/faustwp-cli/src/healthCheck/validateFaustEnvVars.ts
…ssword that can't exchange tokens

The health check rejected a 403 from validate_secret_key for every command. generatePossibleTypes, generateGlobalStylesheet and blockset call WordPress with their own permissions, so for them a user without faustwp_exchange_tokens now gets a warning instead of an exit.
…ssword

The logout handler only sent FAUST_SECRET_KEY to FaustWP's logout route, so with an Application Password and no secret key, logging out skipped ending the WordPress session.

Copilot AI left a comment

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.

🔵 Needs a closer look

Cross-system authentication and Multisite permission changes warrant human security review, and the credential diagnostic still needs correction.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment thread packages/faustwp-cli/src/healthCheck/validateFaustEnvVars.ts
@josephfusco
josephfusco merged commit f34412c into canary Oct 21, 2026
31 of 34 checks passed
@josephfusco
josephfusco deleted the feat/application-passwords branch October 21, 2026 14:20
@github-actions github-actions Bot mentioned this pull request Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Area] CLI Issues for the @faustwp/cli package [Area] Core Issues for the @faustwp/core package [Area] WordPress Plugin Issues for the Faust.js WordPress plugin [Type] Feature A new feature within an existing module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: connect Faust.js to WordPress with an Application Password

2 participants