
Product
Microsoft Teams Notifications Are Now Available in Socket
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.
@putervision/spc
Advanced tools
Space Proof Code - Tools to facilitate space-proofing code by identifying performance and security related issues in JavaScript/TypeScript (`.js`, `.ts`), Python (`.py`), C/C++ (`.c`, `.cpp`, `.h`), Go (`.go`), Rust (`.rs`), and Java (`.java`) files
@putervision/spc is a command-line tool that analyzes codebases for performance and security issues, enforcing space-proofing principles inspired by NASA's Power of Ten rules for safety-critical software. Supporting JavaScript/TypeScript (.js, .ts), Python (.py), C/C++ (.c, .cpp, .h), Go (.go), Rust (.rs), and Java (.java) files, it helps developers build robust, reliable code for high-stakes environments like space missions, identifying vulnerabilities and inefficiencies that could compromise mission-critical systems. Contact us via email: code@putervision.com
To install the tool globally via npm:
# install space proof code globally
npm install -g @putervision/spc
Example usage for scanning code:
# use within a dir or specify a code path
space-proof-code /path/to/code
Example output report of issues found:

space-proof-code|spc [/path/to/code][-cs]|[-v]|[-h]
| Argument | Description | Required? | Default |
|---|---|---|---|
/path/to/code | Path to the code you want to scan | No | ./ |
--help, -h | Displays the help menu | No | N/A |
--version, -v | Displays the version number | No | N/A |
--create-sums, -cs | Generates a checksum file in the scanned code path | No | N/A |
/code/path/checksums.sha256.txt) with argument -cs or --create-sums and then subsequent scans will check scanned files against hashes stored in the checksum.# this command will create the checksum file /code/path/checksums.sha256.txt
space-proof-code /code/path --create-sums
# future runs will reference the created checksum file and compare with hashes generated by the scanned files
space-proof-code /code/path
@putervision/spc enforces a set of code quality rules inspired by NASA's Power of Ten guidelines, tailored to ensure performance, reliability, and maintainability in space-ready software. These checks go beyond security to identify patterns that could degrade system efficiency or stability in high-stakes environments like space missions. Below are the key rules applied across JavaScript/TypeScript (.js, .ts), Python (.py), C/C++ (.c, .cpp, .h), Go (.go), Rust (.rs), and Java (.java) files:
Severity: 4/5
Description: Recursive calls can exhaust stack space, leading to crashes in memory-constrained systems like spacecraft. In real-time environments, this risks mission failure. Each recursive call adds a layer to the call stack, and if the recursion depth is too great, it can cause a stack overflow, potentially halting the program. In space missions, such failures could lead to loss of data or mission-critical operations. To mitigate this, prefer iteration, which uses a loop to achieve the same result without additional stack frames, or use tail-call optimization where supported, though this isn't always reliable. This rule is particularly critical in C/C++, where stack space is limited, and applies to Python and JavaScript, where deep recursion can still impact performance.
Examples:
int factorial(int n) { return factorial(n-1); }def factorial(n): return factorial(n-1)function factorial(n) { return factorial(n-1); }Remedy:
int factorial(int n) {
int result = 1;
for(int i = 1; i <= n; i++)
result *= i;
return result;
}
External References:
Severity: 4/5 (C), 3/5 (Python, JS)
Description: Dynamic memory allocation, such as using malloc in C, can fragment memory or fail silently, critical in resource-limited systems. Memory fragmentation occurs when allocated and deallocated memory blocks leave non-contiguous free spaces, potentially causing allocation failures even when total memory is sufficient. In spacecraft, where memory is scarce, this can lead to system crashes or unpredictable behavior. Pre-allocate fixed buffers or pools to ensure deterministic memory usage, avoiding runtime uncertainty. For Python and JavaScript, while memory management is handled by the language, large dynamic allocations (e.g., creating large lists) can still consume significant resources, though the severity is lower due to garbage collection. This rule is vital for C, where manual management increases risks, and applies to all languages to ensure resource predictability.
Examples:
int* ptr = malloc(10 * sizeof(int));data = [0] * 1000000let arr = new Array(1000000);Remedy:
int buffer[10]; for fixed size, or use memory pools.External References:
Severity: 2/5
Description: Complex control structures, such as breaks, continues, and early returns, make formal verification harder, a key step in safety-critical code. Formal verification involves mathematically proving that code meets specifications, and complex flows increase the number of paths to analyze, complicating this process. Simplifying to a single exit point enhances readability and verifiability, reducing the risk of overlooked errors. This is particularly important in space missions, where code must be thoroughly checked for correctness. The rule applies across all languages, encouraging structured control flow to support maintenance and verification efforts, though the impact is less severe compared to other rules.
Examples:
if (x) break; else return y;if x: break; else: return yif (x) return 1; else continue;Remedy:
int result;
if (x) result = 1;
else result = 0;
return result;
External Reference:
Severity: 5/5
Description: Loops without clear termination can run indefinitely, locking up real-time systems. In space missions, where timing is critical for operations like communication windows or maneuver sequences, an unbounded loop can cause the system to hang, missing deadlines and potentially leading to mission failure. Always enforce explicit bounds or timeouts, such as using a counter or condition that guarantees termination, to prevent such scenarios. This rule is universally applicable, with high severity due to its potential to disrupt real-time operations, ensuring system responsiveness and reliability.
Examples:
while (1) { do_work(); }while True: do_work()for(;;) { doWork(); }Remedy:
for(int i = 0; i < 10; i++) {
do_work();
}
External Reference:
Severity: 5/5
Description: Dynamic code execution, such as using eval in JavaScript or Python, or system() in C, introduces unpredictability, undermining deterministic behavior required in critical systems. In space-ready software, the code must be deterministic to ensure predictable outcomes under all conditions, and dynamic execution can lead to runtime errors or security vulnerabilities. Use static logic, where code is compiled and analyzed beforehand, to maintain control and predictability. This rule is critical across all languages, with high severity due to the potential for catastrophic failures in mission-critical operations.
Examples:
system("ls");exec("print(x)")eval("console.log(x)");Remedy:
print(x) directly.External Reference:
Severity: 3/5
Description: Global variables risk unintended side effects across modules, especially in concurrent systems, complicating debugging and maintenance. In space missions, where multiple processes or threads might run concurrently, global variables can introduce race conditions, leading to data corruption or system failures. Encapsulate state locally within functions or pass it explicitly as parameters to enhance reliability and reduce concurrency issues. This rule applies to all languages, with moderate severity due to its potential to affect system integrity over time, particularly in multi-threaded environments.
Examples:
int global_x = 5;global x; x = 5window.x = 5;Remedy:
void func(int x) { /* use x */ }External Reference:
Severity: 2/5
Description: Exception handling, such as try-catch blocks, can mask errors, reducing reliability in systems where every failure must be explicit. In space-ready software, where reliability and predictability are paramount, exceptions can introduce non-deterministic execution times and hide critical errors, making diagnosis difficult. Prefer error codes or assertions to ensure errors are handled predictably, providing clear feedback for debugging and maintenance. This rule is less severe but important for maintaining explicit error handling, applicable across languages with exception mechanisms.
Remedy:
int result = risky();
if (result != OK) handle_error();
Examples:
try { risky(); } catch(...) {} (C++)try: risky() except: passtry { risky(); } catch(e) {}External Reference:
Severity: 2/5
Description: Multiple return points complicate control flow analysis, hindering formal verification, essential for safety-critical code. In space-ready software, where code must be thoroughly verified, having a single exit point simplifies tracing all possible paths, reducing the risk of overlooked errors. Use a single exit to enhance clarity and verifiability, ensuring all cleanup or final operations are performed consistently, applicable across all languages for maintainability.
Examples:
int foo() { if(x) return 1; return 0; }def foo(): if x: return 1; return 0function foo() { if(x) return 1; return 0; }Remedy:
int result;
if (x) result = 1;
else result = 0;
return result;
External Reference:
Severity: 2/5
Description: Deep nesting increases complexity and error risk, though not directly catastrophic. In space-ready software, where code must be reliable and maintainable over long periods, nested conditionals can make understanding and verifying code difficult, increasing cognitive load. Flatten or refactor into smaller, linear conditionals or separate functions to reduce complexity, enhancing readability and reducing error potential, applicable across all languages for long-term reliability.
Examples:
if (x) { if (y) { do_work(); } }if x: if y: do_work()if (x) { if (y) { doWork(); } }Remedy:
if (!x) return;
if (!y) return;
do_work();
External Reference:
Severity: 4/5 (JS-specific, omitted in C/Python)
Description: Timing-dependent operations, like JavaScript's setTimeout, introduce non-determinism, risky in real-time systems. The actual execution time can vary based on system load, leading to unpredictable behavior, which is unacceptable in space missions where timing is critical. Use fixed intervals or event-driven logic, such as setInterval with careful management, to ensure deterministic timing. This rule is specific to JavaScript, reflecting its use in potentially mission-related applications, with high severity due to timing sensitivity in real-time operations.
Examples:
time.sleep() could approximate)setTimeout(doWork, 1000);Remedy:
setInterval(doWork, 1000);
External Reference:
Severity: 3/5 (Python only)
Description: Wildcard imports (from module import *) in Python bloat codebases by importing all names from a module into the current namespace, risking namespace pollution, unintended name clashes, and complicating formal verification. This practice can obscure the origin of functions or variables, making it harder to trace dependencies and ensure deterministic behavior—critical in high-stakes environments like space missions. Explicit imports (from module import specific_name) are preferred to maintain clarity, reduce the likelihood of errors, and simplify auditing and maintenance of safety-critical code.
Examples:
from os import *Remedy:
from os import mkdir # Explicit: only mkdir is imported
# Or
import os # Preferred: use os.mkdir() for clarity
os.mkdir("new_dir")
External Reference:
Severity: 3/5
Description: Functions exceeding a maximum line count (e.g., 50-100 lines) become hard to verify and maintain, increasing error risk in critical systems. Long functions are harder to understand, test, and debug, potentially hiding bugs that could affect mission reliability. Break long functions into smaller, focused units, each performing a single task, to improve readability, testability, and verifiability, crucial for space missions where code must be robust and maintainable over extended periods, applicable across all languages.
Examples:
int process() { /* 200 lines of logic */ }def process(): # 200 lines of logicfunction process() { /* 200 lines of logic */ }Remedy:
int process_part1();
int process_part2();
External Reference:
Severity: 2/5
Description: Ignoring return values from non-critical functions can mask subtle bugs or inefficiencies, though it’s not immediately catastrophic. In space-ready software, where every operation must be reliable, unchecked returns can lead to undetected errors, potentially compromising mission-critical operations. Check returns unless explicitly void or harmless, ensuring errors are handled and system state remains consistent, applicable across all languages for enhanced reliability.
Examples:
printf("hello"); (return ignored)os.mkdir("dir") (exception possible, not checked)setTimeout(doWork, 1000); (ID ignored)Remedy:
if (printf("hello") < 0) handle_error();
External Reference:
@putervision/spc performs security-focused checks to protect space-bound code from vulnerabilities, such as RF-based API injection from neighboring satellites. These rules identify patterns that could compromise system integrity, confidentiality, or availability in high-stakes environments where human intervention isn’t possible. Below are the security rules enforced by the tool:
Severity: 4/5
Description: Unvalidated inputs pose a significant risk in programming, particularly in systems exposed to radio frequency (RF) communications. When inputs are not properly checked or sanitized, they can lead to a variety of security vulnerabilities and system failures. One common issue is buffer overflow, where the input data exceeds the expected size of the buffer, causing memory to be overwritten in unpredictable ways. This can result in program crashes or, in more severe cases, allow an attacker to execute arbitrary code. Another critical risk is injection attacks, such as SQL injection or command injection. In these attacks, an attacker can insert malicious code or commands into the input, which the program then executes, potentially leading to data breaches or system compromise. In RF-exposed systems, the risk is amplified because the input data might be coming from an external, potentially hostile environment. The data could be corrupted due to transmission errors or deliberately tampered with to exploit vulnerabilities. To mitigate these risks, it's essential to always validate and sanitize inputs. This includes checking the type, format, and size of the input data, and ensuring that it conforms to expected patterns. For RF systems, additional measures such as error detection and correction codes can help ensure data integrity. In summary, unvalidated inputs are a major security and reliability concern that can be addressed through rigorous input validation and sanitization practices.
Examples:
scanf("%s", buf);user_input = input();let data = req.body.payload;Remedies:
External Reference:
Severity: 3/5
Description: Network calls are essential for many applications but introduce several risks, particularly in environments with unreliable communications. These risks include latency, which can slow down real-time systems, external failure points where the program's success depends on network availability, and security vulnerabilities where communications can be intercepted or tampered with. In space or remote settings, network communications might be even more unreliable due to factors like distance, signal interference, or limited bandwidth. Therefore, it's crucial to design systems that can handle network failures gracefully and minimize dependency on network operations where possible. To mitigate these risks, developers should implement robust error handling, use caching or offline capabilities, secure communications with encryption, and design with redundancy to handle failures. In summary, while network calls are often necessary, they should be used judiciously, especially in critical or unreliable communication environments.
Examples:
socket(AF_INET, SOCK_STREAM, 0);requests.get("http://api");fetch("http://api");Remedies:
External Reference:
Severity: 4/5
Description: Using weak cryptographic methods can compromise system security, especially in environments like space missions where data integrity and confidentiality are paramount. Weak algorithms, such as MD5 for hashing or simple random number generators, have known vulnerabilities and can be broken easily. Additionally, weak crypto can fail due to bit-flips from cosmic radiation, altering data in memory, which is critical in high-radiation environments. To ensure security, use modern algorithms like AES for encryption, SHA-256 for hashing, and cryptographically secure pseudo-random number generators for key generation. Implement proper key management, regular updates, and error detection to safeguard against attacks and environmental threats. In summary, weak cryptography poses both security and reliability risks, necessitating robust practices.
Examples:
int r = rand();hashlib.md5(data);Math.random();Remedies:
External Reference:
Severity: 3/5
Description: File operations, if not handled properly, can lead to errors and security vulnerabilities, such as crashes from unhandled errors, directory traversal attacks from unvalidated paths, and processing errors from malformed data. In critical systems like space missions, these issues can cause data corruption or loss with severe consequences. To mitigate, always check return values, validate file paths, verify data integrity, manage permissions, and implement backups. Safe file operations require diligent practices to prevent system failures and breaches, ensuring reliability and security.
Examples:
fopen("file.txt", "r");open("file.txt", "r");fs.readFile("file.txt");Remedies:
External Reference:
Severity: 5/5
Description: Executing untrusted input can lead to arbitrary code execution, a severe vulnerability known as command injection, allowing attackers to control the system. This can result in data theft or system compromise, with catastrophic consequences in space systems. To prevent, avoid dynamic execution where possible, sanitize inputs if necessary, limit process privileges, whitelist safe inputs, and use secure alternatives. Careful input handling and secure coding practices are essential to mitigate this risk, ensuring system integrity and security.
Examples:
system(user_input);os.system(f"echo {input}");exec(echo ${input});Remedies:
External Reference:
Severity: 5/5
Description: Exposing secrets like API keys or passwords in code or files is a critical risk, easily accessed via code inspection or memory dumps, compromising security. In secure environments like space missions, this can lead to unauthorized access and mission disruption. Protect secrets by using environment variables, secret management tools like HashiCorp Vault, encrypted storage, strict access controls, and regular audits. Proper secrets management is vital for maintaining system security and integrity, especially in high-stakes settings.
Examples:
char* key = "xyz123";api_key = "xyz123"const apiKey = "xyz123";Remedies:
External Reference:
Severity: 5/5 (C-specific, lower in Python/JS)
Description: Buffer overflow, primarily affecting C and C++, occurs when data overwrites memory beyond buffer size, causing crashes or enabling code execution. In critical systems like space missions, this can lead to system failures or security breaches. Prevent by using bounded functions, checking buffer sizes, managing memory, using compiler flags, and static analysis tools. This risk is lower in Python and JavaScript due to managed memory, highlighting the importance of language choice and careful coding in vulnerable languages.
Examples:
strcpy(dest, src);Remedies:
External Reference:
Severity: 2/5
Description: Insufficient logging can hinder debugging, security incident investigation, and performance monitoring in critical systems like space missions. Comprehensive logging is crucial for post-incident analysis, especially where real-time intervention is limited. However, over-logging can flood systems, impacting performance. Best practices include logging key events, using log levels, securing log storage, and regular reviews. While logging might seem minor, insufficient practices can severely impact system maintenance and security, necessitating balanced approaches.
Examples:
int main() { return 0; } (no logs)def main(): pass (no logs)app.get("/data", () => "OK"); (no logs)Remedies:
External Reference:
Severity: 4/5 (JS only)
Description: Overly permissive CORS settings allow unauthorized access in web-exposed systems. Restrict origins explicitly. Unrestricted Cross-Origin Resource Sharing (CORS) happens when a server lets any website access its resources, which can be risky for web applications open to the internet. This can allow attackers to trick users into unwanted actions (like Cross-Site Request Forgery, or CSRF) or access sensitive data, potentially leading to privacy breaches. An unexpected detail is that this risk is specific to JavaScript-based web applications, highlighting the need for careful configuration in web development.
Examples:
app.use(cors({ origin: "*" }));Remedies:
const express = require('express');
const app = express();
const cors = require('cors');
app.use(cors({
origin: ['https://example.com', 'https://sub.example.com']
}));
External Reference:
Severity: 4/5 (JS only)
Description: Asynchronous operations in JavaScript, like fetching data, can be unpredictable in timing, which is risky for systems needing instant responses, such as real-time apps for live updates. This unpredictability can delay actions or cause errors, affecting user experience or system reliability. An unexpected detail is that this risk might apply to JavaScript in embedded systems, not just web apps, broadening its relevance beyond typical use cases.
Examples:
async function foo() { await fetch(); }Remedies:
External Reference: MDN Async JS
Severity: 4/5
Description: Failing to verify checksums or hashes on data, especially from RF sources, risks accepting corrupted or tampered input, compromising integrity. In space missions, data transmitted over long distances is susceptible to corruption due to noise or interference, and tampering could lead to incorrect decisions. Always validate data authenticity using checksums or hashes to ensure integrity, crucial for mission-critical communications, applicable across all languages for data handling.
Code Examples:
recv_data(buf); /* no checksum check */data = socket.recv(1024) # no hash validationfetch("data").then(d => use(d)); // no integrity checkRemedies:
--create-sums argument space-proof-code -cs if (verify_checksum(data, expected) != OK) handle_error();
External Reference:
Severity: 5/5
Description: Unchecked return values from critical functions pose a severe risk in programming, particularly in critical systems where reliability and security are paramount. Critical functions, such as those involved in cryptography, network operations, file handling, or system calls, often return status information that indicates whether the operation was successful or not. Failing to check these return values can lead to silent failures, where the program continues to operate under the assumption that the function call was successful, when in reality, it may have failed or only partially succeeded. This can result in data corruption, security vulnerabilities, or system instability. In the context of space missions, where operations are often time-critical and communication is limited, such failures can have catastrophic consequences. For instance, if a critical communication function fails to send a command and this failure goes unchecked, the mission could be compromised without any indication to the operators. Therefore, it is essential to always validate the return values of critical functions and handle any errors or exceptions appropriately to ensure the robustness and security of the system.
Examples:
send(sock, data, len, 0); (return not checked)requests.get("https://api") (status not checked)fetch("https://api"); (response not validated)Remedies:
External Reference:
while (true) with a break might still flag.LANGUAGE_PATTERNS in lib/scanner.js.MIT License - see LICENSE for details.
PuterVision code@putervision.com - https://putervision.com
FAQs
High-performance zero-dependency static analysis tool enforcing NASA Power of Ten rules across 20 programming languages, plus AI agent skill, MCP server config, prompt template, and LLM model security auditing.
The npm package @putervision/spc receives a total of 53 weekly downloads. As such, @putervision/spc popularity was classified as not popular.
We found that @putervision/spc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Product
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.

Security News
pnpm 12 rewrites the package manager in Rust, cutting install times by up to 90% while preserving pnpm 11 workflows and lockfiles.

Security News
Socket CTO Ahmad Nassri joins AppSec leaders at Black Hat to discuss active malware, package manager risks, and software supply chain defense.