-
-
Notifications
You must be signed in to change notification settings - Fork 19
fix: external api calls using fetch() lack integrity... in files.js #722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
anupamme
wants to merge
1
commit into
flipcomputing:main
Choose a base branch
from
anupamme:fix-repo-flock-fix-fetch-integrity-verification-v001
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Apply this validation to every project fetch.
loadWorkspacestill callsfetch(validatedUrl.href)at Lines 511-512 after allowing bothhttp:andhttps:. That bypasses this HTTPS-only guard for?project=URLs. Route that branch throughfetchProjectJson(validatedUrl.href)or centralize the validator.Suggested fix
🤖 Prompt for AI Agents
🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
Repository: flipcomputing/flock
Length of output: 9065
🏁 Script executed:
Repository: flipcomputing/flock
Length of output: 214
🌐 Web query:
MDN IntegrityAttribute crossorigin HTTPS secure transport integrity not provided subresource integrity💡 Result:
Subresource Integrity (SRI) is a security feature that allows browsers to verify that fetched resources (such as scripts or stylesheets) are delivered without unexpected manipulation by comparing a provided cryptographic hash against the resource's actual content [1][2]. When using the integrity attribute for cross-origin resources, the crossorigin attribute must also be included [1][2]. This is a mandatory requirement for several key reasons: 1. CORS Enforcement: SRI requires the Cross-Origin Resource Sharing (CORS) protocol to ensure the resource owner explicitly permits the requesting origin to access the content [1][3]. If crossorigin is not provided, the browser defaults to no-cors mode, which restricts the requester's ability to read the response content [1]. Browsers will refuse to perform SRI validation on no-cors requests to prevent potential security vulnerabilities where an attacker could use integrity checks to infer information about cross-origin resources [1][3][4]. 2. Security Guarantee: The requirement to use CORS ensures that the resource is intentionally shared [4]. Without this explicit permission, allowing SRI validation on arbitrary cross-origin resources could allow attackers to bypass standard same-origin policy restrictions [3][4]. Regarding secure transport and HTTPS: While SRI is an application-level security tool and can technically be defined in a non-secure context (HTTP), it is strongly recommended that authors deliver integrity metadata only within a Secure Context (HTTPS) [3]. If a page is delivered over HTTP, an attacker can modify the document in-flight, including the integrity hash itself, rendering the SRI protection useless [3]. Therefore, using HTTPS is essential for ensuring that the integrity metadata remains trustworthy and that the subresource request itself is protected from man-in-the-middle attacks [2][3]. In summary, for cross-origin resources, you must provide both the integrity attribute (containing the hash) and the crossorigin attribute (to enable CORS), and you should always serve the content over HTTPS to ensure the integrity metadata is not tampered with [1][2][3].
Citations:
HTTPS alone does not provide content integrity.
This only enforces HTTPS transport for non-same-origin URLs. A compromised HTTPS endpoint can still return malicious project JSON that gets parsed and executed, so add a trusted-origin policy, pinned digest, or cryptographic signature verification before executing external project content.
🤖 Prompt for AI Agents