Skip to content

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Sep 7, 2025

Test Pull Request - Custom Engine Safe Output

This pull request was automatically created by the test-safe-outputs-custom-engine workflow to validate the create-pull-request safe output functionality.

Changes Made

  • Created test file with timestamp
  • Demonstrates custom engine file creation capabilities

Test Information

  • Engine: Custom (GitHub Actions steps)
  • Workflow: test-safe-outputs-custom-engine
  • Trigger Event: push
  • Run ID: 17530290686

This PR can be merged or closed after verification of the safe output functionality.

Generated by Agentic Workflow Run

@github-actions github-actions bot closed this Sep 7, 2025
@github-actions github-actions bot deleted the test-safe-outputs-custom-engine/a81b87f99e72883d branch September 9, 2025 13:50
github-actions bot pushed a commit that referenced this pull request Jan 22, 2026
- Add proper shell escaping for JSON data embedded in environment variables
- Prevents potential command injection via single quotes in user data
- Fixes CodeQL alert #538 (Critical severity)
- Uses POSIX-compatible '\''escaping technique

Security: Addresses CWE-78, CWE-89, CWE-94
pelikhan added a commit that referenced this pull request Jan 22, 2026
…ON data (#11382)

* Fix go/unsafe-quoting: Escape single quotes in JSON data

- Add proper shell escaping for JSON data embedded in environment variables
- Prevents potential command injection via single quotes in user data
- Fixes CodeQL alert #538 (Critical severity)
- Uses POSIX-compatible '\''escaping technique

Security: Addresses CWE-78, CWE-89, CWE-94

* Replace manual quote escaping with %q format specifier (#11386)

* Initial plan

* Use %q for JSON escaping in YAML dictionary values

Replaced manual single-quote escaping with Go's %q format specifier, which:
- Automatically handles all special characters and escaping
- Produces cleaner YAML with double quotes instead of single quotes
- Follows existing codebase patterns (e.g., add_comment.go)
- Simplifies code by removing manual string replacement logic

This addresses the feedback to use simpler escaping for JSON data in YAML dictionary values.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

* Replace manual quote escaping with %q format specifier for YAML encoding (#11392)

* Initial plan

* Recompile workflows after security fix

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

* Add changeset [skip-ci]

---------

Co-authored-by: Code Scanning Fixer Bot <code-scanning-bot@github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
github-actions bot added a commit that referenced this pull request Jan 22, 2026
…ection

Fixes code scanning alert #538 - Potentially unsafe quoting (go/unsafe-quoting)

**Security Fix**: Replace %q string formatting with base64 encoding for JSON
data passed via environment variables to eliminate quote-escaping vulnerabilities.

**Root Cause**: The previous implementation used Go's %q format specifier to
quote JSON data containing project views configuration. While %q provides
backslash escaping, it doesn't fully protect against quote injection if the
value is used unsafely in downstream shell commands or SQL queries.

**Solution**: Encode the JSON data as base64 before passing it via the
GH_AW_PROJECT_VIEWS environment variable. Base64 encoding ensures the value
contains only alphanumeric characters and safe symbols (+, /, =), completely
eliminating the risk of quote-breaking characters.

**Impact**: This is a preventive fix - the environment variable is not
currently consumed by JavaScript code, so there is no breaking change. When
the JavaScript code is implemented to read this variable, it will need to
base64-decode the value before parsing as JSON.

**Security Best Practice**: Base64 encoding is the most robust solution for
passing arbitrary data through environment variables, as recommended by
security experts for preventing injection attacks.

Related: CWE-78, CWE-89, CWE-94
pelikhan added a commit that referenced this pull request Jan 22, 2026
…_VIEWS (#11401)

* fix: use base64 encoding for GH_AW_PROJECT_VIEWS to prevent quote injection

Fixes code scanning alert #538 - Potentially unsafe quoting (go/unsafe-quoting)

**Security Fix**: Replace %q string formatting with base64 encoding for JSON
data passed via environment variables to eliminate quote-escaping vulnerabilities.

**Root Cause**: The previous implementation used Go's %q format specifier to
quote JSON data containing project views configuration. While %q provides
backslash escaping, it doesn't fully protect against quote injection if the
value is used unsafely in downstream shell commands or SQL queries.

**Solution**: Encode the JSON data as base64 before passing it via the
GH_AW_PROJECT_VIEWS environment variable. Base64 encoding ensures the value
contains only alphanumeric characters and safe symbols (+, /, =), completely
eliminating the risk of quote-breaking characters.

**Impact**: This is a preventive fix - the environment variable is not
currently consumed by JavaScript code, so there is no breaking change. When
the JavaScript code is implemented to read this variable, it will need to
base64-decode the value before parsing as JSON.

**Security Best Practice**: Base64 encoding is the most robust solution for
passing arbitrary data through environment variables, as recommended by
security experts for preventing injection attacks.

Related: CWE-78, CWE-89, CWE-94

* Replace base64 encoding with %q formatting and add CodeQL suppression (#11402)

* Initial plan

* fix: replace base64 encoding with %q formatting and add CodeQL suppression

Replace unnecessary base64 encoding with standard %q formatting for
GH_AW_PROJECT_VIEWS environment variable. The original security concern
was invalid - this code generates YAML environment variable declarations,
not shell scripts, so there is no shell injection risk.

Added lgtm[go/unsafe-quoting] suppression comment explaining that %q is
safe in this context because the value is set as a YAML environment
variable, not executed as shell code.

Addresses review feedback in #11401.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

---------

Co-authored-by: GitHub Actions Bot <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
github-actions bot added a commit that referenced this pull request Jan 22, 2026
Fixes code scanning alert #538 (CWE-78, CWE-89, CWE-94)

Changes:
- Replace %q format with base64 encoding for GH_AW_PROJECT_VIEWS
- Add comprehensive tests for base64 encoding with special characters
- Add security tests to verify injection prevention

This eliminates the unsafe quoting vulnerability by encoding JSON
data as base64, which contains only alphanumeric and safe characters.
Even if the value is misused in shell contexts, it cannot cause
injection attacks.
github-actions bot pushed a commit that referenced this pull request Jan 23, 2026
…oting

Fixes code scanning alert #538 (go/unsafe-quoting)

The code was creating a GH_AW_PROJECT_VIEWS environment variable with
JSON data embedded using %q, which CodeQL flagged as unsafe quoting.
However, this environment variable was never consumed by any JavaScript
code - it was dead code.

The actual views configuration is properly passed through the
GH_AW_SAFE_OUTPUTS_PROJECT_HANDLER_CONFIG environment variable
(see compiler_safe_outputs_config.go:602-608), which uses proper
JSON marshaling and %q escaping on line 638.

This fix removes the unused code entirely, eliminating the security
vulnerability without affecting functionality.

CWE-78, CWE-89, CWE-94
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants