JavaScript Bytecode Loading for Source Code Protection

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing methods for protecting JAVASCRIPT source code, such as obfuscation, encryption, and compilation, are inadequate in preventing reverse engineering and maintaining execution efficiency.

Innovation Solution

A method involving compiling JAVASCRIPT source code into bytecode using a bytecode compiler, generating a bytecode loader, and deploying it in a target runtime environment to convert the bytecode into executable form, thereby increasing the difficulty of reverse engineering.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Difficulty of detecting and measuring

If source code is compiled into bytecode using V8 compiler, then reverse engineering difficulty is improved, but execution efficiency deteriorates

Engineering Contradiction:
Improvereverse engineering difficultyVSAvoidexecution efficiency
Core Design Contradiction:
Difficulty of detecting and measuringVSProductivity

Solution Approach 1:

The patent segments the bytecode execution process into two distinct phases: a compilation phase where source code is compiled into bytecode with protection measures, and an execution phase where the bytecode is loaded and executed by the runtime environment. This segmentation allows the bytecode to serve dual purposes: protecting the source code while maintaining execution efficiency through optimized runtime execution.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces a bytecode loader as an intermediary component between the bytecode compiler and the runtime environment. The loader acts as a mediator that loads bytecode into memory and manages its execution, enabling the bytecode to function as both a protection mechanism and an efficient execution format. The loader ensures that bytecode is properly initialized and executed without compromising performance.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If source code is obfuscated to reduce readability, then protection effect is improved, but ease of code restoration deteriorates

Engineering Contradiction:
Improveprotection effectVSAvoidease of code restoration
Core Design Contradiction:
ReliabilityVSEase of operation

Solution Approach 1:

The patent changes the fundamental parameter of code representation by transforming source code into bytecode format. This parameter change fundamentally alters the structure and executability of the code, making it impossible to restore the original source code through simple formatting tools while maintaining full execution functionality. The bytecode representation is a complete transformation rather than a superficial modification.

Inventive Principle:
Principle #35Parameter changes

3Reliability

If encryption is applied to protect source code, then protection effect is improved, but execution efficiency deteriorates due to decryption requirements

Engineering Contradiction:
Improveprotection effectVSAvoidexecution efficiency
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent substitutes the encryption/decryption mechanism with a compilation/execution mechanism. Instead of encrypting source code and requiring decryption before execution, the source code is compiled into bytecode that can be directly executed by the runtime environment. This substitution eliminates the overhead of encryption and decryption operations while maintaining protection through the bytecode format itself.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Data Source

PatentUS20250348293A1Source Code Protection Method and Apparatus
Publication Date: 2025.11.13 HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
  • US20250348293A1 patent drawing
  • US20250348293A1 patent drawing
  • US20250348293A1 patent drawing

AI summary

A source code protection method includes loading a bytecode compiler; obtaining a source code file of a program that is to be run in a target runtime environment; analyzing the source code file of the program via the bytecode compiler, to obtain a syntax tree corresponding to the source code file of the program; converting, via the bytecode compiler, the syntax tree into a target bytecode file corresponding to the source code file of the program; generating, via the bytecode compiler, a target bytecode loader corresponding to the target bytecode file, where the target bytecode loader is configured to load the target bytecode file; and deploying the target bytecode file and the target bytecode loader into the target runtime environment.