Skip to content

Commit 6532f37

Browse files
Ben ThomasCopilot
authored andcommitted
fix(hub): clarify audit presentation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 0e53d4c commit 6532f37

6 files changed

Lines changed: 26 additions & 19 deletions

File tree

‎hub/client/application/hub/routes/security-audit-flow.test.tsx‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,16 +171,21 @@ describe("real security audit frontend integration", () => {
171171
})
172172

173173
it.each([
174-
["an unsupported query field", "/settings/audit?scope=hub&page=2"],
175-
["repository scope", "/settings/audit?scope=repository"],
176-
["an empty cursor", "/settings/audit?scope=hub&before="],
177-
["repeated cursors", "/settings/audit?scope=hub&before=one&before=two"],
178-
["an oversized cursor", `/settings/audit?scope=hub&before=${"a".repeat(501)}`],
179-
])("shows a 400 error for %s before loading audit data", async (_label, path) => {
174+
["an unsupported query field", "/settings/audit?scope=hub&page=2", null],
175+
[
176+
"repository scope",
177+
"/settings/audit?scope=repository",
178+
"Only the Hub-wide security audit is available.",
179+
],
180+
["an empty cursor", "/settings/audit?scope=hub&before=", null],
181+
["repeated cursors", "/settings/audit?scope=hub&before=one&before=two", null],
182+
["an oversized cursor", `/settings/audit?scope=hub&before=${"a".repeat(501)}`, null],
183+
])("shows a 400 error for %s before loading audit data", async (_label, path, message) => {
180184
const { requests } = await renderApplication(path, [authenticatedSession()])
181185

182186
expect(await screen.findByRole("heading", { name: "Invalid address" })).toBeVisible()
183187
expect(screen.getByText("400")).toBeVisible()
188+
if (message) expect(screen.getByText(message)).toBeVisible()
184189
expect(requests.some((request) => request.includes("/api/security-audits"))).toBe(false)
185190
})
186191

‎hub/client/application/hub/routes/settings-audit/index.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function readRealAuditCursor(url: URL) {
3333
throw redirect(`${url.pathname}?${url.searchParams}`)
3434
}
3535
if (scopes.length !== 1 || scopes[0] !== "hub") {
36-
throw new Response("Only the Hub-wide security audit is available in real mode.", {
36+
throw new Response("Only the Hub-wide security audit is available.", {
3737
status: 400,
3838
})
3939
}

‎hub/client/application/hub/view-models/security-audit-page-data/index.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ describe("securityAuditPageData()", () => {
6868
expect(page.events).toEqual([
6969
expect.objectContaining({
7070
action: "unknown.future.action",
71-
actor: "No signed-in actor",
71+
actor: "Not available",
7272
context: [],
7373
outcome: "Not recorded",
7474
}),
@@ -85,7 +85,7 @@ describe("securityAuditPageData()", () => {
8585
expect.objectContaining({ action: "admission.failed", outcome: "Failed" }),
8686
expect.objectContaining({
8787
action: "session.ended",
88-
actor: "No signed-in actor",
88+
actor: "Not available",
8989
context: [
9090
{ label: "Membership", value: "77777777-7777-4777-8777-777777777777" },
9191
{ label: "Target", value: "88888888-8888-4888-8888-888888888888" },

‎hub/client/application/hub/view-models/security-audit-page-data/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export function securityAuditPageData(
7171
id: record.id,
7272
time: record.occurredAt,
7373
action: record.action,
74-
actor: record.actor ? `Membership ${record.actor.membershipId}` : "No signed-in actor",
74+
actor: record.actor ? `Membership ${record.actor.membershipId}` : "Not available",
7575
context: Object.entries(record.context).map(([key, value]) => ({
7676
label: contextLabel(key),
7777
value: contextValue(value),

‎hub/client/pages/security-audit-page/index.test.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ describe("SecurityAuditPage()", () => {
137137
id: "11111111-1111-4111-8111-111111111111",
138138
time: "2026-10-05T19:00:00Z",
139139
action: "<script>unsafe</script>",
140-
actor: "No signed-in actor",
140+
actor: "Not available",
141141
context: [
142142
{
143143
label: "Reason",
@@ -151,7 +151,7 @@ describe("SecurityAuditPage()", () => {
151151
/>
152152
</ThemeProvider>,
153153
)
154-
expect(screen.getByRole("table")).toHaveTextContent("No signed-in actor")
154+
expect(screen.getByRole("table")).toHaveTextContent("Not available")
155155
expect(screen.getByRole("region", { name: "Security audit" })).toHaveAttribute("tabindex", "0")
156156
expect(screen.getByText("<script>unsafe</script>")).toBeInTheDocument()
157157
expect(

‎hub/client/pages/security-audit-page/stories.tsx‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,15 @@ export const Multiple: Story = {
133133
id: "22222222-2222-4222-8222-222222222222",
134134
time: "2026-10-05T19:01:00Z",
135135
action: "admission.denied",
136-
actor: "No signed-in actor",
136+
actor: "Not available",
137137
context: [{ label: "Reason", value: "membership_missing" }],
138138
outcome: "Denied",
139139
},
140140
{
141141
id: "11111111-1111-4111-8111-111111111111",
142142
time: "2026-10-05T19:00:00Z",
143143
action: "unknown.future.action",
144-
actor: "No signed-in actor",
144+
actor: "Not available",
145145
context: [],
146146
outcome: "Not recorded",
147147
},
@@ -172,13 +172,15 @@ export const Repository: Story = {
172172
},
173173
events: [
174174
{
175-
id: "11111111-1111-4111-8111-111111111111",
176-
time: "2026-10-05T19:00:00Z",
177-
action: "share_link.create",
175+
id: "2",
176+
time: "2026-10-30T13:00:00.000Z",
177+
action: "analytics-save",
178178
actor: "octocat",
179179
context: [
180-
{ label: "Prototype", value: "Welcome" },
181-
{ label: "Build", value: "3" },
180+
{
181+
label: "Details",
182+
value: "Review comment and build events enabled for the analytics destination.",
183+
},
182184
],
183185
outcome: "Succeeded",
184186
},

0 commit comments

Comments
 (0)