Skip to content

Commit 6e272c8

Browse files
mokagioclaude
andauthored
Use the same secrets file across WordPress, Jetpack, and Reader (#25803)
* Remove dead Google login credentials Removed with WordPressAuthenticator, via f8ad8c4 - #25646 * Remove dead GoogleSignIn URL scheme entries These were the OAuth callback schemes — reversed Google client IDs — for the Google sign-in flow that lived in `WordPressAuthenticator`, deleted in #25646. Nothing handles the scheme anymore. The schemes were hardcoded here rather than injected from `googleLoginSchemeId`, so removing that secret in the preceding commit left them untouched and equally dead. --- Generated with the help of Claude Code, https://claude.ai/code Co-Authored-By: Claude Code Opus 4.8 <noreply@anthropic.com> * Move Sentry DSN definition from secrets to `Info.plist` That value does not need to be secret. See https://docs.sentry.io/concepts/key-terms/dsn-explainer/#dsn-utilization * Update DocsBot documentation links The `/docs/` path the widget comment pointed at is stale; the page now lives under `/documentation/developer/`. The same link sits on `docsBotId` because it establishes what the value is: the widget `id` is embed code, documented for placement in a site's public HTML. That makes it a candidate to leave `BuildSecrets` the way the Sentry DSN did. --- Generated with the help of Claude Code, https://claude.ai/code Co-Authored-By: Claude Code Opus 4.8 <noreply@anthropic.com> * Move Docs Bot ID from secrets to Jetpack's `Info.plist` * Read one secrets file for all app targets The per-app branching existed because the secrets files held app-specific values. Those have since moved to each app's `Info.plist`, read via `BuildSettings`, leaving only values the three apps share. `WordPress-Secrets-Internal.swift` and `-Alpha.swift` leave the input list too: the script stopped reading them well before this change. The shebang moves to `#!/usr/bin/env bash` with a separate `set -euo pipefail`. `#!/bin/bash -euo pipefail` passed multiple parameters, which most systems do not support. --- Generated with the help of Claude Code, https://claude.ai/code Co-Authored-By: Claude Code Opus 4.8 <noreply@anthropic.com> * Fix stale script path in credentials filelist The entry pointed at `ApplyConfiguration.sh`, renamed in e78ed88 and never updated here, so the self-dependency its comment describes was not wired: Xcode had no edge from the build phase to the script driving it. --- Generated with the help of Claude Code, https://claude.ai/code Co-Authored-By: Claude Code Opus 4.8 <noreply@anthropic.com> * Store the Sentry DSN without its scheme `INFOPLIST_PREPROCESS` is on for WordPress and Jetpack, so the plist goes through the C preprocessor, where `//` opens a comment. The `https://` in the DSN swallowed the rest of the line including `</string>`, leaving XML that `ProcessInfoPlistFile` could not parse, and every app build failed. Reader does not preprocess its plist, but the value is read through one code path, so all three stay consistent. This mirrors `WPProductBlogURL`, which is stored scheme-less for the same reason. --- Generated with the help of Claude Code, https://claude.ai/code Co-Authored-By: Claude Code Opus 4.8 <noreply@anthropic.com> * Slim down AI-generated comment * Name the Sentry DSN key for its missing scheme The constraint only shows up in `BuildSettings+Live.swift`, which someone editing the plist never opens. `WPSentryNoSchemeDSN` states it where a full DSN would otherwise get pasted, and unlike an XML comment it survives Xcode's plist editor. --- Generated with the help of Claude Code, https://claude.ai/code Co-Authored-By: Claude Code Opus 4.8 <noreply@anthropic.com> * Remove now-unused app-specific secrets * Drop the app prefix from the secrets file name Every target reads this file now, so naming it after one of them misleads. It also matches the source name in the secrets repo, `iOS/WPiOS/Secrets.swift`. --- Generated with the help of Claude Code, https://claude.ai/code Co-Authored-By: Claude Code Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Code Opus 4.8 <noreply@anthropic.com>
1 parent 78ade99 commit 6e272c8

19 files changed

Lines changed: 38 additions & 116 deletions

.configure

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,7 @@
55
"files_to_copy": [
66
{
77
"file": "iOS/WPiOS/Secrets.swift",
8-
"destination": "~/.configure/wordpress-ios/secrets/WordPress-Secrets.swift",
9-
"encrypt": true
10-
},
11-
{
12-
"file": "iOS/WPiOS/Secrets-Internal.swift",
13-
"destination": "~/.configure/wordpress-ios/secrets/WordPress-Secrets-Internal.swift",
14-
"encrypt": true
15-
},
16-
{
17-
"file": "iOS/WPiOS/Secrets-Alpha.swift",
18-
"destination": "~/.configure/wordpress-ios/secrets/WordPress-Secrets-Alpha.swift",
19-
"encrypt": true
20-
},
21-
{
22-
"file": "iOS/JPiOS/Jetpack-Secrets.swift",
23-
"destination": "~/.configure/wordpress-ios/secrets/Jetpack-Secrets.swift",
24-
"encrypt": true
25-
},
26-
{
27-
"file": "iOS/Reader/Reader-Secrets.swift",
28-
"destination": "~/.configure/wordpress-ios/secrets/Reader-Secrets.swift",
8+
"destination": "~/.configure/wordpress-ios/secrets/Secrets.swift",
299
"encrypt": true
3010
}
3111
],
-1.17 KB
Binary file not shown.
-1.33 KB
Binary file not shown.
-1.13 KB
Binary file not shown.
-1.13 KB
Binary file not shown.

Modules/Sources/BuildSettingsKit/BuildSecrets.swift

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,6 @@ public struct BuildSecrets: Sendable {
1010
}
1111
}
1212

