A method and system for detecting and self-healing site login code invalidation
Patent Information
- Application Number
- CN202611360247.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-03
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2046-09-03
AI Technical Summary
In existing technologies, the login adaptation module of third-party sites frequently fails, which affects the continuity of data collection services. Furthermore, the existing alarm mechanism has a high false alarm rate, low efficiency of manual diagnosis, and cannot accurately distinguish between account anomalies and algorithm failures.
The system uses a full-round account operation failure to determine suspected login code invalidity. Through multi-source evidence collection and automated root cause classification, it distinguishes between categories such as site unavailability, credential invalidity, encryption algorithm changes, and response format changes. Code reconstruction is triggered only when it is confirmed that code modification is required. Security is ensured by boundary checks and static checks of interface contracts.
It reduces false alarm rates, minimizes wasted effort, saves maintenance costs, enables accurate detection and self-healing of login code failures, and ensures the safety and controllability of the automated reconstruction process.
Smart Images

Figure CN122845313B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer code failure detection technology, and in particular to a method and system for detecting and self-healing website login code failure. Background Technology
[0002] In network data acquisition systems, logging into third-party websites and maintaining a logged-in state is a core function, and the system typically relies on a dedicated login adaptation module to achieve automatic login. However, to prevent automated crawling, third-party websites generally adopt protection mechanisms such as dynamic encryption, parameter signatures, and CAPTCHAs, and they also change the encryption algorithm or parameter structure of their login interfaces from time to time. This causes the deployed login adaptation module to frequently fail, directly affecting the continuity of data acquisition services.
[0003] In existing technologies, systems generally employ an account pool architecture to maintain an available login state. The pool maintains multiple accounts for the same site, and a polling module periodically performs login or refresh operations. For detecting login adaptation module failures, existing solutions mostly rely on monitoring thresholds for the number of failures or failure rates. That is, they count the number of failed account logins, and when the number exceeds a preset threshold, they send an alarm to the operations and maintenance personnel. After receiving the alarm, operations and maintenance personnel or developers manually capture and analyze the site's login interface, reverse engineer the encryption algorithm, and rewrite the login adaptation code before releasing the new code online.
[0004] The existing technologies described above have the following two drawbacks: First, the threshold-based alarm mechanism has an extremely high false alarm rate. Since it is common for individual accounts in the account pool to fail to log in due to password changes or account bans, threshold monitoring cannot distinguish between these occasional individual account failures and the overall failure of the login algorithm, resulting in a large number of invalid alarms. Operation and maintenance personnel are overwhelmed with identifying these issues but find it difficult to pinpoint the real problem. Second, the diagnosis and reconstruction decisions regarding the root cause of the failure rely entirely on manual intervention and are prone to misjudgment. The root cause of login failure may include various situations such as temporary site downtime, test account bans, changes in encryption algorithms, and minor adjustments to the response format. A significant portion of these causes do not require any code modification, but the existing process requires manual packet capture and reconstruction once an alarm is received. This results in a large amount of wasted work, and in scenarios where code modification is indeed necessary, manual determination of the root cause is time-consuming and highly dependent on personal experience, lacking automated auxiliary diagnostic methods. Summary of the Invention
[0005] In order to overcome the shortcomings and deficiencies of the existing technology, the present invention provides a method and system for detecting and self-healing website login code failure.
[0006] The technical solution adopted in this invention is a method and system for detecting and self-healing website login code failure, comprising: Step S1, performing a round of batch account operations on the target website and counting the total number of operations and the number of successes; determining a suspected login code failure only when all account operations in this round fail; generating a failure event after deduplication filtering by a site-level monitoring switch and time window; Step S2, in response to the failure event, verifying whether the login code package it points to belongs to a preset manageable code repository; terminating the process if it does not belong; Step S3, performing a login reproduction operation on the failed website in an isolated operating environment using pre-stored test credentials, collecting the call stack information of the failed reproduction, the timestamp of the most recent successful operation, and the reachability probe of the entry address. The test results serve as multi-source evidence; Step S4: Based on the multi-source evidence, the root causes of failure are classified into five categories according to the preset deterministic judgment rules: site unavailability, credential invalidation, encryption algorithm change, response format change, or uncertainty; Step S5: Based on the classification results, a structured diagnostic report is generated and pushed to the pre-mapped responsible person in a point-to-point private push manner. Before receiving a clear disposal instruction, the code reconstruction process is blocked, and the instructions are executed according to the branches: continue reconstruction, replace credential, or terminate the process; Step S6: After receiving the continue reconstruction instruction, the login request of the failed site is recaptured and the encryption entry is located to reconstruct the login adaptation code. After passing the static verification of the interface contract and the self-test of the isolated running environment, a new version of the login code package is released and the configuration pointer is updated.
[0007] Furthermore, step S1 employs a weighted whole-round failure criterion, assigning a historical credibility weight to each participating account. Define weighted failure score ,in This indicates that account i failed in this round. Indicates success, weight , These represent the historical number of successful attempts and the total historical number of attempts for account i, respectively. The smoothing coefficient is used; and significance is confirmed through consecutive rounds. The upper bound of the probability of occasional failure for a single account is set as follows: The probability that N accounts all fail in m consecutive rounds is... Only when When it is upgraded to a failure event, among which To preset the significance level, the minimum number of consecutive confirmation rounds required is determined. .
[0008] Furthermore, step S4 uses a weighted Jaccard difference of the encrypted payload fields to determine the encryption algorithm change category. Let the set of encrypted payload fields captured in this reproduction be... The historical baseline field set is Assign weights to each field Define the weighted Jaccard variance ,when Significant differences in the encrypted payload are determined at specific times; and a majority vote based on site reachability is used to determine the site's unavailability category. The site's entry address is probed n times independently, and a success rate is defined. Detection return ,when When a site is deemed unavailable, This is a preset threshold.
[0009] Furthermore, step S4 normalizes the multi-source evidence into feature vectors. For each defined category Calculate the discrimination score The classification result is: when hour, ;when hour, That is, an uncertain category, where These are preset parameters; in step S5, the responsible person push priority is adopted, and the set of responsible persons mapped to the site is determined based on the historical average confirmation delay of each responsible person. Calculate push priority To prevent the zero term constant, according to Parallel private push in descending order.
[0010] Furthermore, the preset time window for deduplication filtering in step S1 ranges from five to thirty minutes. This time window is adaptively adjusted based on the recent failure frequency of the site, forming an adaptive deduplication time window. ,in The baseline window is set at 10 minutes, and α ≥ 0. This represents the number of failure events per unit time at this site within the sliding statistical window; step S3 employs a minimum time interval constraint based on the same voucher, which is the minimum time interval between two reproduction operations. The value ranges from 60 seconds to 300 seconds, and the next allowed repetition time is... Only if at the current moment The reproduction is performed only when the time is right; the static verification of the interface contract in step S6 is passed if the entry signature matches, the return structure matches, and there is no call in the preset disabled call set.
[0011] Further, step S2 includes the following sub-steps: S21, in response to the failure event, the boundary verification module extracts the code package identifier and repository namespace information carried in the failure event; S22, the code package identifier is matched and verified against a preset whitelist of manageable code repositories, the whitelist recording all code repository namespaces that the system has the right to modify; S23, if the match fails, it is determined that the package does not belong to the preset manageable code repository scope, the self-healing process is immediately terminated and a termination notification is output, and no subsequent operations are performed on the code package; S24, if the match succeeds, the package is determined to belong to the repository, and the process continues in step S3.
[0012] Further, step S3 includes the following sub-steps: S31, the evidence collection module reads the pre-stored test credentials corresponding to the failed site and the timestamp of the most recent successful operation from the account pool storage; S32, the evidence collection module calls the isolated operating environment, uses the test credentials in the isolated operating environment to initiate a login reproduction request to the failed site, and controls the reproduction frequency under the minimum time interval constraint of the same credentials; S33, captures the exception type, response status code and response body feature fragment thrown during the execution of the login reproduction request as call stack information; S34, performs independent reachability detection on the entry address of the failed site, records the status code returned by the detection, and aggregates the call stack information, the timestamp of the most recent successful operation and the reachability detection results into multi-source evidence.
[0013] Further, step S4 includes the following sub-steps: S41, the root cause classification module receives the multi-source evidence and checks in sequence according to preset rules whether the site reachability detection result returns a server error or connection failure. If so, it outputs the site unavailable category; S42, if not, it checks whether the reproduction operation returns authentication failure and uses a valid format certificate. If so, it outputs the certificate invalid category; S43, if not, it checks whether the encrypted payload field has a significant difference compared to the historical baseline or whether the reproduction request is accepted but returns a business failure code. If so, it outputs the encryption algorithm change category; S44, if not, it checks whether the reproduction request is successful but the response parsing fails. If so, it outputs the response format change category. If none of these conditions are met, it outputs the uncertain category.
[0014] Further, step S5 includes the following sub-steps: S51, the manual confirmation interaction module generates a structured diagnostic report based on the root cause classification results. The diagnostic report includes the reproduction results, multi-source evidence, classification conclusions, and corresponding suggested actions; S52, the message push module pushes the diagnostic report to one or more pre-mapped responsible persons on the site via point-to-point private push. The push message embeds a reproducible structured instruction carrying the failure event identifier and handling parameters; S53, the code reconstruction process is blocked until a clear handling instruction is received from the responsible person. The blocking continues for the maximum waiting time from the time of push; S54, the handling instruction is received and parsed. If the instruction is to continue reconstruction and the root cause belongs to the category of encryption algorithm change or response format change, then proceed to step S6. If the instruction is to change the credential, then write the new credential into the test credential storage and return to step S3 to re-execute the diagnosis. If the instruction is to terminate, then the process ends.
[0015] A system for detecting and self-healing invalid website login codes is provided. This system is applied to a method for detecting and self-healing invalid website login codes, comprising: an account pool round-robin module, used to perform a round of batch account operations on the target site and count the total number of operations and the number of successes to determine the overall failure; a failure detection module, connected to the account pool round-robin module, used to receive the overall statistical results and determine suspected failures when all account operations fail, generating failure events after site-level monitoring switches and time window deduplication filtering; a boundary verification module, connected to the failure detection module, used to receive the failure events and verify whether the login code package they point to belongs to a preset manageable code repository; if not, the process terminates; and an evidence collection module, connected to the boundary verification module, used to collect evidence in an isolated operating environment. The system uses pre-stored test credentials to perform a login reproduction operation and collects call stack information, timestamps, and reachability detection results as multi-source evidence. A root cause classification module, connected to the evidence collection module, is used to classify the root cause of failure into one of five categories according to preset deterministic judgment rules based on the multi-source evidence. A manual confirmation interaction module, connected to the root cause classification module, is used to generate a structured diagnostic report and push it to the responsible person via a point-to-point private push through a message push module, receive handling instructions, and block or trigger subsequent processes. A code reconstruction module, connected to the manual confirmation interaction module, is used to recapture the login request and locate the encrypted entry point to reconstruct the login adaptation code after receiving a continue reconstruction instruction. After passing the interface contract static verification and isolated runtime environment self-check, a new version of the login code package is released and the configuration pointer is updated.
[0016] Beneficial Effects: This invention proposes a method and system for detecting and self-healing website login code failures. By using the failure of all account operations in a single round as a specific signal for login algorithm failure, it fundamentally eliminates false alarms caused by occasional failures of individual accounts. This allows the system to accurately distinguish between individual account anomalies and overall algorithm failure, reducing the false alarm rate and solving the problems of excessive alarms from existing threshold monitoring systems and the burden on maintenance personnel for verification. This invention connects boundary verification, multi-source evidence collection, five-category root cause classification, and manual confirmation in a sequential gate between failure detection and code reconstruction. It automatically collects multi-source evidence and classifies failure root causes into five categories according to preset rules: website unavailability, credential expiration, encryption algorithm change, response format change, and uncertainty. Only when the failure is confirmed as an encryption algorithm change or response format change will the system attempt to resolve the issue. This invention triggers code rebuilding only in scenarios where code modification is truly necessary, such as changes in code structure. It avoids rebuilding in situations where code modification is unnecessary, such as temporary site unavailability or expired account credentials. This avoids a large amount of unnecessary packet capture and rebuilding work, saving maintenance costs and solving the problem of existing technologies that require manual packet capture and rebuilding regardless of the root cause, resulting in a large amount of wasted work. Furthermore, this invention ensures that operations are only performed on code packages within the system's jurisdiction through boundary checks, supplemented by static interface contract checks and a self-checking mechanism for isolated runtime environments to prevent the release of defective code. The final rebuilding decision is handed over to the responsible party through point-to-point private push of structured instructions, making the automated rebuilding process safe and controllable. This solves the risks of existing technologies where automated rebuilding lacks security boundaries and manual oversight, potentially leading to unauthorized modifications or the introduction of new defects. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating the overall process of the method of the present invention.
[0018] Figure 2 This is a flowchart of method step S2 of the present invention;
[0019] Figure 3 This is a flowchart of method step S3 of the present invention;
[0020] Figure 4 This is a flowchart of method step S4 of the present invention;
[0021] Figure 5 This is a flowchart of step S5 of the method of the present invention;
[0022] Figure 6 This is a diagram showing the system unit composition of the present invention. Detailed Implementation
[0023] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. The application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0024] like Figure 1 As shown, a method and system for detecting and self-healing website login code failure includes: Step S1, performing a round of batch account operations on the target website and counting the total number of operations and the number of successes. If all account operations in this round fail, it is determined to be a suspected login code failure. After deduplication filtering by a site-level monitoring switch and time window, a failure event is generated; Step S2, in response to the failure event, verifying whether the login code package it points to belongs to a preset manageable code repository. If it does not belong, the process is terminated; Step S3, performing a login reproduction operation on the failed website in an isolated operating environment using pre-stored test credentials, collecting the call stack information of the failed reproduction, the timestamp of the most recent successful operation, and the reachability detection results of the entry address as... Multi-source evidence; Step S4: Based on the multi-source evidence, classify the root causes of failure into five categories according to the preset deterministic judgment rules: site unavailability, credential invalidation, encryption algorithm change, response format change, or uncertainty; Step S5: Generate a structured diagnostic report based on the classification results and push it to the pre-mapped responsible person in a point-to-point private push manner. Block the code reconstruction process before receiving a clear disposal instruction, and execute the following according to the instruction branches: continue reconstruction, replace credential, or terminate the process; Step S6: After receiving the continue reconstruction instruction, recapture the login request of the failed site and locate the encryption entry point to reconstruct the login adaptation code. After passing the interface contract static verification and isolation runtime environment self-check, release the new version login code package and update the configuration pointer.
[0025] When step S1 is implemented, the account pool polling module initiates a batch account operation on the target site according to a preset polling cycle. This batch operation is divided into two types: login round and refresh round, and each is counted independently. After receiving the results of this round of operations, the failure detection module counts the total number of accounts participating in the operation N and the number of successful operations S. When N is greater than 0 and S equals 0, it is determined to be a suspected login code failure. Before generating a failure event, the site-level monitoring switch of the target site is queried. Subsequent processing continues only if the monitoring switch is in the on state. Then, the time window deduplication mark is queried. If a failure event of the same operation type on the same site already exists within the preset time window, the generation of this event is suppressed. The value of the preset time window ranges from 5 minutes to 30 minutes, and the window length is adaptively extended according to the recent failure frequency of the site. After the above two-level filtering, the deduplication mark is applied and a failure event is generated. The failure event carries the site identifier, operation type, and failure package identifier. The generation and push of failure events are executed in an asynchronous and non-blocking manner, without blocking the concurrent polling processing of other sites by the account pool polling module.
[0026] During step S2, the boundary verification module responds to the failure event generated by the failure detection module and extracts the package identifier and repository namespace information of the login code package it points to from the failure event. The boundary verification module internally stores a whitelist of code repositories that the system can manage. This whitelist records all code repository namespaces that the system has the right to modify and their corresponding access permission configurations. The boundary verification module matches the extracted code package repository namespace with each entry in the whitelist. If a match fails, the login code package is determined not to belong to the preset manageable code repository range. The self-healing process is immediately terminated, and a termination notification is output via the message push module. The self-healing process ends here, and no further reproduction, diagnosis, or reconstruction operations are performed on the code package. If a match is successful, the login code package is determined to be within the manageable range. The boundary verification module allows the failure event and transmits it to the evidence collection module, proceeding to the next step S3 to continue the processing flow.
[0027] When implementing step S3, after receiving the failure event allowed by the boundary verification module, the evidence collection module first reads the pre-stored test credentials corresponding to the failed site and the timestamp of the site's most recent successful operation from the account pool storage. Then, the evidence collection module calls the isolated runtime environment, which is an independently deployed containerized sandbox execution environment physically isolated from the main business runtime environment. In the isolated runtime environment, the evidence collection module uses the pre-stored test credentials to initiate a login reproduction operation on the failed site. This reproduction operation is controlled by a minimum time interval constraint for the same credentials, which is between 60 and 300 seconds. If the current time is less than this minimum interval from the last reproduction time, the current reproduction is postponed to avoid triggering site risk control due to high-frequency reproduction. During the login reproduction execution, the failed call stack information is captured, including the thrown exception type, the HTTP response status code returned by the server, and the characteristic fragments included in the response body. Simultaneously, an independent reachability probe is performed on the site's entry address, recording the probe's returned status code. The call stack information, the most recent successful timestamp, and the reachability probe results are aggregated into multi-source evidence.
[0028] In step S4, after receiving all multi-source evidence collected by the evidence collection module, the root cause classification module classifies the failure root causes according to preset deterministic judgment rules. First, it checks the reachability detection results. If the proportion of successful 2xx status codes returned in multiple independent probes performed on the site entry address is lower than a preset threshold, the site is output as unavailable. Second, it checks the reproduction return results. If the reproduction operation returns authentication failure but the credential format used is valid, the credential invalidation category is output. Third, it checks the encrypted payload fields, comparing the encrypted payload field set captured in this reproduction with the encrypted payload field set of the historical baseline. If the difference exceeds a preset threshold, the encryption algorithm change category is output. Fourth, it checks the response parsing process. If the reproduction request itself is accepted but the response body cannot be parsed normally by the existing parser, the response format change category is output. If all the above judgment conditions are not met or the evidence contradicts each other and a clear conclusion cannot be reached, an uncertain category is output. This uncertain category is used for further manual review.
[0029] When step S5 is implemented, after receiving the classification results output by the root cause classification module, the manual confirmation interaction module generates a structured diagnostic report based on the classification results. This report includes all result information returned by the reproduction operation, the aforementioned multi-source evidence, the root cause classification conclusion, and the corresponding recommended actions. The message push module pushes this structured diagnostic report to one or more pre-mapped responsible persons on the site via a point-to-point private push method. The push message embeds a reproducible structured instruction, which carries a unique identifier for the failure event and handling parameters. From the moment of push, the manual confirmation interaction module enters a waiting state, blocking subsequent code reconstruction processes within a maximum waiting time limit, configurable from 30 to 120 minutes. Upon receiving the handling instruction returned by the responsible person, it is processed according to the following branches: if the instruction is to continue reconstruction and the root cause is a change in encryption algorithm or response format, proceed to step S6; if the instruction is to change the credentials, write the new credentials to the test credentials storage and return to step S3 for re-diagnosis; if the instruction is to terminate, end the process; if the instruction is missing or ambiguous, remain blocked and return a clarification request.
[0030] When step S6 is implemented, the code reconstruction module starts the reconstruction process after receiving the continuation reconstruction instruction. First, it recaptures the login requests of the failed site, locates the entry point of the encrypted function from the captured request data, and reconstructs the login adaptation code that matches the current login interface of the site. After the code reconstruction is completed, a static verification of the interface contract is performed on the reconstructed code. This verification requires that three conditions be met simultaneously: entry signature matching, return structure matching, and no call from any of the preset disabled call sets. After all three conditions are met, the reconstructed code is deployed to an isolated runtime environment to perform self-checks. During the self-check, test credentials are used to simulate the complete login process to verify the functional correctness of the new code. After the self-check passes, the new version of the login code package is published to the code repository and the package repository respectively, and the system configuration pointer is updated so that the account pool loads the new version of the login code in subsequent rounds. This completes the complete closed-loop process from failure detection to code self-healing.
[0031] Preferably, step S1 employs a weighted whole-round failure criterion, assigning a historical credibility weight to each participating account. Define weighted failure score ,in This indicates that account i failed in this round. Indicates success, weight , These represent the historical number of successful attempts and the total historical number of attempts for account i, respectively. The smoothing coefficient is used; and significance is confirmed through consecutive rounds. The upper bound of the probability of occasional failure for a single account is set as follows: The probability that N accounts all fail in m consecutive rounds is... Only when When it is upgraded to a failure event, among which To preset the significance level, the minimum number of consecutive confirmation rounds required is determined. .
[0032] Specifically, the weighted round failure criterion is established based on the objective fact that different accounts in the account pool have different historical stability. Accounts with high historical success rates should have a higher indicator weight when they fail. Therefore, a historical credibility weight is set for each participating account. This weight is calculated by smoothing the account's historical success count and total historical count using Laplace smoothing. The smoothing coefficient in Laplace smoothing is set to 1.0, which helps avoid extreme values in the weight when the account's historical operation count is low. The weighted failure score is defined as the sum of the products of each account's failure indicator value and weight, divided by the sum of the weights. A suspected failure is only determined when this score equals 1, meaning all weighted accounts have failed. Compared to the unweighted criterion, this further suppresses misjudgments caused by the failure of individual low-quality accounts. The establishment of continuous round significance confirmation is based on probability statistics. Assuming the upper bound of the probability of a single account occasionally failing when the login algorithm is normal is 0.01, then the failure of all N accounts within m consecutive rounds is a low-probability coincidence event. Its coincidence probability is N times the power of m of the single account failure probability. Only when this coincidence probability is less than or equal to the preset significance level 1e... -6 The minimum number of consecutive confirmation rounds required to upgrade to a failure event is calculated by taking the logarithm of the above inequality and rounding up. The larger the number of accounts in the account pool, the fewer consecutive rounds are required, and the smaller the number of accounts, the more rounds of confirmation are required. This adaptively balances detection sensitivity and false alarm rate under different account pool sizes.
[0033] Preferably, step S4 uses a weighted Jaccard difference of the encrypted payload fields to determine the encryption algorithm change category. Let the set of encrypted payload fields captured in this reproduction be... The historical baseline field set is Assign weights to each field Define the weighted Jaccard variance ,when Significant differences in the encrypted payload are determined at specific times; and a majority vote based on site reachability is used to determine the site's unavailability category. The site's entry address is probed n times independently, and a success rate is defined. Detection return ,when When a site is deemed unavailable, This is a preset threshold.
[0034] Specifically, the weighted Jaccard difference score for the encrypted payload fields is established based on the principle that changes in the encryption algorithm of the site login interface inevitably lead to structural changes in the set of encryption-related fields in the request. Different weights are assigned to each encrypted payload field. Signature, encryption, and timestamp fields, being most sensitive to algorithm changes, are assigned higher weights (e.g., 2.0), while ordinary identifier fields, less affected by algorithm changes, are assigned lower weights (e.g., 0.5). The weighted Jaccard difference score is defined as 1 minus the sum of weights on the intersection of the new field set and the baseline field set, divided by the sum of weights on the union. The mathematical properties of this metric determine that its value range is between 0 and 1. The closer the sum of the intersection weights is to the sum of the union weights, the closer the difference score is to 0, indicating no change; conversely, the smaller the sum of the intersection weights, the closer the difference score is to 1, indicating a significant change. When the difference score is greater than or equal to a preset threshold of 0.6, the encrypted payload is considered to have a significant difference. The establishment of the majority vote for site reachability is based on the fact that a single network probe is easily affected by instantaneous jitter and may lead to misjudgment. Reachability is evaluated by performing multiple independent probes on the site entry address and counting the proportion of successful 2xx status codes. The number of probes n is 5. When the success rate is lower than the preset threshold of 0.4, the site is determined to be unavailable. The majority vote mechanism of multiple probes can effectively filter out noise signals introduced by single network fluctuations.
[0035] Preferably, step S4 normalizes the multi-source evidence into feature vectors. For each defined category Calculate the discrimination score The classification result is: when hour, ;when hour, That is, an uncertain category, where These are preset parameters; in step S5, the responsible person push priority is adopted, and the set of responsible persons mapped to the site is determined based on the historical average confirmation delay of each responsible person. Calculate push priority To prevent the zero term constant, according to Parallel private push in descending order.
[0036] Specifically, the root cause discrimination score is established based on the possibility of contradictions or insufficient evidence among multiple sources. The five pieces of evidence—accessibility results, authentication results, business return codes, parsing results, and encryption payload differences—are normalized into components of a feature vector. Each component of the feature vector takes a value of 0 or 1, indicating whether the evidence of that type is abnormal. A set of preset linear discrimination parameters is configured for each of the four defined categories: site unavailability, credential expiration, encryption algorithm change, and response format change. The discrimination score for each category is defined as the sum of the products of the weight coefficients of each feature component and the corresponding feature vector component, minus the bias term for that category. The weight coefficients reflect the contribution of different evidence to the determination of different categories, and the bias term is used to adjust the classification threshold. The maximum discrimination score among the four categories is selected. If the maximum score is greater than or equal to the confidence threshold of 0.5, the root cause is assigned to the category corresponding to the maximum score. If the maximum score is less than 0.5, it is assigned to an uncertain category and submitted for manual review. This fallback mechanism balances the security of deterministic rules with conservative handling of insufficient evidence. The priority of push notifications to responsible persons is established based on the different response speeds of different responsible persons. Priority is calculated according to the historical confirmation delay of each responsible person. The shorter the historical confirmation delay, the higher the priority of the responsible person. The zero-term constant is set to 1 minute to avoid the priority being infinite when the delay is zero. The push notifications are sent in parallel in descending order of priority so that the responsible person with the fastest response is reached first, thus shortening the confirmation waiting time.
[0037] Preferably, the preset time window for deduplication filtering in step S1 ranges from five to thirty minutes. The time window is adaptively adjusted according to the recent failure frequency of the site, forming an adaptive deduplication time window. ,in The baseline window is set at 10 minutes, and α ≥ 0. This represents the number of failure events per unit time at this site within the sliding statistical window; step S3 employs a minimum time interval constraint based on the same voucher, which is the minimum time interval between two reproduction operations. The value ranges from 60 seconds to 300 seconds, and the next allowed repetition time is... Only if at the current moment The reproduction is performed only when the time is right; the static verification of the interface contract in step S6 is passed if the entry signature matches, the return structure matches, and there is no call in the preset disabled call set.
[0038] Specifically, the baseline window for the adaptive deduplication time window is 10 minutes, representing the default deduplication duration under normal circumstances. The adjustment coefficient is 0.5 to control the degree to which the failure frequency amplifies the window length. The number of failure events per unit time for the site within the sliding statistical window is calculated by dividing the number of failure events that occurred in the past hour by the statistical window duration. When the site experiences frequent failures, the adaptive deduplication window is automatically extended to suppress the repeated escalation and reporting of the same failure. In the minimum time interval constraint for the same credential, the minimum time interval between two reproduction operations is 120 seconds. This value references the statistical distribution of risk control thresholds for high-frequency login requests from the same account on mainstream third-party sites. The next allowed reproduction time is defined as the previous reproduction time plus this minimum interval. If the current time has not reached the allowed reproduction time, the reproduction operation is postponed to avoid triggering the site's risk control blocking policy for frequent login attempts. The static validation of the interface contract requires the reconstructed code to simultaneously meet the following requirements: the entry function name and parameter list must be consistent with the baseline; the return value data structure must match the baseline definition; and the code text must not contain any calls from the preset disabled call set, such as operating system calls and external network requests. Only when all three validations are true can the contract be considered passed and proceed to subsequent isolation self-checks and release.
[0039] Preferred, such as Figure 2 As shown, step S2 includes the following sub-steps: S21, in response to the failure event, the boundary verification module extracts the code package identifier and repository namespace information carried in the failure event; S22, the code package identifier is matched and verified against a preset whitelist of manageable code repositories, the whitelist recording all code repository namespaces that the system has the right to modify; S23, if the match fails, it is determined that the package does not belong to the preset manageable code repository scope, the self-healing process is immediately terminated and a termination notification is output, and no subsequent operations are performed on the code package; S24, if the match succeeds, the package is determined to belong to the repository, and the process continues in step S3.
[0040] Specifically, in step S21, the boundary verification module, in response to the failure event transmitted by the failure detection module, extracts the package identifier of the login code package to which the failure points and the namespace string of the repository to which the code package belongs from the structured data fields of the failure event. In step S22, the boundary verification module performs a precise string-by-string match between the extracted repository namespace and a preset whitelist of manageable code repositories loaded into memory during system startup. This whitelist is stored in the system's local storage medium as a configuration file, recording all code repository namespaces that the system has the right to modify. Each namespace is organized as a list of strings, and the number of entries in the whitelist dynamically expands according to the number of sites managed by the system. In step S23, if the repository namespace does not match any entries in the whitelist, it is determined that the code package to which the failure event points does not belong to the system's manageable scope. The boundary verification module immediately terminates all subsequent operations of this self-healing process and calls the message push module to output a termination notification to the system log. This termination notification includes the failure event identifier and the reason for non-attribution, and no subsequent reproduction, diagnosis, or reconstruction operations are performed on the code package. In step S24, if the repository namespace matches a certain entry in the whitelist, the code package is determined to be within the jurisdiction. The boundary verification module transmits the failure event and all the context data it carries to the evidence collection module, and the process proceeds to step S3 to continue execution. The timeout threshold for the entire matching process is set to 500 milliseconds to avoid the boundary verification blocking subsequent processes.
[0041] Preferred, such as Figure 3 As shown, step S3 includes the following sub-steps: S31, the evidence collection module reads the pre-stored test credentials corresponding to the failed site and the timestamp of the most recent successful operation from the account pool storage; S32, the evidence collection module calls the isolated running environment, uses the test credentials in the isolated running environment to initiate a login reproduction request to the failed site, and controls the reproduction frequency under the minimum time interval constraint of the same credentials; S33, captures the exception type, response status code and response body feature fragment thrown during the execution of the login reproduction request as call stack information; S34, performs independent reachability detection on the entry address of the failed site, records the status code returned by the detection, and gathers the call stack information, the timestamp of the most recent successful operation and the reachability detection results into multi-source evidence.
[0042] Specifically, in step S31, after receiving the failure event allowed by the boundary verification module, the evidence collection module initiates a read request to the account pool storage layer based on the site identifier carried in the failure event. It reads the pre-stored test credentials (username-password pair) corresponding to the site and the timestamp of the site's most recent successful operation from the account pool storage. This timestamp is accurate to the millisecond level. In step S32, the evidence collection module calls the API interface of the isolated operating environment and submits a login reproduction task to this isolated operating environment. This isolated operating environment is independent of the main business operating environment and uses an independent network egress IP address. In the isolated operating environment, it uses the test credentials obtained in step S31 to initiate a complete login reproduction request to the login interface of the target site. This reproduction operation is subject to a minimum time interval constraint for the same credentials, which is set to 180 seconds. If the difference between the current time and the last reproduction time for the same credentials is less than 180 seconds, the reproduction operation is delayed until the interval condition is met before execution. Step S33: After the login reproduction request is completed, capture the exception types thrown during the entire request execution process, the HTTP response status codes returned by the server (e.g., 200, 401, 500), and characteristic fragments included in the response body (e.g., the first 256 characters). Summarize this information into call stack information. Step S34: The evidence collection module performs an independent reachability probe on the site's entry address. The probe method involves sending an HTTP HEAD request to the entry address and recording the returned status code. The call stack information, the most recent successful timestamp, and the reachability probe results are then aggregated into multi-source evidence for use by subsequent modules.
[0043] Preferred, such as Figure 4 As shown, step S4 includes the following sub-steps: S41, the root cause classification module receives the multi-source evidence and checks in sequence according to preset rules whether the site reachability detection result returns a server error or connection failure. If so, it outputs the site unavailable category; S42, if not, it checks whether the reproduction operation returns authentication failure and uses a valid format certificate. If so, it outputs the certificate invalid category; S43, if not, it checks whether the encrypted payload field has a significant difference compared to the historical baseline or whether the reproduction request is accepted but returns a business failure code. If so, it outputs the encryption algorithm change category; S44, if not, it checks whether the reproduction request is successful but the response parsing fails. If so, it outputs the response format change category. If none of these conditions are met, it outputs the uncertain category.
[0044] Specifically, in step S41, after receiving the multi-source evidence from the evidence collection module, the root cause classification module first extracts the reachability detection result field from the multi-source evidence. It then checks whether the proportion of successful 2xx status codes returned in multiple independent probes performed on the site's entry address is less than a preset threshold of 0.5. If it is less, the site server is determined to be inaccessible, and the site is directly output as unavailable, ending the classification process. In step S42, if the reachability determination is not valid, the authentication result field is extracted from the multi-source evidence. It checks whether the response status code returned by the reproduction operation is 401 and whether the credential format used conforms to the basic username and password format requirements. If both are true, the account credential is determined to be invalid or revoked by the server, and the credential invalidation category is output, ending the classification process. Step S43: If the authentication determination fails, extract the difference feature of the encrypted payload field from the multi-source evidence. If the difference is greater than or equal to the preset threshold of 0.65, or if the reproduction request is accepted by the server but returns a business-level failure error code such as "user does not exist," then it is determined that the encryption algorithm of the site login interface has changed, the encryption algorithm change category is output, and the classification process ends. Step S44: If none of the above conditions are met, check if the reproduction request itself returned a success status code, but the system's existing response parser cannot properly parse the response body structure. If so, it is determined that the response format has changed, and the response format change category is output. If none of the above conditions are met, the final indeterminate category is output.
[0045] Preferred, such as Figure 5 As shown, step S5 includes the following sub-steps: S51, the manual confirmation interaction module generates a structured diagnostic report based on the root cause classification results. The diagnostic report includes the reproduction results, multi-source evidence, classification conclusions, and corresponding suggested actions; S52, the message push module pushes the diagnostic report to one or more pre-mapped responsible persons on the site via point-to-point private push. The push message embeds a reproducible structured instruction carrying the failure event identifier and handling parameters; S53, the code reconstruction process is blocked until a clear handling instruction is received from the responsible person. The blocking continues for the maximum waiting time from the time of push; S54, the handling instruction is received and parsed. If the instruction is to continue reconstruction and the root cause belongs to the category of encryption algorithm change or response format change, then proceed to step S6. If the instruction is to change the credential, then write the new credential into the test credential storage and return to step S3 to re-execute the diagnosis. If the instruction is to terminate, then the process ends.
[0046] Specifically, in step S51, after receiving the classification conclusion output by the root cause classification module, the manual confirmation interaction module generates a structured diagnostic report based on the conclusion. This report is organized according to a predefined JSON architecture, including the complete result field of the reproduction operation, the fields of each source of evidence, the root cause classification category field, and the corresponding category's preset suggested action field, such as the suggested code reconstruction for the encryption algorithm change category. In step S52, the message push module pushes the structured diagnostic report to all responsible persons in the pre-mapped responsible person list of the site via point-to-point private push. The communication protocol used for the push is an enterprise-level instant messaging protocol. A copyable structured instruction is embedded in the push message body. This instruction is a command string in a predefined format, carrying a unique identifier of the failure event and a key-value pair of the handling parameters. After the recipient copies the instruction, it can be sent through the same communication channel to drive subsequent handling. In step S53, from the time of push, the system enters a blocked waiting state with a maximum waiting time of 60 minutes. During this period, the code reconstruction process is blocked and suspended. If no valid handling instruction is received from the responsible person after 60 minutes, the blocked state continues, and the system does not perform any code modification operations. Step S54: After receiving the disposal instruction returned by the responsible person, parse the command type field of the instruction. If the command type is to continue rebuilding and the root cause category field is encryption algorithm change or response format change, proceed to step S6. If it is to replace the credential, write the new credential carried in the message body into the test credential storage and return to step S3. If it is to terminate, end the process.
[0047] like Figure 6As shown, a system for detecting and self-healing invalid website login codes is described. This system is applied to a method for detecting and self-healing invalid website login codes. It includes: an account pool round-robin module, used to perform a round of batch account operations on the target site and count the total number of operations and the number of successful operations for overall failure determination; a failure detection module, connected to the account pool round-robin module, used to receive the overall statistical results and determine suspected failure when all account operations fail, generating a failure event after deduplication filtering by a site-level monitoring switch and time window; a boundary verification module, connected to the failure detection module, used to receive the failure event and verify whether the login code package it points to belongs to a preset manageable code repository; if not, the process terminates; and an evidence collection module, connected to the boundary verification module, used to collect evidence in an isolated operating environment. The system uses pre-stored test credentials to perform login reproduction operations and collects call stack information, timestamps, and reachability detection results as multi-source evidence. A root cause classification module, connected to the evidence collection module, is used to classify the root cause of failure into one of five categories according to preset deterministic judgment rules based on the multi-source evidence. A manual confirmation interaction module, connected to the root cause classification module, is used to generate a structured diagnostic report and push it to the responsible person via a point-to-point private push through the message push module, receive handling instructions, and block or trigger subsequent processes. A code reconstruction module, connected to the manual confirmation interaction module, is used to recapture the login request and locate the encrypted entry point to reconstruct the login adaptation code after receiving a continue reconstruction instruction. After passing the interface contract static verification and isolated runtime environment self-check, a new version of the login code package is released and the configuration pointer is updated.
[0048] This invention discloses a method and system for detecting and self-healing website login code failures. It abandons traditional monitoring methods based on the number of failures or failure rate thresholds, instead using the failure of all account operations in a single round as the signal for login algorithm failure. This method aligns perfectly with the objective law that a change in the encryption algorithm of a third-party website will inevitably lead to all accounts being unable to log in simultaneously. This mechanism completely eliminates false alarms caused by common reasons such as password changes or account bans, reducing the number of invalid alarms and allowing maintenance personnel to focus their limited energy on truly necessary failure events. Upon detecting a failure, this invention does not directly initiate code reconstruction. Instead, it collects and reproduces call stacks, success timestamps, reachability probes, and other multi-source evidence, automatically categorizing the root cause into five types according to preset rules: site unavailability, credential expiration, encryption algorithm change, response format change, or uncertainty. The reconstruction process is only triggered when an encryption algorithm change or response format change is confirmed. Scenarios where code modification is unnecessary, such as site downtime or invalid account credentials, are not reconstructed, thus avoiding a large amount of invalid packet capture and reverse engineering.
[0049] This invention addresses the high false alarm rate of existing alarm mechanisms by combining whole-round failure assessment with site-level monitoring switches and time window deduplication. This ensures that the triggering of failure events accurately points to the overall algorithm failure, effectively solving the dilemma of maintenance personnel being overwhelmed by identifying false alarms. Regarding the issue that existing reconstruction decisions rely entirely on manual intervention and are prone to misjudgment, this invention automates the root cause diagnosis process. Using multi-source evidence as input and deterministic rules as the classification basis, it frees manual labor from time-consuming and laborious root cause investigation, only resorting to manual judgment in a very few uncertain scenarios where automated diagnosis cannot clearly categorize the problem. Simultaneously, this invention ensures that the system only operates on its own manageable code repositories through boundary checks, prevents defective code from going live through static contract checks and isolated environment self-checks, and delegates reconstruction decision-making power to the responsible party through point-to-point private push of structured instructions. This ensures that the introduction of automation capabilities does not come at the expense of security, thus achieving a controllable and secure closed-loop connection between failure detection, root cause diagnosis, manual decision-making, and automated reconstruction.
[0050] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "set," "install," "connect," "link," and "fix" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal communication between two components. Those skilled in the art will understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0051] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various equivalent changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A method for detecting and self-healing website login code failure, characterized in that, include: Step S1: Perform a batch account operation on the site and count the total number of operations and the number of successful operations. A login code is suspected to be invalid only if all account operations in this round fail. The account pool polling module initiates a batch account operation on the site according to a preset polling cycle. Batch operations are divided into login rounds and refresh rounds, and each is counted independently. After receiving the results of this round of operations, the failure detection module counts the total number of accounts participating in the operation N and the number of successful operations S. When N is greater than 0 and S equals 0, a login code is suspected to be invalid. Let the upper bound of the probability of occasional failure for a single account be... The probability that N accounts all fail in m consecutive rounds is... Only when When it is upgraded to a failure event, among which To preset the significance level, the minimum number of consecutive confirmation rounds required is determined. ; Step S2: In response to the failure event, verify whether the login code package it points to belongs to the scope of the preset manageable code repository. If it does not belong, terminate the process. Step S3: In the isolated operating environment, use the pre-stored test credentials to perform a login reproduction operation on the failed site, and collect the call stack information of the failed reproduction, the timestamp of the most recent successful operation, and the reachability detection results of the entry address as multi-source evidence; Step S4: Based on the multi-source evidence, classify the root causes of failure into five categories according to the preset deterministic judgment rules: site unavailable, credential invalid, encryption algorithm change, response format change or uncertainty. Step S5: Generate a structured diagnostic report based on the classification results and push it to the pre-mapped responsible person in a point-to-point private push manner. Block the code reconstruction process before receiving a clear disposal instruction, and execute the following according to the instruction branches: continue reconstruction, change voucher or terminate processing. Step S6: After receiving the instruction to continue rebuilding, the login request of the failed site is recaptured and the encrypted entry is located to rebuild the login adaptation code. After the interface contract static verification and the isolation runtime environment self-check are passed, a new version of the login code package is released and the configuration pointer is updated. Step S4 uses a weighted Jaccard difference of the encrypted payload fields to determine the encryption algorithm change category. Let the set of encrypted payload fields captured in this reproduction be... The historical baseline field set is Assign weights to each field Define the weighted Jaccard variance ,when Significant differences in the encrypted payload are determined at specific times; and a majority vote based on site reachability is used to determine the site's unavailability category. The site's entry address is probed n times independently, and a success rate is defined. Detection return ,when When a site is deemed unavailable, Preset threshold; Step S4 normalizes the multi-source evidence into feature vectors. For each defined category Calculate the discrimination score The classification result is: when hour, ;when hour, That is, an uncertain category, where These are preset parameters; in step S5, the responsible person push priority is adopted, and the responsible person set mapped to the site is determined based on the historical average confirmation delay of each responsible person. Calculate push priority To prevent the zero term constant, according to Parallel private push in descending order; The preset time window for deduplication filtering in step S1 ranges from five to thirty minutes. This time window is adaptively adjusted based on the recent failure frequency of the site, forming an adaptive deduplication time window. ,in The baseline window is set at 10 minutes, and α ≥ 0. The number of site failure events per unit time within the sliding statistical window; step S3 uses the minimum time interval constraint of the same voucher, which is the minimum time interval between two reproduction operations. The value ranges from 60 seconds to 300 seconds, and the next allowed repetition time is... Only if at the current moment The reproduction is performed only when the time is right; the static verification of the interface contract in step S6 is passed if the entry signature matches, the return structure matches, and there is no call in the preset disabled call set.
2. The method for detecting and self-healing website login code failure according to claim 1, characterized in that, Step S2 includes: In response to the failure event, the boundary verification module extracts the code package identifier and repository namespace information carried in the failure event; it performs a matching verification between the code package identifier and a preset whitelist of manageable code repositories, which records all code repository namespaces that the system has the right to modify; if the matching fails, it is determined that the code package does not belong to the preset manageable code repository scope, the self-healing process is immediately terminated and a termination notification is output, and no subsequent operations are performed on the code package; If a match is found, the ownership is determined, and the process continues to step S3.
3. The method for detecting and self-healing website login code failure according to claim 1, characterized in that, Step S3 includes: The evidence collection module reads the pre-stored test credentials corresponding to the failed site and the timestamp of the most recent successful operation from the account pool storage; The evidence collection module calls the isolated operating environment, and uses the test credentials in the isolated operating environment to initiate a login reproduction request to the failed site, and the reproduction frequency is controlled by the minimum time interval constraint of the same credentials. The exception type, response status code, and response body feature fragments thrown during the execution of the login reproduction request are captured as call stack information; Perform independent reachability detection on the entry address of the failed site, record the status code returned by the detection, and aggregate the call stack information, the timestamp of the most recent successful operation, and the reachability detection results into multi-source evidence.
4. The method for detecting and self-healing website login code failure according to claim 1, characterized in that, Step S4 includes: The root cause classification module receives the multi-source evidence and checks the site reachability detection results sequentially according to preset rules to see if they return a server error or connection failure. If so, it outputs the site unavailable category. If not, check if the reproduction operation returns authentication failure and uses a valid format certificate; if so, output the certificate invalidation category. If not, check whether the encrypted payload field has changed significantly compared to the historical baseline or whether the reproduction request was accepted but returned a business failure code. If so, output the encryption algorithm change category. If not, check if the request was successful but the response parsing failed. If so, output the response format change category; if none of these conditions are met, output the uncertain category.
5. The method for detecting and self-healing website login code failure according to claim 1, characterized in that, Step S5 includes: The manual confirmation interaction module generates a structured diagnostic report based on the root cause classification results. The diagnostic report includes the reproducibility results, multi-source evidence, classification conclusions, and corresponding recommended actions. The message push module pushes the diagnostic report to one or more responsible persons pre-mapped to the site in a point-to-point private push manner. The push message embeds a copyable structured instruction carrying the failure event identifier and handling parameters. The code rebuilding process will be blocked until a clear handling instruction is received from the responsible person, and will remain blocked for the maximum waiting time from the time of push. Receive and parse the processing instruction. If the instruction is to continue rebuilding and the root cause is a change in encryption algorithm or response format, proceed to step S6. If the instruction is to replace the credential, write the new credential into the test credential storage and return to step S3 to re-execute the diagnosis. If the instruction is to terminate, end the process.
6. A system for detecting and self-healing website login code failure, characterized in that, This system is applied to the site login code invalidation detection and self-healing method described in claim 1, comprising: The account pool rotation module is used to perform a round of batch account operations on the site and count the total number of operations and the number of successes to determine the failure of the entire round. The failure detection module is connected to the account pool round-robin module. It is used to receive the statistical results of the whole round and determine the suspected failure when all account operations fail. After deduplication filtering by the site-level monitoring switch and time window, a failure event is generated. The boundary verification module, connected to the failure detection module, is used to receive the failure event and verify whether the login code package it points to belongs to the preset manageable code repository range. If it does not belong, the process is terminated. The evidence collection module, connected to the boundary verification module, is used to perform a login reproduction operation using pre-stored test credentials in an isolated operating environment and collect call stack information, timestamps, and reachability detection results as multi-source evidence. The root cause classification module is connected to the evidence collection module and is used to classify the root cause of failure into one of five categories according to the multi-source evidence and a preset deterministic judgment rule. The manual confirmation interaction module is connected to the root cause classification module. It is used to generate a structured diagnostic report and push it to the responsible person in a point-to-point private push manner through the message push module. It receives disposal instructions and blocks or triggers subsequent processes. The code reconstruction module, connected to the manual confirmation interaction module, is used to recapture the login request and locate the encrypted entry point to reconstruct the login adaptation code after receiving the continue reconstruction instruction. After passing the static verification of the interface contract and the self-check of the isolated runtime environment, the new version of the login code package is released and the configuration pointer is updated.
Citation Information
Patent Citations
Model card example code-oriented automatic program repair method
CN121478270A
