Skip to content

Commit 9ae240b

Browse files
committed
Updated automation read response shape
The automation read endpoint is still static in this PR, but it should match the upcoming editable automation graph contract so clients can build against the intended actions and edges payload. The secret scan query-string rule now ignores template interpolation placeholders, keeping the existing token URL tests readable without weakening literal credential detection.
1 parent 72fc01f commit 9ae240b

5 files changed

Lines changed: 115 additions & 11 deletions

File tree

.secretlintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
{
1717
"name": "credential in URL query string",
1818
"patterns": [
19-
"/[?&](?:token|api[_-]?key|access[_-]?token|auth[_-]?token|client[_-]?secret|secret|password)=(?<CREDENTIAL>(?!p\\.)[^&\\s\"'<>]{16,})/i"
19+
"/[?&](?:token|api[_-]?key|access[_-]?token|auth[_-]?token|client[_-]?secret|secret|password)=(?<CREDENTIAL>(?!p\\.|\\$\\{)[^&\\s\"'<>]{16,})/i"
2020
]
2121
},
2222
{

ghost/core/core/server/api/endpoints/automations.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,33 @@ const controller = {
3535
query(frame) {
3636
return {
3737
id: frame.data.id,
38+
slug: 'member-welcome-email-free',
3839
name: 'Welcome email',
39-
status: 'active'
40+
status: 'active',
41+
created_at: '2026-05-05T00:00:00.000Z',
42+
updated_at: '2026-05-05T00:00:00.000Z',
43+
actions: [{
44+
id: '67f3f3f3f3f3f3f3f3f3f3f4',
45+
type: 'wait',
46+
data: {
47+
wait_hours: 24
48+
}
49+
}, {
50+
id: '67f3f3f3f3f3f3f3f3f3f3f5',
51+
type: 'send email',
52+
data: {
53+
email_subject: 'Welcome!',
54+
email_lexical: '{"root":{"children":[]}}',
55+
email_sender_name: null,
56+
email_sender_email: null,
57+
email_sender_reply_to: null,
58+
email_design_setting_id: '680000000000000000000001'
59+
}
60+
}],
61+
edges: [{
62+
source_action_id: '67f3f3f3f3f3f3f3f3f3f3f4',
63+
target_action_id: '67f3f3f3f3f3f3f3f3f3f3f5'
64+
}]
4065
};
4166
}
4267
},

ghost/core/test/e2e-api/admin/__snapshots__/automations.test.js.snap

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,58 @@ Object {
7272
"x-powered-by": "Express",
7373
}
7474
`;
75+
76+
exports[`Automations API read returns a placeholder automation for the requested id 1: [body] 1`] = `
77+
Object {
78+
"automations": Array [
79+
Object {
80+
"actions": Array [
81+
Object {
82+
"data": Object {
83+
"wait_hours": 24,
84+
},
85+
"id": "67f3f3f3f3f3f3f3f3f3f3f4",
86+
"type": "wait",
87+
},
88+
Object {
89+
"data": Object {
90+
"email_design_setting_id": "680000000000000000000001",
91+
"email_lexical": "{\\"root\\":{\\"children\\":[]}}",
92+
"email_sender_email": null,
93+
"email_sender_name": null,
94+
"email_sender_reply_to": null,
95+
"email_subject": "Welcome!",
96+
},
97+
"id": "67f3f3f3f3f3f3f3f3f3f3f5",
98+
"type": "send email",
99+
},
100+
],
101+
"created_at": "2026-05-05T00:00:00.000Z",
102+
"edges": Array [
103+
Object {
104+
"source_action_id": "67f3f3f3f3f3f3f3f3f3f3f4",
105+
"target_action_id": "67f3f3f3f3f3f3f3f3f3f3f5",
106+
},
107+
],
108+
"id": "67f3f3f3f3f3f3f3f3f3f3f3",
109+
"name": "Welcome email",
110+
"slug": "member-welcome-email-free",
111+
"status": "active",
112+
"updated_at": "2026-05-05T00:00:00.000Z",
113+
},
114+
],
115+
}
116+
`;
117+
118+
exports[`Automations API read returns a placeholder automation for the requested id 2: [headers] 1`] = `
119+
Object {
120+
"access-control-allow-origin": "http://127.0.0.1:2369",
121+
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
122+
"content-length": "666",
123+
"content-type": "application/json; charset=utf-8",
124+
"content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
125+
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
126+
"vary": "Accept-Version, Origin, Accept-Encoding",
127+
"x-powered-by": "Express",
128+
}
129+
`;

ghost/core/test/e2e-api/admin/automations.test.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,15 @@ describe('Automations API', function () {
7777
it('returns a placeholder automation for the requested id', async function () {
7878
const automationId = '67f3f3f3f3f3f3f3f3f3f3f3';
7979

80-
const {body} = await agent
80+
await agent
8181
.get(`automations/${automationId}`)
8282
.expectStatus(200)
83-
.expect(cacheInvalidateHeaderNotSet());
84-
85-
assert.deepEqual(body.automations, [{
86-
id: automationId,
87-
name: 'Welcome email',
88-
status: 'active'
89-
}]);
83+
.expect(cacheInvalidateHeaderNotSet())
84+
.matchBodySnapshot()
85+
.matchHeaderSnapshot({
86+
'content-version': anyContentVersion,
87+
etag: anyEtag
88+
});
9089
});
9190
});
9291

ghost/core/test/unit/api/endpoints/automations.test.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,33 @@ describe('Automations controller', function () {
7272

7373
assert.deepEqual(result, {
7474
id: '67f3f3f3f3f3f3f3f3f3f3f3',
75+
slug: 'member-welcome-email-free',
7576
name: 'Welcome email',
76-
status: 'active'
77+
status: 'active',
78+
created_at: '2026-05-05T00:00:00.000Z',
79+
updated_at: '2026-05-05T00:00:00.000Z',
80+
actions: [{
81+
id: '67f3f3f3f3f3f3f3f3f3f3f4',
82+
type: 'wait',
83+
data: {
84+
wait_hours: 24
85+
}
86+
}, {
87+
id: '67f3f3f3f3f3f3f3f3f3f3f5',
88+
type: 'send email',
89+
data: {
90+
email_subject: 'Welcome!',
91+
email_lexical: '{"root":{"children":[]}}',
92+
email_sender_name: null,
93+
email_sender_email: null,
94+
email_sender_reply_to: null,
95+
email_design_setting_id: '680000000000000000000001'
96+
}
97+
}],
98+
edges: [{
99+
source_action_id: '67f3f3f3f3f3f3f3f3f3f3f4',
100+
target_action_id: '67f3f3f3f3f3f3f3f3f3f3f5'
101+
}]
77102
});
78103
});
79104
});

0 commit comments

Comments
 (0)