
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
@atjson/source-url
Advanced tools
This source transforms URLs into annotations. It allows Offset to auto-unfurl URLs into annotations, most commonly used for social media embeds and videos.
To give add this new capability to your text editor, first up, you'll need to install the source into your project:
npm install --save @atjson/source-url
After installing the source, next up is adding this source to the text editor's paste handler. Each text editor is different, so please look up the hooks that your editor uses to take advantage!
For this example, we'll show how to integrate this feature with CKEditor.
A rough outline of what would be necessary to turn a pasted URL into a rich embed requires the following bits:
import URLSource from "@atjson/source-url";
import Renderer from "@atjson/renderer-hir";
class CKEditorRenderer extends Renderer {
*"facebook-embed"(embed) {
return `<oembed>${embed.attributes.url}</oembed>`;
}
*"giphy-embed"(embed) {
return `<oembed>${embed.attributes.url}</oembed>`;
}
*"iframe-embed"(embed) {
return `<oembed>${embed.attributes.url}</oembed>`;
}
*"instagram-embed"(embed) {
return `<oembed>${embed.attributes.url}</oembed>`;
}
*"pinterest-embed"(embed) {
return `<oembed>${embed.attributes.url}</oembed>`;
}
*"twitter-embed"(embed) {
return `<oembed>${embed.attributes.url}</oembed>`;
}
*"youtube-embed"(embed) {
return `<oembed>${embed.attributes.url}</oembed>`;
}
*root() {
let chunks = yield;
return chunks.join("");
}
}
editor.on("paste", function (evt) {
let richPaste = new URLSource(evt.data.dataValue);
let renderer = new CKEditorRenderer();
evt.data.dataValue = renderer.render(richPaste.toCommonSchema());
});
FAQs
Expands URLs into annotations
The npm package @atjson/source-url receives a total of 15 weekly downloads. As such, @atjson/source-url popularity was classified as not popular.
We found that @atjson/source-url demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 10 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.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.