mcpbeat Sign in

Codegen Literal Security Scan Agent Skill

Detect and remediate code-generation literal injection risks in Kiota writer code (wire names, serialization names, URL templates, base URLs, defaults, and path parameter keys).

937 tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
3790
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/microsoft/kiota --skill codegen-literal-security-scan

The instruction itself

6 sections, as written by the author

Use this skill when auditing or modifying any code generator writer logic.

Goal

Prevent generated-source injection (including potential RCE chains) by ensuring every untrusted schema-derived value is escaped for the destination literal context before being emitted.

Focus surfaces (expanded)

Prioritize all literal-emission paths under src/Kiota.Builder/Writers/**/*.cs, especially:

  • WireName, SerializationName, IndexParameter.SerializationName
  • UrlTemplateOverride, URI template constants, base URL defaults
  • DefaultValue (constructor assignments, getter fallback values, parameter signatures)
  • Path/query parameter assignment keys in convention helpers
  • Query parameters mapper constants and metadata constants
  • Enum wire values and enum member attributes
  • Property annotations/attributes that carry serialized names
  • Backing store keys for custom/additional-data properties
  • Documentation long/short comments that interpolate external links/labels

Required checks

  • Locate candidate sinks:
  • search for interpolation/writes that include the focus surfaces and emit language string literals (WriteLine, WriteLines, StartBlock, doc attributes/tags).
  • Verify context-aware escaping is applied at the emission site:
  • double-quoted literal contexts must use SanitizeDoubleQuote()
  • single-quoted literal contexts must use SanitizeSingleQuote()
  • already-quoted defaults must use SanitizeQuotedStringLiteral()
  • Dart quoted literals must use SanitizeDartSingleQuoteLiteral/SanitizeDartDoubleQuoteLiteral (to also escape $)
  • Go struct tags must keep backticks and sanitize embedded quoted values (do not switch tag quoting style)
  • Confirm no fallback path emits the raw value.
  • Confirm convention-layer helpers (AddParametersAssignment and equivalents) are also sanitized, not only writer methods.

Remediation rules

  • Escape at the final write site, not only upstream.
  • Keep quote style unchanged and apply matching sanitizer.
  • Reuse existing helpers in src/Kiota.Builder/Writers/StringExtensions.cs.
  • For cross-language consistency, patch all affected writers (C#/Dart/Go/Java/PHP/Python/Ruby/TypeScript and helpers).
  • Preserve runtime semantics while hardening:
  • keep Go struct tag behavior intact
  • avoid changing enum/default value resolution logic
  • avoid introducing extra quoting around non-string literals

High-risk sink families to explicitly review

  • Serializer/deserializer key emission (WireName, discriminator keys, query mapper keys).
  • Request-builder URL/template metadata (UrlTemplateOverride, URI template constants, base URL defaults).
  • Indexer/path parameter map writes (urlTplParams[...], .Add(...), .put(...), map assignments).
  • Property/enum metadata attributes and constants (QueryParameter, EnumMember, enum objects, navigation/request metadata constants).
  • Default value emission in constructors, getters, and parameter signatures.
  • Documentation comments with external links/labels and deprecation text.

Verification expectations

After changes:

  • Add/adjust regression tests in corresponding writer test suites under tests/Kiota.Builder.Tests/Writers/**.
  • Include malicious payloads with quote + newline/control characters (", ', \n, \r, \t, \\, and $ where relevant).
  • Ensure assertions validate escaped output, not just general generation success.
  • Validate targeted writer tests and then broader builder/solution validation.

Other skills for the same job

different authors, same section of the catalogue
Protocolsio Integration
by christophacham
×4

Integration with protocols.io API for managing scientific protocols. This skill should be used when working with protocols.io to search, create, update, or publish protocols; manage protocol steps and materials; handle discussions and comments; organize workspaces; upload and manage files; or integrate protocols.io functionality into workflows. Applicable for protocol discovery, collaborative protocol development, experiment tracking, lab protocol management, and scientific documentation.

16k tokens
Tailored Resume Generator
by frostant
×4

Analyzes job descriptions and generates tailored resumes that highlight relevant experience, skills, and achievements to maximize interview chances

3k tokens
Excalidraw Diagram Generator
by github
vendor ×3

Generate Excalidraw diagrams from natural language descriptions. Use when asked to "create a diagram", "make a flowchart", "visualize a process", "draw a system architecture", "create a mind map", or "generate an Excalidraw file". Supports flowcharts, relationship diagrams, mind maps, and system architecture diagrams. Outputs .excalidraw JSON files that can be opened directly in Excalidraw.

36k tokens scripts
Expo Dev Client
by openai
vendor ×3

Build and distribute Expo development clients locally or via TestFlight

961 tokens
Executing Plans
by ZhanlinCui
×3

Use when you have a written implementation plan to execute in a separate session with review checkpoints

542 tokens
Anndata
by christophacham
×3

Data structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.

16k tokens
Benchling Integration
by christophacham
×3

Benchling R&D platform integration. Access registry (DNA, proteins), inventory, ELN entries, workflows via API, build Benchling Apps, query Data Warehouse, for lab data management automation.

14k tokens
Biopython
by christophacham
×3

Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.

24k tokens

How to use it

Copy the folder

Take microsoft/codegen-literal-security-scan from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.