-
Notifications
You must be signed in to change notification settings - Fork 3
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
Spicerack #1612
Open
jperezlatimes
wants to merge
20
commits into
main
Choose a base branch
from
spicerack
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
Spicerack #1612
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
097f7c3
Let baker generate src sets
jperezlatimes 4bb37df
fine
jperezlatimes 287ab4d
fix prettier
jperezlatimes 65adb57
fix prettier
jperezlatimes 5fc65e1
cleaning up baker.config handling
jperezlatimes 9109455
working on it
jperezlatimes 9123400
working on it
jperezlatimes 57819f0
Merge branch 'main' of github.com:datadesk/baker into spicerack
jperezlatimes e3d1638
Add logging
jperezlatimes a5001df
fix config merge
jperezlatimes 597383b
Merge branch 'main' of github.com:datadesk/baker into spicerack
jperezlatimes 9dacc41
refactoring screenshots
jperezlatimes fcbc3e5
refactoring screenshots
jperezlatimes 1da5c5f
refactoring screenshots
jperezlatimes ba6298d
refactoring screenshots
jperezlatimes 3c64c55
refactoring screenshots
jperezlatimes a19dbf1
refactoring screenshots
jperezlatimes c601b41
refactoring screenshots
jperezlatimes 678e814
refactoring screenshots
jperezlatimes 23d09b9
remove subManifests
jperezlatimes 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 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Baker } from '../index.js'; | ||
|
||
function maxstache(str, ctx) { | ||
return str | ||
.split(/\{|\}/) | ||
.map((t, i) => (!(i % 2) ? t : ctx[t])) | ||
.join(''); | ||
} | ||
|
||
/** | ||
* @param {number[]} sizes | ||
* @param {Baker} instance | ||
**/ | ||
export function createSrcSetFilter(sizes, instance) { | ||
return function createSrcSet(source) { | ||
return sizes | ||
.map((size) => { | ||
const url = instance.getStaticPath(`${maxstache(source, { size })}`); | ||
return `${url} ${size}w`; | ||
}) | ||
.join(', '); | ||
}; | ||
} |
This file contains 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
Oops, something went wrong.
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.
Check warning
Code scanning / CodeQL
Prototype-polluting assignment Medium
Copilot Autofix AI 9 days ago
To fix the problem, we need to ensure that the keys used in the
preppedData
object cannot lead to prototype pollution. This can be achieved by:assetName
andassetType
to ensure they do not contain dangerous values like__proto__
,constructor
, orprototype
.Map
object instead of a plain object forpreppedData.assets
to avoid prototype pollution.The best way to fix the problem without changing existing functionality is to implement both of these measures. We will validate the keys and use a
Map
forpreppedData.assets
.