Repository navigation
feat(salesforce): delegated OAuth authorization for writeback (#994) - #1313
Merged
Merged
Conversation
Writeback acts as a reviewing Salesforce user who consented, never as the
extraction's client credentials.
- sf_oauth: the OAuth 2.0 web-server flow with PKCE (S256) and a single-use
state stored only as its SHA-256; code exchange, identity binding (the
identity service's org and user must match the id URL, and the token's
instance must be the connection's), refresh, and revocation. Errors carry
Salesforce's error code, never a body or token; every call re-checks the
outbound URL guard and never follows a redirect.
- Routes under /v1/orgs/{org}/connections/{id}/writeback-authorization:
POST start (Admin, redirect allowlisted by ER_SF_OAUTH_REDIRECT_URIS, 503
when unset), POST complete (the state must be this org's, this
connection's, unexpired, unused and started by the same principal), GET
(Viewer, no tokens), DELETE (Admin, revokes here and best-effort at
Salesforce).
- access_token() for the writeback worker: refuses unattended use unless
the grant allows it; Salesforce invalid_grant marks the grant revoked
(consent_withdrawn) so nothing retries a dead grant; no fallback.
- Entities salesforce_oauth_state and salesforce_delegated_grant; the
refresh token and verifier are each returned by exactly one statement.
- Chart value erserver.salesforceOAuthRedirectUris; provider requirements
and deploy configuration in connectors.md §4.3.1.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
The marketing preview was removed because this PR is closed or merged. |
athvin
temporarily deployed
to
marketing-preview
November 27, 2026 06:04 — with
GitHub Actions
Inactive
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #994
sf_oauth(PKCE web-server flow, identity binding, refresh, revoke), fourwriteback-authorizationroutes, the worker-sideaccess_token, two entities, a chart value, and the provider/deploy contract inconnectors.md§4.3.1.#994: writeback must act as a consenting reviewer, not as extraction's client credentials. #995 (journaled apply) depends on it.
Proof
pg_sf_delegated_authagainst a mock Salesforce: code exchange (a wrong PKCE verifier is refused), identity binding, a token for another instance and an identity naming another org both refused (tenant confusion), refresh classified ok / transient (503) / denied / revoked, no response body in errors; routes: 503 unconfigured, viewer 403, non-allowlisted redirect 422, cross-org 404, forged state 409, another admin completing someone else's flow 409, state single-use;access_tokenrefuses unattended use without consent, revokes oninvalid_grant, thenNotAuthorized(no client-credentials fallback); GET never carries a token.make checkexit 0; schema replay/race tests pass.Risk & rollback
Additive tables and routes; the flow answers 503 until a redirect is configured.
git revert <merge-sha>.Post-merge ledger
Closed by: agent · session
Claude Code:24d16c2e-fec6-49d8-9797-060338df4848onbrians-MacBook-Pro· 2026-11-27T06:19:12Zmainis green with this change on it — the merge SHA, and the runthat proves it. A later head SHA with this commit as an ancestor counts;
a cancelled run with zero jobs does not: — 7d1ca93, rust 45949549054 + frontend 45949549083 success
imagesbuilt, or correctly never ran because nothing that goes intoan image changed: — success, run 45949548993
deployconverged — proved by a line the running process emitted, notby the image digest and not by the workflow conclusion: — run 45949975076 success; the live process serves the new routes:
https://dupezero.com/api/openapilistswriteback-authorization, which only the new image hasdeploy,drift,kind's nightly leg) is green, or knowingly red for a reason that is notthis change: — deploy, infra, devcontainer, marketing preview all success on 7d1ca93
Donethrough the automation rather than byhand, and the issue closed: — E9: Add delegated Salesforce authorization for writeback #994 CLOSED by feat(salesforce): delegated OAuth authorization for writeback (#994) #1313 via automation
(a skill, a reference, memory) — or nothing new was learned: — nothing new beyond the PR's Discoveries (PII span gate matches the literal
url.query)Specific to this change
salesforce_oauth_statesandsalesforce_delegated_grants— the new pod serves (boot reconcile refuses to start on a failed apply), run 45949975076Context — plan, discoveries, measurements, files
Plan
Discoveries
code+stateto…/complete. The chart value stays empty (503) until one is configured.url.queryanywhere in product source, including aUrl::query_pairs_mut()call.Measurements
Files
🤖 Generated with Claude Code