PDF step: attach the PDF to the Confluence page
Description
Goal
In Confluence, the PDF step (AP-541) can attach the PDF to the page, as it attaches it to the work item in Jira.
Background
Uploading a page attachment needs the Confluence scope write:confluence-file, which the app does not have: AP-541's live check failed with "Unauthorized; scope does not match", so AP-541 ships Confluence as email only. Adding a scope makes a major version that every site admin must accept, so this ships with the next planned Confluence permission change.
Verified on 2026-11-17 on the dev Confluence app (environment mb-dev, Forge CLI 13.0.0):
-
A version adding
write:confluence-filecannot be rolled out without admin consent:forge version bulk-upgraderefuses it with "Target version has privilege escalation due to additional scopes compared to the source version." (PRIVILEGE_ESCALATION_ROLLOUT), although the app already haswrite:confluence-content. -
The granular
write:attachment:confluenceis refused the same way. -
A version with the same scopes as before is rolled out without consent, so only the new scope blocks it.
-
Forge compares the scopes of the two versions. The production manifest is generated from the same
apfc.js(no Connect scopes such aswrite:connect-confluence), so production behaves the same.
Change
-
Add
write:confluence-fileto the Confluence app (extra/forge-dev/apps/apfc.js). -
Show "Attach to the page" in the Confluence PDF step form, and allow
attachEnabledfor pages inPdfStepValidatorand the Confluence Web API schema. -
Upload with
Confluence.addAttachmentunder the app's identity (as document-sign does), with the same file name as in Jira, and show "Attached <file name>" on the step. -
Sites that have not accepted the new version yet: an upload refused for the missing scope shows a clear step error and Instance error ("Accept the latest app version to attach PDFs to pages") instead of the raw response.
Acceptance criteria
-
A Confluence PDF step with "Attach to the page" adds the PDF to the page's attachments, and the step shows its file name.
-
On a site without the new scope, the step shows the clear error and the approval goes on (unless the reject option is on).
Before release
-
Ships with the next Confluence permission change: new scope, major version, admins accept it. Installations whose admin has not accepted stay on the previous major version, and Atlassian does not email their admins, so plan how admins are told.