docs(security): trace attachment owner filters to relational proof

This commit is contained in:
cesnimda
2026-11-02 23:10:27 +01:00
parent 0a17a33db7
commit 88bcd6d91c
3 changed files with 17 additions and 3 deletions
+2
View File
@@ -1,5 +1,7 @@
# Independent security assessment continuation
Continuation: ATTACHMENT_OWNERSHIP_REVIEW.md traces the parent ownership filter and corrects the reflection-only test assumption. Fourteen existing relational fixture tests freshly passed on identical Phase 10 backend/test sources; native evidence published at db818e5e. Matrix distinguishes direct controller denials from unexecuted HTTP/list/upload/missing-owner/MariaDB checks. No full security scan or final integrated acceptance is implied.
Phase 00 offline preflight, 2 November 2026. Branch `codex/security-offline-preflight`, application baseline `ba826de1e5c959352e4442ab2fec5d02445dd32d`. No application/security implementation changed. No staging attacks or production access.
Read the external master, complete Phase 00 prompt, ROE/finding/release/scan-register templates, repository auditor skill, Codex Security policy and standard-scan skill instructions. Remaining stage prompts must be read before entering their stages. The old master heading “DO NOT START THIS NOW” is superseded for permitted offline work by the owner's later direct execution instruction; protected gates remain.
@@ -0,0 +1,11 @@
# Attachment ownership follow-through
2 November 2026. Source review plus bounded existing relational fixtures; not complete Phase 05, integrated security testing or deployed acceptance.
AttachmentsController.FindOwnedAttachmentAsync:42–47 includes JobApplication while selecting the raw child ID. JobTrackerContext:169–170 denies missing owners and filters JobApplication by CurrentUserId; the Attachment relation at 264–268 uses the parent foreign key. Attachment itself does not have a separate owner filter. Download, Rename and Delete all call this helper. ListForJob first checks the owned JobApplication exists, then limits child rows to that ID. Maintain these relationships; raw child queries without equivalent parent checks are not automatically safe.
AttachmentsControllerTests contains attribute/extension/size reflection tests, not cross-tenant behavioral proof. OwnershipGuardTests similarly checks helper presence. The stronger existing AttachmentConsistencyTests.Another_users_attachment_cannot_be_downloaded_renamed_or_deleted seeds a foreign job/file, clears tracking, checks three NotFound results and verifies the row/file remain.
Fresh targeted execution on the Phase 10 working tree: all 14 AttachmentConsistencyTests passed, zero failures/skips, exit 0, temporary SQLite and synthetic files only. Before execution, git diff between security and Phase 10 branches showed no JobTrackerApi/JobTrackerApi.Tests source difference. Existing Release assembly used --no-build/--no-restore. Evidence published and independently verified on Phase 10 at `db818e5ebd19eeedc05ae58dc3f7a908ce0e713d`, docs/redesign/phase-10/p10-04-evidence/attachment-ownership-and-storage.trx.gz. Uncompressed SHA256 `b589ad1139cb200d9de64b863d65e3304cea0230eda55d89476e5f79347fe84a`.
Result: selected local controller/storage behavior PASSED. Not an authenticated HTTP attack, complete negative list/upload/missing-owner matrix, MariaDB retest, production probe or final scan. Keep those gaps open. No new vulnerability or production exception is asserted; no backend fix was needed for these reviewed paths. Final integrated scan/testing stays deferred until relevant application changes are complete.
+4 -3
View File
@@ -1,7 +1,8 @@
method,route,source,declared_auth,control_observed,sensitive_asset_or_effect,candidate_test_suite,audit_execution
GET,/api/attachments/{jobId:int},AttachmentsController.cs:87,local scheme,job query before attachment listing; filter audit pending,attachment metadata,AttachmentsControllerTests,NOT RUN
GET,/api/attachments/download/{id:int},AttachmentsController.cs:103,local scheme,owned helper and managed path checks,attachment bytes,AttachmentsControllerTests,NOT RUN
PATCH,/api/attachments/{id:int},AttachmentsController.cs:125,local scheme,owned helper; mutation review pending,metadata and AI-use flag,AttachmentsControllerTests,NOT RUN
GET,/api/attachments/{jobId:int},AttachmentsController.cs:87,local scheme,parent owner-filtered existence check before child listing,attachment metadata,AttachmentConsistencyTests,source reviewed; negative list and HTTP NOT RUN
GET,/api/attachments/download/{id:int},AttachmentsController.cs:103,local scheme,parent Include ownership filter and managed path checks,attachment bytes,AttachmentConsistencyTests,PASSED foreign-owner controller rejection; HTTP NOT RUN
PATCH,/api/attachments/{id:int},AttachmentsController.cs:125,local scheme,parent Include ownership filter via shared helper,metadata and AI-use flag,AttachmentConsistencyTests,PASSED foreign-owner controller rejection; HTTP NOT RUN
DELETE,/api/attachments/{id:int},AttachmentsController.cs:170,local scheme,parent Include ownership filter via shared helper,attachment removal,AttachmentConsistencyTests,PASSED foreign-owner controller rejection with row/file retained; HTTP NOT RUN
GET,/api/billing/status,BillingController.cs:42,local scheme,method declares local authentication,entitlement status,BillingControllerTests,NOT RUN
POST,/api/billing/checkout,BillingController.cs:58,local scheme,method declares local authentication; provider mocked only,checkout session,BillingControllerTests,NOT RUN
POST,/api/billing/portal,BillingController.cs:104,local scheme,method declares local authentication; provider mocked only,billing portal,BillingControllerTests,NOT RUN
1 method route source declared_auth control_observed sensitive_asset_or_effect candidate_test_suite audit_execution
2 GET /api/attachments/{jobId:int} AttachmentsController.cs:87 local scheme job query before attachment listing; filter audit pending parent owner-filtered existence check before child listing attachment metadata AttachmentsControllerTests AttachmentConsistencyTests NOT RUN source reviewed; negative list and HTTP NOT RUN
3 GET /api/attachments/download/{id:int} AttachmentsController.cs:103 local scheme owned helper and managed path checks parent Include ownership filter and managed path checks attachment bytes AttachmentsControllerTests AttachmentConsistencyTests NOT RUN PASSED foreign-owner controller rejection; HTTP NOT RUN
4 PATCH /api/attachments/{id:int} AttachmentsController.cs:125 local scheme owned helper; mutation review pending parent Include ownership filter via shared helper metadata and AI-use flag AttachmentsControllerTests AttachmentConsistencyTests NOT RUN PASSED foreign-owner controller rejection; HTTP NOT RUN
5 DELETE /api/attachments/{id:int} AttachmentsController.cs:170 local scheme parent Include ownership filter via shared helper attachment removal AttachmentConsistencyTests PASSED foreign-owner controller rejection with row/file retained; HTTP NOT RUN
6 GET /api/billing/status BillingController.cs:42 local scheme method declares local authentication entitlement status BillingControllerTests NOT RUN
7 POST /api/billing/checkout BillingController.cs:58 local scheme method declares local authentication; provider mocked only checkout session BillingControllerTests NOT RUN
8 POST /api/billing/portal BillingController.cs:104 local scheme method declares local authentication; provider mocked only billing portal BillingControllerTests NOT RUN