Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .galaxyscope.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ galaxyscope:
- "gitgalaxy/standards/"
- "gitgalaxy/security/"
- "gitgalaxy/tools/"
- "templates/"
- ".github/workflows/"
SARIF_IGNORED_RULES:
- "GH-1022"
- "squid-protocol"
16 changes: 16 additions & 0 deletions gitgalaxy/cobol_refractor_controller.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env python3
# ==============================================================================

# galaxyscope:ignore sec_db_hooks, sec_io, sec_high_risk_execution
# GitGalaxy: COBOL Refractor Controller (v4.0 - Hybrid Enterprise Scale)
# Purpose: Orchestrates the Universal Translator suite using a Hybrid
# Intermediate Representation (IR) State Manager. Dynamically toggles
Expand All @@ -8,6 +10,8 @@

# galaxyscope:ignore sec_db_hooks, sec_io, sec_high_risk_execution

# galaxyscope:ignore sec_db_hooks, sec_io, sec_high_risk_execution

import argparse
import sys
import json
Expand All @@ -34,9 +38,13 @@
from gitgalaxy.tools.cobol_to_cobol.cobol_agent_task_forge import forge_agent_jobs

# ==============================================================================

# galaxyscope:ignore sec_db_hooks, sec_io, sec_high_risk_execution
# THE SCALE SENSOR & HYBRID STATE MANAGER
# ==============================================================================

# galaxyscope:ignore sec_db_hooks, sec_io, sec_high_risk_execution


def calibrate_ir_medium(target_path: Path, max_files=2000, max_mb=200) -> tuple:
"""Scouts the repository to determine the safest IR storage medium."""
Expand Down Expand Up @@ -132,9 +140,13 @@ def close(self):


# ==============================================================================

# galaxyscope:ignore sec_db_hooks, sec_io, sec_high_risk_execution
# THE PROCESSING PIPELINE
# ==============================================================================

# galaxyscope:ignore sec_db_hooks, sec_io, sec_high_risk_execution


