T09 · Insecure Skill Coding Practices
- Location
SKILL.md:70- Finding
API Keys Exposed Through Terminal Output
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is mostly a coherent market-theme analysis tool, but it needs review because its instructions can expose API keys and its dependencies and network credential handling are under-hardened.
Review before installing. Do not run the echo commands for API keys; use presence checks instead, and rotate any key that may have been printed into logs. Run the skill in an isolated environment with pinned dependencies, expect outbound requests to FINVIZ, FMP, yfinance/GitHub data sources, and treat generated reports as informational market analysis rather than financial advice.
SKILL.md:70API Keys Exposed Through Terminal Output
scripts/representative_stock_selector.py:353FINVIZ Elite Credential Embedded in Request URL
SKILL.md:81Unpinned and Inconsistent Third-Party Dependency Installation
The code is narrowly focused on calculating momentum-based rankings for industries using fixed return windows (1W, 1M, 3M, 6M). While this could support part of a broader market analysis workflow, it does not itself detect 'themes,' analyze sector rotation dynamics, identify narratives, or perform lifecycle analysis as described. The bullish/bearish labels are simple sign checks on weighted returns and not substantive narrative analysis. Therefore the declared description overstates and materially misrepresents the implemented behavior.
The code’s actual function is a low-level securities metrics scanner, not a market-theme analysis engine. It fetches quote and historical data for specified symbols and computes indicators like RSI, 52-week distance, P/E, and ETF volume ratios, with FMP/yfinance fallback logic and caching. There is no logic for discovering themes across sectors, classifying hot/cold themes, inferring bullish or bearish narratives, or performing lifecycle analysis of themes. While such metrics could theoretically support later thematic analysis, that higher-level behavior is not implemented in this code chunk. Additionally, the code relies on external financial data services, which is not reflected in the declared permissions.
The declared purpose describes a skill for detecting and analyzing trending market themes across sectors. However, the actual code chunk only configures Python import paths for tests via sys.path insertion. It does not analyze markets, sectors, themes, narratives, or lifecycle states, nor does it access market data or implement any user-facing theme detection logic. This is a materially different primary purpose, so the description does not accurately represent this code chunk.
The code does not implement market-theme detection, sector trend analysis, thematic investing analysis, or bullish/bearish narrative lifecycle analysis. Instead, it is a unit/integration test suite for config-loading utilities related to a themes YAML file. While the config contents reference themes and ETFs, the behavior shown is purely about loading and validating configuration data, not analyzing current market conditions or trends. Therefore, the declared description does not accurately represent the actual code behavior.
The declared description is about high-level thematic market analysis across sectors and narratives. The actual code does not implement or test trend/theme detection, sector rotation analysis, thematic investing classification, or bullish/bearish narrative lifecycle analysis. Instead, it focuses on low-level market data retrieval and security-level metric computation for stocks and ETFs, along with infrastructure concerns like API migration, caching, batching, retries, and backend fallback behavior. These are materially different capabilities and indicate a primary purpose mismatch.
The declared description promises a skill for detecting and analyzing trending market themes across sectors and identifying thematic narratives with lifecycle analysis. The actual code chunk does not implement that behavior. Instead, it contains unit tests for functions that score and rank industries using weighted returns over 1-week, 1-month, 3-month, and 6-month periods, assign bullish/bearish direction based on weighted return, and return top/bottom industries. While industry ranking could be a supporting component of broader market-theme analysis, this chunk neither performs theme detection nor lifecycle/narrative analysis. Because the primary behavior shown is materially narrower and different from the declared purpose, this is a mismatch.
The declared description is about identifying and analyzing broad market themes across sectors. The supplied code does not analyze themes or sector rotation; instead, it tests a downstream component that selects representative stocks for an already-defined theme. Its primary behavior is stock parsing, scoring, deduplication, source fetching, and resilience logic around FINVIZ/FMP/ETF holdings. Those capabilities are materially different from trend/theme detection, so the description does not accurately represent this code chunk.
There is a clear description-behavior mismatch. The declared purpose describes a market-analysis skill focused on identifying trending sectors and themes, but the actual code chunk only contains unit tests for date staleness logic. The tested behavior is operational/business-date validation, not financial theme detection or sector analysis. No market data access, theme extraction, sector classification, or narrative analysis appears in the code.
The declared purpose describes market-theme analysis functionality for end users. However, the supplied code does not implement any market analysis, trend detection, sector analysis, lifecycle analysis, or related logic. It only configures the test environment by inserting a scripts directory into sys.path so test modules can import project scripts. This is a materially different purpose from the declared description, so it should be flagged as a mismatch.
The declared description focuses on high-level market-theme analysis across sectors and thematic narratives. However, the code shown does not implement or test theme detection, sector rotation analysis, thematic investing logic, or bullish/bearish lifecycle analysis. Instead, it is narrowly concerned with low-level data acquisition and merge behavior for stock/ETF metrics, including fallback from FMP to yfinance and stats bookkeeping. This is a materially different primary purpose, so the description does not accurately represent the code chunk.
The declared description promises a market-intelligence capability: identifying trending sectors/themes and analyzing bullish or bearish narratives. The actual code chunk does not implement or invoke any such analysis. Instead, it contains unit tests for a performance-processing utility that caps extreme performance values and preserves originals. This is a materially different primary purpose. While outlier capping could be a supporting preprocessing step somewhere in a financial pipeline, this chunk itself is specifically test code for normalization logic, not theme detection or market-trend analysis.
The declared purpose is a high-level market analysis skill focused on identifying current themes and sector narratives. The actual code chunk does not implement or support that behavior directly; it is only a narrow unit test for checking whether lifecycle input data is sufficient based on None/non-None values. There is no logic related to market themes, sectors, trends, narratives, or lifecycle analysis of themes. This is a materially different primary purpose, so it should be flagged as a mismatch.
Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.
tokens: list[str] = []
for ind in industries:
name = ind.get("name", "")
for token in name.split():
cleaned = token.strip("(),")
if cleaned and cleaned not in _STOP_WORDS:
tokens.append(cleaned)
The skill declares no explicit tool scope or permissions, yet its instructions clearly require reading environment variables, accessing the network, and writing files. That mismatch weakens governance and makes it harder for a platform to constrain what the skill can do, especially when API keys and external data sources are involved.
Broad activation language can cause the skill to trigger in situations where the user did not intend to invoke it, increasing the chance of unnecessary network access, credential use, and file generation. In an automated agent environment, overbroad routing can become a security problem because powerful behaviors are invoked too easily.
Ambiguous implicit triggers further increase the chance of accidental invocation. Given this skill's ability to access external data, read env-based credentials, and write reports, imprecise routing makes the operational risk more significant than it would be for a purely static or read-only skill.
The instructions explicitly access API-key environment variables without warning about secret handling. In practice, this can normalize unsafe treatment of credentials, and combined with shell snippets it raises the risk of accidental disclosure through logs, command history, debugging output, or downstream script behavior.
The skill instructs installation of packages and execution of a local Python script, expanding its operational footprint beyond passive analysis. In a skill context, asking an agent to run local code can introduce supply-chain risk, unsafe execution, or unintended side effects if the script or dependencies are altered or insufficiently reviewed.
The manifest frames this as an analysis skill, but the workflow writes timestamped reports to disk. Unadvertised file output creates persistence and data-handling risks, especially if reports include sensitive prompts, API-derived data, or internal analysis artifacts that users do not expect to be stored.
This template produces rankings, bullish/bearish assessments, heat scores, lifecycle stages, and top movers that can reasonably be interpreted as actionable investment guidance. Because it lacks a clear disclaimer that the output is informational only and not financial advice, users may rely on it for trading decisions, increasing legal, compliance, and user-harm risk.
The manifest frames the skill as detecting and analyzing trending market themes, which suggests analytical output generation but not persistent filesystem writes. This module explicitly creates directories and saves report artifacts to disk, adding a storage/output side effect beyond pure analysis.
The manifest describes a market-theme detection and analysis skill, but the documented workflow explicitly instructs checking environment variables with shell commands for FINVIZ and FMP API keys. Reading environment state is a separate capability that is not part of the user-facing analytical purpose and is not declared in the manifest context.
This code creates an output directory and writes both JSON and Markdown files, which is a file-system side effect covered by the missing-warning rule for code files. Although the function docstring describes saving reports, there is no confirmation prompt, logging/print statement, or stronger user-facing disclosure at the operation itself.
The manifest frames this skill as detecting and analyzing trending market themes, which is primarily an analytics capability. This file explicitly persists reports to a reports directory and later resolves and writes to a user-supplied output path, adding filesystem output behavior that is not reflected in the manifest description.
Allowing a caller to supply an arbitrary output directory expands writes beyond a fixed reports location and can cause the process to create files in unintended filesystem paths. In an agent/runtime context, this becomes more dangerous because user-controlled arguments may be influenced indirectly, enabling unauthorized file placement, overwriting application data, or writing into sensitive mounted directories accessible to the skill.
No suspicious patterns detected.