13-
public struct Google: Sendable {
14-
public let clientId: String
15-
public let schemeId: String
16-
public let serverClientId: String
17-
18-
public init(clientId: String, schemeId: String, serverClientId: String) {
19-
self.clientId = clientId
20-
self.schemeId = schemeId
21-
self.serverClientId = serverClientId
22-
}
23-
}
24-
2513
public struct Zendesk: Sendable {
2614
public let appId: String
2715
public let url: String
@@ -35,27 +23,18 @@ public struct BuildSecrets: Sendable {
3523
}
3624

3725
public let oauth: OAuth
38-
public let google: Google
3926
public let zendesk: Zendesk
40-
public let sentryDSN: String
41-
public let docsBotId: String
4227
public let encryptedLogsKey: String
4328
public let debuggingKey: String
4429

4530
public init(
4631
oauth: OAuth,
47-
google: Google,
4832
zendesk: Zendesk,
49-
sentryDSN: String,
50-
docsBotId: String,
5133
encryptedLogsKey: String,
5234
debuggingKey: String
5335
) {
5436
self.oauth = oauth
55-
self.google = google
5637
self.zendesk = zendesk
57-
self.sentryDSN = sentryDSN
58-
self.docsBotId = docsBotId
5938
self.encryptedLogsKey = encryptedLogsKey
6039
self.debuggingKey = debuggingKey
6140
}
@@ -65,10 +44,7 @@ extension BuildSecrets {
6544

6645
public static let dummy = BuildSecrets(
6746
oauth: .init(client: "", secret: ""),
68-
google: .init(clientId: "", schemeId: "", serverClientId: ""),
6947
zendesk: .init(appId: "", url: "", clientId: ""),
70-
sentryDSN: "",
71-
docsBotId: "",
7248
encryptedLogsKey: "",
7349
debuggingKey: ""
7450
)

Modules/Sources/BuildSettingsKit/BuildSettings+Live.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ extension BuildSettings {
3434
zendeskSourcePlatform = bundle.infoValue(forKey: "WPZendeskSourcePlatform")
3535
mobileAnnounceAppID = bundle.infoValue(forKey: "WPMobileAnnounceAppID")
3636
authKeychainServiceName = bundle.infoValue(forKey: "WPAuthKeychainServiceName")
37+
// The plist does not carry the URL scheme because the C preprocessor treats the `//` as a comment resulting in a truncated value.
38+
sentryDSN = "https://" + bundle.infoValue(forKey: "WPSentryNoSchemeDSN")
39+
docsBotId = bundle.infoValue(forKey: "WPDocsBotId")
3740
}
3841
}
3942

Modules/Sources/BuildSettingsKit/BuildSettings+Preview.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ extension BuildSettings {
2020
),
2121
zendeskSourcePlatform: "zen",
2222
mobileAnnounceAppID: "1234567890",
23-
authKeychainServiceName: "public-api.wordpress.com"
23+
authKeychainServiceName: "public-api.wordpress.com",
24+
sentryDSN: "",
25+
docsBotId: ""
2426
)
2527
}
2628

