npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@xbibzlibrary/security

v1.0.0

Published

security

Downloads

4

Readme

🛡️ Xbibz Security Manager


📋 Table of Contents


✨ Features


🎯 What It Does

This security library provides a comprehensive front-end protection mechanism designed to prevent non-technical users from accessing sensitive areas of your web application. The library implements multiple layers of security measures that work together to create a robust defense system.

Key Protection Mechanisms:

The library monitors and intercepts various user actions in real-time, providing instant feedback when unauthorized activities are detected. It creates a secure environment by disabling common methods used to inspect, copy, or manipulate web content.


🔧 Installation

Method 1: Direct Include

<!DOCTYPE html>
<html>
<head>
    <title>Your Protected Page</title>
</head>
<body>
    <!-- Your content here -->
    
    <script src="https://cdn.jsdelivr.net/npm/@xbibzlibrary/[email protected]/private.js"></script>
</body>
</html>

Method 2: Module Import

import { EnterpriseSecurityManager } from './https://cdn.jsdelivr.net/npm/@xbibzlibrary/[email protected]/private.js';

// Initialize when DOM is ready
document.addEventListener('DOMContentLoaded', () => {
    new EnterpriseSecurityManager();
});

📖 Usage

Basic Implementation

The library automatically initializes when the DOM is fully loaded. Simply include the script in your HTML file, and all security features will be activated immediately.

💡 Pro Tip: Place the script tag at the end of your body section for optimal performance and to ensure all DOM elements are loaded before security measures are applied.

Advanced Implementation

For more control, you can manually instantiate the security manager:

// Wait for DOM to be ready
document.addEventListener('DOMContentLoaded', () => {
    // Initialize security manager
    const security = new EnterpriseSecurityManager();
    
    // Security is now active
    console.log('Security measures activated');
});

⚙️ How It Works

Architecture Overview

The Xbibz Security Manager employs a multi-layered defense strategy that operates simultaneously across different vectors of potential security breaches.

1️⃣ DevTools Detection & Prevention

The library intercepts keyboard events before they reach the browser, specifically targeting common DevTools shortcuts. When a user attempts to open developer tools using F12, Ctrl+Shift+I, Ctrl+Shift+C, or Ctrl+Shift+J, the event is immediately prevented and logged.

Technical Implementation: Event listeners capture keydown events and check for specific key combinations. Upon detection, the preventDefault() method stops the default browser action, effectively blocking access to developer tools through keyboard shortcuts.

2️⃣ Context Menu Blocking

Right-click functionality is completely disabled across the entire page. This prevents users from accessing the "Inspect Element" and "View Page Source" options through the context menu.

Technical Implementation: Both contextmenu and mousedown events are monitored. When a right-click is detected (mouse button 2), the event is prevented and the console is cleared to remove any debugging information.

3️⃣ Text Selection Prevention

CSS properties are dynamically injected into the page to prevent text selection at the browser rendering level. This is reinforced by JavaScript event interception.

Technical Implementation: The library creates a style element with user-select: none properties for all major browser engines (WebKit, Mozilla, MS). Additionally, the selectstart event is blocked to provide JavaScript-level protection.

4️⃣ Anti-Debugger Mechanism

The most sophisticated feature is the continuous debugger detection system. A setInterval loop runs every second, executing a debugger statement and measuring execution time.

Technical Implementation: When DevTools is closed, the debugger statement executes instantly. When DevTools is open, the debugger statement causes a pause, resulting in a measurable delay. If the execution time exceeds 100 milliseconds, the system detects an open DevTools instance and triggers protective measures.

5️⃣ Clipboard Operation Blocking

All clipboard operations including copy, cut, and paste are intercepted and prevented. This protects content from being extracted or modified through clipboard interactions.

Technical Implementation: Event listeners monitor copy, cut, and paste events, preventing their default behavior and logging each attempt for security monitoring.


🎨 Customization

Modifying Alert Messages

logAttempt(attemptType) {
    const msgElement = document.createElement('div');
    msgElement.innerHTML = `
        <div style="your-custom-styles">
            <strong>Custom Title:</strong> ${attemptType}
        </div>
    `;
    document.body.appendChild(msgElement);
    setTimeout(() => msgElement.remove(), 3000); // Custom duration
}

Adjusting Anti-Debugger Sensitivity

setupAntiDebugger() {
    setInterval(() => {
        const startTime = performance.now();
        debugger;
        const endTime = performance.now();
        
        // Adjust threshold (default: 100ms)
        if ((endTime - startTime) > 150) { // More lenient
            this.logAttempt('DevTools Detected');
        }
    }, 2000); // Check every 2 seconds instead of 1
}

⚠️ Important Notes

Security Considerations

Client-Side Limitations: This library provides protection against casual users and non-technical individuals. However, it is important to understand that determined users with technical expertise can bypass client-side security measures. This library should be used as part of a comprehensive security strategy, not as the sole protection mechanism.

Performance Impact

The anti-debugger mechanism runs continuously and may have minor performance implications on lower-end devices. Consider adjusting the interval timing based on your specific requirements and user base.

Browser Compatibility

This library is designed for modern browsers supporting ES6+ JavaScript. Testing has been conducted on Chrome, Firefox, Safari, and Edge. Internet Explorer is not supported.

Best Practices

Complement with Server-Side Security: Always implement robust server-side validation, authentication, and authorization mechanisms. Client-side security should enhance, not replace, server-side protection.

User Experience Balance: Consider the impact on legitimate users. Excessive security measures can frustrate genuine users and negatively affect usability.

Legal Compliance: Ensure your implementation complies with accessibility standards and legal requirements in your jurisdiction.


📜 License

This project is licensed under the MIT License - feel free to use, modify, and distribute as needed.


👨‍💻 Author