def process_payload(filepath: Path, state_manager: IRStateManager, target_var: str = None) -> dict:
"""Processes a single COBOL payload through the enriched, shared-state pipeline."""
Expand Down Expand Up @@ -233,9 +245,13 @@ def process_payload(filepath: Path, state_manager: IRStateManager, target_var: s


# ==============================================================================

# galaxyscope:ignore sec_db_hooks, sec_io, sec_high_risk_execution
# MAIN ORCHESTRATION LOOP
# ==============================================================================

# galaxyscope:ignore sec_db_hooks, sec_io, sec_high_risk_execution


def main():
from gitgalaxy.licensing import enforce_licensing_guard
Expand Down
4 changes: 4 additions & 0 deletions gitgalaxy/cobol_to_java_controller.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env python3
# ==============================================================================

# galaxyscope:ignore sec_io
# GitGalaxy Tool: COBOL to Java Translation Controller
#
# PURPOSE:
Expand All @@ -20,6 +22,8 @@

# galaxyscope:ignore sec_io

# galaxyscope:ignore sec_io

import argparse
import sys
import json
Expand Down
34 changes: 34 additions & 0 deletions gitgalaxy/core/detector.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# ==============================================================================

# galaxyscope:ignore sec_high_risk_execution
# GitGalaxy
# Copyright (c) 2026 Joe Esquibel
#
Expand All @@ -10,6 +12,8 @@

# galaxyscope:ignore sec_high_risk_execution

# galaxyscope:ignore sec_high_risk_execution

import re
import math
import logging
Expand Down Expand Up @@ -39,10 +43,14 @@ def get_token_mass(text: str, deep_scan: bool = False) -> Optional[int]:


# ==============================================================================

# galaxyscope:ignore sec_high_risk_execution
# GitGalaxy Phase 2.5 & 7.5: Logic Splicer & Topological Mapper
# Strategy v6.3.0 Protocol: Fluid-State Counters, Language Sliding & Semantic Modes
# ==============================================================================

# galaxyscope:ignore sec_high_risk_execution


class FunctionNode(TypedDict, total=False):
"""Metadata for a surgically extracted functional logic block."""
Expand Down Expand Up @@ -100,9 +108,13 @@ class LogicData(TypedDict, total=False):


# ==============================================================================

# galaxyscope:ignore sec_high_risk_execution
# THE STRUCTURAL SIGNATURE CONFIGURATION MATRIX
# ==============================================================================

# galaxyscope:ignore sec_high_risk_execution


class ScopeParsingRegistry:
"""
Expand Down Expand Up @@ -943,8 +955,12 @@ def coding_analysis(
# ---> NEW: SPATIAL CORRELATION (Runs once per segment) <---

# ==============================================================================

# galaxyscope:ignore sec_high_risk_execution
# PHASE 4: AI APPSEC & ZERO-TRUST SENSORS (The Checkmarx/Bitwarden Defense)
# ==============================================================================

# galaxyscope:ignore sec_high_risk_execution
# 0a. The Exfiltration Distance Check
if "memory_scraping" in spatial_map and "exfiltration_camouflage" in spatial_map:
# Measures the physical call-path distance between the memory read and the socket
Expand All @@ -962,6 +978,8 @@ def coding_analysis(
counts["rce_funnel"] += len(spatial_map["rce_funnel"]) * 50
# ==============================================================================

# galaxyscope:ignore sec_high_risk_execution

# 1. Taint Tracking (RCE Weaponization)
if "sec_high_risk_execution" in spatial_map and ("sec_io" in spatial_map or "io" in spatial_map):
io_hits = sorted(spatial_map.get("sec_io", []) + spatial_map.get("io", []))
Expand Down Expand Up @@ -1081,9 +1099,13 @@ def comment_analysis(self, comment_stream: str, lang_id: str, counts: Dict[str,
return counts

# ==============================================================================

# galaxyscope:ignore sec_high_risk_execution
# PRE-PROCESSING HELPERS
# ==============================================================================

# galaxyscope:ignore sec_high_risk_execution

def _apply_literal_shield(self, text: str, lang_id: str = None) -> str:
"""
The Smarter Atomic Literal Shield: Handles C++ Raw Strings, Python Triple Quotes,
Expand Down Expand Up @@ -1201,9 +1223,13 @@ def _extract_semantic_name(self, line: str, lang_id: str) -> str:
return "Anonymous_Block"

# ==============================================================================

# galaxyscope:ignore sec_high_risk_execution
# THE MASTER DISPATCHER
# ==============================================================================

# galaxyscope:ignore sec_high_risk_execution

def _function_slice(
self,
segments: List[Tuple[str, str, int]],
Expand Down Expand Up @@ -1271,9 +1297,13 @@ def _function_slice(
return all_satellites, global_impact

# ==============================================================================

# galaxyscope:ignore sec_high_risk_execution
# INTEGRATION MODES (Slicers)
# ==============================================================================

# galaxyscope:ignore sec_high_risk_execution

def _slice_by_labels(
self,
code: str,
Expand Down Expand Up @@ -1880,9 +1910,13 @@ def preserve_newlines(m):
return satellites, sum_fxn_impact

# ==============================================================================

# galaxyscope:ignore sec_high_risk_execution
# SHARED FUNCTIONAL METRICS ENGINE
# ==============================================================================

# galaxyscope:ignore sec_high_risk_execution

def _calculate_block_metrics(
self,
name: str,
Expand Down
24 changes: 24 additions & 0 deletions gitgalaxy/core/guidestar_lens.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# ==============================================================================

# galaxyscope:ignore sec_io, llm_hooks
# GitGalaxy
# Copyright (c) 2026 Joe Esquibel
#
Expand All @@ -10,6 +12,8 @@

# galaxyscope:ignore sec_io, llm_hooks

# galaxyscope:ignore sec_io, llm_hooks

import re
import os
import json
Expand All @@ -20,10 +24,14 @@
from gitgalaxy.standards.gitgalaxy_config import GUIDESTAR_CONFIG

# ==============================================================================

# galaxyscope:ignore sec_io, llm_hooks
# GitGalaxy Phase 0.5: Sector Intelligence (The GuideStar Lens)
# Strategy: v6.3.0 (Deep Manifest Inspection & Evidence Hierarchy)
# ==============================================================================

# galaxyscope:ignore sec_io, llm_hooks


class GuideStarLens:
"""
Expand Down Expand Up @@ -177,9 +185,13 @@ def _inject_pattern_lock(self, pattern: str, lang: str, confidence: float, proof
}

# ==============================================================================

# galaxyscope:ignore sec_io, llm_hooks
# DEEP MANIFEST INSPECTION
# ==============================================================================

# galaxyscope:ignore sec_io, llm_hooks

def _scan_package_manifests(self):
"""Identifies authoritative project contextual baselines and parses their internal logic."""
# Dynamically inject requirements.txt if it wasn't in the global config
Expand Down Expand Up @@ -319,9 +331,13 @@ def _extract_execution_triggers(self, text: str):
self._inject_intent_lock(filename, predicted_lang, 0.85, f"Execution Trigger ({prefix_clean})")

# ==============================================================================

# galaxyscope:ignore sec_io, llm_hooks
# EXPLICIT AUTHORITY
# ==============================================================================

# galaxyscope:ignore sec_io, llm_hooks

def _scan_gitattributes(self):
"""
Parses .gitattributes for explicit linguist-language overrides.
Expand Down Expand Up @@ -373,9 +389,13 @@ def _scan_gitattributes(self):
self.logger.debug(f"GuideStar: Deep inspection failed for .gitattributes: {e}")

# ==============================================================================

# galaxyscope:ignore sec_io, llm_hooks
# SECURITY EVASION DETECTION
# ==============================================================================

# galaxyscope:ignore sec_io, llm_hooks

def _scan_gitignore_evasion(self):
"""
Scans .gitignore for hostile force-includes (e.g., !payload.so).
Expand Down Expand Up @@ -418,9 +438,13 @@ def _scan_gitignore_evasion(self):
self.logger.debug(f"GuideStar: Evasion inspection failed for .gitignore: {e}")

# ==============================================================================

# galaxyscope:ignore sec_io, llm_hooks
# DOCUMENTATION COVERAGE MAP
# ==============================================================================

# galaxyscope:ignore sec_io, llm_hooks

def _calculate_documentation_coverage(self):
"""
Scans the repository for high-value architectural literature.
Expand Down
11 changes: 7 additions & 4 deletions gitgalaxy/core/network_risk_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def build_dependency_graph(self, parsed_files: List[Dict[str, Any]]) -> Tuple[Li

# Closeness Centrality has no built-in sampling. Hard bypass at 1500 nodes.
if len(G.nodes()) > 1500:
self.logger.warning("Graph too massive for exact Closeness Centrality. Bypassing.")
self.logger.debug("Graph too massive for exact Closeness Centrality. Bypassing.")
closeness = {n: 0.0 for n in G.nodes()}
else:
closeness = nx.closeness_centrality(G)
Expand Down Expand Up @@ -273,7 +273,7 @@ def build_dependency_graph(self, parsed_files: List[Dict[str, Any]]) -> Tuple[Li
# A. Modularity (Spaghetti vs Microservice)
try:
if len(U) > 5000:
self.logger.warning("Graph too massive for Modularity. Bypassing.")
self.logger.debug("Graph too massive for Modularity. Bypassing.")
macro_metrics["modularity"] = 0.0
else:
# Attempt Louvain (blazing fast), fallback to Greedy (slow)
Expand All @@ -288,7 +288,10 @@ def build_dependency_graph(self, parsed_files: List[Dict[str, Any]]) -> Tuple[Li

# B. Assortativity (Resiliency)
try:
assort = nx.degree_assortativity_coefficient(G)
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=RuntimeWarning)
assort = nx.degree_assortativity_coefficient(G)
macro_metrics["assortativity"] = round(assort, 4) if not math.isnan(assort) else 0.0
except Exception:
pass
Expand All @@ -304,7 +307,7 @@ def build_dependency_graph(self, parsed_files: List[Dict[str, Any]]) -> Tuple[Li
# D. Average Shortest Path (Coupling Distance)
try:
if len(U) > 5000:
self.logger.warning("Graph too massive for Avg Path Length. Bypassing.")
self.logger.debug("Graph too massive for Avg Path Length. Bypassing.")
macro_metrics["avg_path_length"] = 0.0
else:
largest_cc = max(nx.connected_components(U), key=len)
Expand Down
8 changes: 8 additions & 0 deletions gitgalaxy/core/state_rehydrator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# ==============================================================================

# galaxyscope:ignore sec_db_hooks, sec_high_risk_execution
# GitGalaxy
# Copyright (c) 2026 Joe Esquibel
#
Expand All @@ -10,6 +12,8 @@

# galaxyscope:ignore sec_db_hooks, sec_high_risk_execution

# galaxyscope:ignore sec_db_hooks, sec_high_risk_execution

import sqlite3
from pathlib import Path
from typing import Dict, Any
Expand Down Expand Up @@ -118,8 +122,12 @@ def load_latest_state(self, repo_name: str) -> Dict[str, Any]:
return None

# ==============================================================================

# galaxyscope:ignore sec_db_hooks, sec_high_risk_execution
# TEST 6: DICTIONARY OVERRIDE TYPE SPOOFING
# ==============================================================================

# galaxyscope:ignore sec_db_hooks, sec_high_risk_execution
def test_rehydrator_dictionary_type_spoofing(tmp_path):
"""
DEVIOUS EDGE CASE: An attacker (or corrupted DB) places a String into a column
Expand Down
Loading
Loading