Repository navigation
Fix QR object-URL leak, asset status filtering and frontend security headers - #1858
Merged
yusuftomilola merged 10 commits intoNov 24, 2026
Conversation
Track the published blob URL in a ref and release it when the effect for an asset is torn down, clearing rendered state first so no <img> points at a revoked URL. Superseded requests no longer create URLs.
Closes DistinctCodes#1781 Mock URL.createObjectURL/revokeObjectURL and @/lib/api to assert the URL is revoked on unmount, on assetId change, and that cancelled requests never create a URL.
Resolve the query status through AssetLifecycleService.normalizeStatus before binding :st, matching updateStatus and making aliases filter on the canonical stored status.
Closes DistinctCodes#1780 Extend the DTO spec for canonical/alias/lower-case/unknown statuses and add a findAll spec proving each input filters on the canonical AssetStatus.
Replace the stale ACTIVE/MAINTENANCE enum members with AVAILABLE/IN_MAINTENANCE so report colors match the canonical statuses returned by the API.
Derive connect-src from NEXT_PUBLIC_API_URL and NEXT_PUBLIC_WS_URL at build time, keep 'self' and the Stellar/Soroban testnet endpoints, drop localhost origins from production builds and remove 'unsafe-eval' outside development. All other headers are unchanged.
Closes DistinctCodes#1778 Add a next.config test asserting configured API/WS origins appear in connect-src, localhost and unsafe-eval never ship in production, dev keeps them, and unrelated headers stay intact.
Change camera=() to camera=(self) so the QR scanner's getUserMedia call works with production headers; microphone and geolocation remain denied.
Closes DistinctCodes#1776 Verify the production Permissions-Policy header keeps camera=(self) while microphone and geolocation stay denied.
|
@akargi is attempting to deploy a commit to the naijabuz's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@akargi Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
2 tasks
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.
Summary
This PR fixes four frontend security/status-alignment issues.
#1781 —
useAssetQrnever revoked its object URLfrontend/hooks/useAssetQr.tsnow tracks the currently published blob URL in a ref and revokes it when the effect for an asset is torn down (asset change or unmount), including when the request is cancelled. The URL is cleared from rendered state before being revoked, so no<img>is left pointing at a revoked URL, and superseded requests never create a URL at all.frontend/hooks/useAssetQr.test.tswith mockedURL.createObjectURL/URL.revokeObjectURLand@/lib/api, covering publish, revoke on unmount, revoke onassetIdchange, and cancellation before resolve.#1780 — Asset status aliases: form sends canonical, list filters raw
main: the real gap was the backend query contract, not the frontend enum.backend/src/assets/dto/list-assets-query.dto.tsnow validatesstatuswith@IsIn(Object.values(AssetStatusInput))after a@Transformthat trims/uppercases the value. Canonical statuses plus theACTIVE/MAINTENANCEaliases are accepted; unknown values are rejected with a 400.backend/src/assets/assets.service.ts::findAllnow resolves the status throughthis.lifecycle.normalizeStatus(query.status)before binding:st, mirroringupdateStatus, so aliases filter on the canonical stored value.list-assets-query.dto.spec.tsand addedassets.status-filter.spec.tsproving every canonical value and alias filters on the matchingAssetStatus.frontend/features/Dashboard/DashboardCharts.tsx(ACTIVE→AVAILABLE,MAINTENANCE→IN_MAINTENANCE). The assets list filter already sends canonical values.#1778 — CSP hard-coded
localhost:6003frontend/next.config.tsbuildsconnect-srcat build time from the origins ofNEXT_PUBLIC_API_URLandNEXT_PUBLIC_WS_URL, keeping'self'and the Stellar/Soroban testnet endpoints. Localhost origins are only emitted in development and are stripped from production builds.'unsafe-eval'is development-only. All other headers are unchanged.frontend/__tests__/next-config-headers.test.tscovering configured origins, localhost removal in production, dev-only allowances, and header stability.#1776 — Permissions-Policy disabled the camera
camera=(self), microphone=(), geolocation=()so the QR scanner'sgetUserMediaworks from the same origin, while microphone and geolocation remain denied. Extended the config test to assert this.Testing
Tests were not run locally per the task instructions.
Closes #1781
Closes #1780
Closes #1778
Closes #1776