Modules/Sources/BuildSettingsKit/BuildSettings.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ public struct BuildSettings: Sendable {
3838
public var zendeskSourcePlatform: String
3939
public var mobileAnnounceAppID: String
4040
public var authKeychainServiceName: String
41+
/// See [Sentry: DSN utilization](https://docs.sentry.io/concepts/key-terms/dsn-explainer/#dsn-utilization)
42+
public var sentryDSN: String
43+
/// Empty outside Jetpack, the only app that presents the support chat bot.
44+
///
45+
/// See [DocsBot: Embeddable Chat Widget](https://docsbot.ai/documentation/developer/embeddable-chat-widget)
46+
public var docsBotId: String
4147

4248
public struct ProductAboutDetails: Sendable {
4349
public var blogURL: URL

Scripts/BuildPhases/GenerateCredentials.sh

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#!/bin/bash -euo pipefail
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
24

35
# The Secrets File Sources
46
SECRETS_ROOT="${HOME}/.configure/wordpress-ios/secrets"
@@ -47,13 +49,8 @@ function ensure_is_in_input_files_list() {
4749
fi
4850
}
4951

50-
WORDPRESS_SECRETS_FILE="${SECRETS_ROOT}/WordPress-Secrets.swift"
51-
ensure_is_in_input_files_list $WORDPRESS_SECRETS_FILE
52-
JETPACK_SECRETS_FILE="${SECRETS_ROOT}/Jetpack-Secrets.swift"
53-
ensure_is_in_input_files_list $JETPACK_SECRETS_FILE
54-
55-
READER_SECRETS_FILE="${SECRETS_ROOT}/Reader-Secrets.swift"
56-
ensure_is_in_input_files_list $READER_SECRETS_FILE
52+
SECRETS_FILE="${SECRETS_ROOT}/Secrets.swift"
53+
ensure_is_in_input_files_list $SECRETS_FILE
5754

5855
LOCAL_SECRETS_FILE="${SRCROOT}/Credentials/Secrets.swift"
5956
EXAMPLE_SECRETS_FILE="${SRCROOT}/Credentials/Secrets-example.swift"
@@ -63,26 +60,10 @@ ensure_is_in_input_files_list $EXAMPLE_SECRETS_FILE
6360
SECRETS_DESTINATION_FILE="${SCRIPT_OUTPUT_FILE_0}"
6461
mkdir -p "$(dirname "$SECRETS_DESTINATION_FILE")"
6562

66-
WORDPRESS_TARGETS=("WordPress" "WordPressShareExtension" "WordPressDraftActionExtension" "WordPressNotificationServiceExtension")
67-
# If the WordPress Production Secrets are available for WordPress, use them
68-
if [ -f "$WORDPRESS_SECRETS_FILE" ] && [[ " ${WORDPRESS_TARGETS[*]} " == *" $TARGET_NAME "* ]]; then
63+
# WordPress, Jetpack, and Reader use all the same secrets at this time.
64+
if [ -f "$SECRETS_FILE" ]; then
6965
echo "Applying Production Secrets"
70-
cp -v "$WORDPRESS_SECRETS_FILE" "${SECRETS_DESTINATION_FILE}"
71-
exit 0
72-
fi
73-
74-
JETPACK_TARGETS=("Jetpack" "JetpackStatsWidgets" "JetpackShareExtension" "JetpackDraftActionExtension" "JetpackNotificationServiceExtension")
75-
# If the Jetpack Secrets are available and if we're building Jetpack use them
76-
if [ -f "$JETPACK_SECRETS_FILE" ] && [[ " ${JETPACK_TARGETS[*]} " == *" $TARGET_NAME "* ]]; then
77-
echo "Applying Jetpack Secrets"
78-
cp -v "$JETPACK_SECRETS_FILE" "${SECRETS_DESTINATION_FILE}"
79-
exit 0
80-
fi
81-
82-
# If the Reader Secrets are available and if we're building Reader use them
83-
if [ -f "$READER_SECRETS_FILE" ] && [ "${TARGET_NAME}" == "Reader" ]; then
84-
echo "Applying Reader Secrets"
85-
cp -v "$READER_SECRETS_FILE" "${SECRETS_DESTINATION_FILE}"
66+
cp -v "$SECRETS_FILE" "${SECRETS_DESTINATION_FILE}"
8667
exit 0
8768
fi
8869

0 commit comments

Comments
 (0)