Skip to content

custom engine support in includes#475

Merged
pelikhan merged 7 commits intogithub:mainfrom
githubnext:custom-engine-testing
Sep 6, 2025
Merged

custom engine support in includes#475
pelikhan merged 7 commits intogithub:mainfrom
githubnext:custom-engine-testing

Conversation

@pelikhan
Copy link
Contributor

@pelikhan pelikhan commented Sep 6, 2025

Allow engine configuration in includes files.

Copilot AI and others added 4 commits September 5, 2025 16:54
…-inference (#85)

* Initial plan

* Create AI Inference with GitHub Models agentic workflow

- Add ai-inference-github-models.md workflow using actions/ai-inference
- Implement multi-model support with gpt-4o-mini as default
- Add context-aware prompts for issues and pull requests
- Include safe outputs for automated comment posting
- Create usage examples and documentation
- Successfully compile and test the workflow

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

* Address PR review feedback: move docs, fix permissions, use prompt-file, remove PR support

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

* Remove documentation file and add comprehensive comments to workflow file

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

* Address PR feedback: simplify workflow with single issue input and fixed model

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

* Address PR feedback: rename input to issue_number, add GitHub expression, remove documentation

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

* Handle both issue events and workflow_dispatch inputs in AI inference prompt

- Added dynamic prompt creation step that determines issue number based on event type
- Uses github.event.issue.number for automatic issue events
- Uses github.event.inputs.issue_number for manual workflow_dispatch events
- Addresses comment requesting OR condition for both input sources

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

* Revert previous commit as requested

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: Peli de Halleux <pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review September 6, 2025 04:09
pelikhan and others added 3 commits September 5, 2025 21:09
…87)

* Initial plan

* Sort with section keys for stable output in engine step conversion

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>
@pelikhan pelikhan merged commit a996eb1 into github:main Sep 6, 2025
4 checks passed
@pelikhan pelikhan deleted the custom-engine-testing branch September 6, 2025 04:34
github-actions bot added a commit that referenced this pull request Jan 7, 2026
**Alert Numbers**: #476, #475
**Severity**: Medium
**Rule**: G304 - Potential file inclusion via variable

## Vulnerability Description

Two instances of potential path traversal vulnerabilities were identified in `pkg/cli/logs_metrics.go` at lines 250 and 373. The `os.ReadFile()` function was called with a variable path (`resolvedAgentOutputFile`) that could potentially be manipulated to read files outside the intended directory, without proper path sanitization.

## Fix Applied

Added path sanitization using `filepath.Clean()` before reading files in both the `extractMissingToolsFromRun()` and `extractNoopsFromRun()` functions:

1. Line 250 (Alert #476): Added `cleanPath := filepath.Clean(resolvedAgentOutputFile)` before the `os.ReadFile()` call in `extractMissingToolsFromRun()`
2. Line 373 (Alert #475): Added `cleanPath := filepath.Clean(resolvedAgentOutputFile)` before the `os.ReadFile()` call in `extractNoopsFromRun()`

The sanitized path is now used consistently in all subsequent operations including file reads and error messages.

## Security Best Practices

- **Path Normalization**: `filepath.Clean()` normalizes the path by removing redundant separators, resolving `.` and `..` elements, preventing path traversal attacks
- **Defense in Depth**: While the paths are constructed from trusted sources, this adds an additional layer of security
- **Consistent Usage**: Updated all references to use the sanitized path variable

## Testing Considerations

- Verify that log metrics extraction continues to work correctly for workflow runs
- Test with various directory structures and path formats
- Ensure error messages display the correct sanitized paths
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants