fix: rename token variable to resolve CodeQL clear-text-storage alert#1002
Conversation
Agent-Logs-Url: https://github.com/microsoft/apm/sessions/e20e0e96-4aa6-4cbf-a9fb-048be0898dbd Co-authored-by: sergio-sisternes-epam <207026618+sergio-sisternes-epam@users.noreply.github.com>
…solve CodeQL py/clear-text-storage-sensitive-data alert
The variable named `token` stored the template string "${CLAUDE_PLUGIN_ROOT}"
(a placeholder marker, not a secret). CodeQL's heuristic flagged the variable
name as sensitive data. Renaming to `placeholder` eliminates the false positive
with zero behavioral change.
Agent-Logs-Url: https://github.com/microsoft/apm/sessions/e20e0e96-4aa6-4cbf-a9fb-048be0898dbd
Co-authored-by: sergio-sisternes-epam <207026618+sergio-sisternes-epam@users.noreply.github.com>
token variable to resolve CodeQL clear-text-storage alert
There was a problem hiding this comment.
Pull request overview
This PR addresses a CodeQL false-positive (py/clear-text-storage-sensitive-data) by renaming a local variable in the plugin root placeholder substitution logic so it is no longer named token.
Changes:
- Rename the local variable holding
"${CLAUDE_PLUGIN_ROOT}"fromtokentoplaceholderin_substitute_plugin_root. - Update
uv.lockto reflectapm-cliversion0.10.0.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| uv.lock | Updates the locked editable package version for apm-cli to 0.10.0. |
| src/apm_cli/deps/plugin_parser.py | Renames the placeholder variable in ${CLAUDE_PLUGIN_ROOT} substitution to avoid CodeQL heuristic false positives. |
APM Review Panel VerdictDisposition: APPROVE (with one minor pre-merge action -- add CHANGELOG entry) Per-persona findingsPython Architect: This is a routine PR (single variable rename inside one function). Two mermaid blocks follow. 1. OO / class diagram The PR participates in classDiagram
direction LR
class plugin_parser {
<<Module>>
+_read_mcp_json(path, logger) Dict
+_substitute_plugin_root(servers, abs_root, logger) Dict
+_mcp_servers_to_apm_deps(servers, plugin_path) List
}
class _substitute_plugin_root {
<<Pure>>
placeholder str
substituted bool
+_walk(obj) Any
}
class PluginParserCaller {
<<IOBoundary>>
}
plugin_parser *-- _substitute_plugin_root : contains
PluginParserCaller ..> plugin_parser : calls
class _substitute_plugin_root:::touched
classDef touched fill:#fff3b0,stroke:#d47600
2. Execution flow diagram flowchart TD
A["PluginParser caller"] --> B["_substitute_plugin_root(servers, abs_root, logger)"]
B --> C["Initialize placeholder = '\$\{CLAUDE_PLUGIN_ROOT}'"]
C --> D["_walk(obj) -- recursive traversal"]
D --> E{isinstance obj str?}
E -- yes --> F{placeholder in obj?}
F -- yes --> G["substituted=True\nreturn obj.replace(placeholder, abs_root)"]
F -- no --> H["return obj unchanged"]
E -- no --> I{isinstance obj dict?}
I -- yes --> J["recurse over k,v pairs"] --> D
I -- no --> K{isinstance obj list?}
K -- yes --> L["recurse over items"] --> D
K -- no --> M["return obj"]
G --> N["[I/O] logger.info: substitution logged"]
Design patterns
Assessment: The rename from CLI Logging Expert: No logging changes in this PR. The DevX UX Expert: Supply Chain Security Expert: The CodeQL
Auth Expert: Not activated -- OSS Growth Hacker: No conversion surface touched (no README, quickstart, CLI surface, templates, or docs changes). Keeping CodeQL clean is a positive hygiene signal for enterprise adopters evaluating security posture. No growth strategy update needed for CEO arbitrationAll five specialists agree with no conflicts to resolve. This is a textbook false-positive suppression fix: a variable whose name tripped a static-analysis heuristic is renamed without any behavioral change. The Required actions before merge
Optional follow-ups
|
Description
CodeQL
py/clear-text-storage-sensitive-dataflags_substitute_plugin_rootinplugin_parser.pybecause a local variable namedtokenholds the template placeholder"${CLAUDE_PLUGIN_ROOT}". The heuristic treats any variable namedtokenas sensitive data. False positive — renamed toplaceholder.Type of change
Testing