Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('Validator: PackageName', () => {

it('validator should fail if a resolved URL for a different package is found', () => {
const failedPackage = 'meow'
const maliciousPackage = 'malicious'
const maliciousPackage = 'meowlicious'
const mockedPackages = {
'@babel/code-frame@^0.16.0': {
resolved: 'https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
if (Object.hasOwn(packageNameAliasPairs, this._getPackageNameOnly(packageName))) {
debug(
`skipping package name validation for aliased package name: ${packageName} resolving to: ${
packageNameAliasPairs[packageName]

Check warning on line 31 in packages/lockfile-lint-api/src/validators/ValidatePackageNames.js

View workflow job for this annotation

GitHub Actions / Node v18.x ((ubuntu-latest))

Generic Object Injection Sink

Check warning on line 31 in packages/lockfile-lint-api/src/validators/ValidatePackageNames.js

View workflow job for this annotation

GitHub Actions / Node v16.x ((ubuntu-latest))

Generic Object Injection Sink
}}`
)
continue
Expand All @@ -53,7 +53,7 @@

const packageNameOnly = this._getPackageNameOnly(packageName)

const expectedURLBeginning = `${packageResolvedURL.origin}/${packageNameOnly}`
const expectedURLBeginning = `${packageResolvedURL.origin}/${packageNameOnly}/`

const isPassing = packageMetadata.resolved.startsWith(expectedURLBeginning)
if (!isPassing) {
Expand Down Expand Up @@ -92,7 +92,7 @@
const packageNameAliasPairs = {}
for (const packageNameAlias of packageNameAliases) {
const [packageName, aliasedPackageName] = packageNameAlias.split(':')
packageNameAliasPairs[packageName] = aliasedPackageName

Check warning on line 95 in packages/lockfile-lint-api/src/validators/ValidatePackageNames.js

View workflow job for this annotation

GitHub Actions / Node v18.x ((ubuntu-latest))

Generic Object Injection Sink

Check warning on line 95 in packages/lockfile-lint-api/src/validators/ValidatePackageNames.js

View workflow job for this annotation

GitHub Actions / Node v16.x ((ubuntu-latest))

Generic Object Injection Sink
}

return packageNameAliasPairs
Expand Down
Loading