Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
php-serialize
Advanced tools
It also supports Serializable
objects decode. Here's how you can use them.
$ npm install php-serialize # If you're using npm
$ yarn add php-serialize # If you're using Yarn
import {serialize, unserialize} from 'php-serialize'
class User {
constructor({ name, age }) {
this.name = name
this.age = age
}
serialize() {
return JSON.stringify({ name: this.name, age: this.age })
}
unserialize(rawData) {
const { name, age } = JSON.parse(rawData)
this.name = name
this.age = age
}
}
const steel = new User({ name: 'Steel Brain', age: 17 })
const serialized = serialize(steel)
const unserialized = unserialize(serialized, { User: User }) // Passing available classes
console.log(unserialized instanceof User) // true
const serializedForNamespace = serialize(steel, {
'MyApp\\User': User,
})
// ^ Above code will serialize User class to given name
export function serialize(
item: any,
phpToJsScope: Object = {},
options: { encoding: 'utf8' | 'binary' } = { encoding: 'utf8' }
): string
export function unserialize(
item: string,
scope: Object = {},
options: { strict: boolean, encoding: 'utf8' | 'binary' } = { strict: false, encoding: 'utf8' }
): any
export function isSerialized(
item: any,
strict: false
): boolean
This project is licensed under the terms of MIT License. See the License file for more info.
5.0.1
isSerialized
(Thanks @maxbronnikov10)FAQs
PHP serialize/unserialize in Javascript
The npm package php-serialize receives a total of 27,061 weekly downloads. As such, php-serialize popularity was classified as popular.
We found that php-serialize demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.