45 Commits

Author SHA1 Message Date
google-labs-jules[bot]
9d962e5274 🔒 [security fix] Mask sensitive tokens in GitHub Actions logs
- Added `core.setSecret(token)` to mask the primary GitHub token.
- Added `core.setSecret(githubMcpToken)` to mask the GitHub MCP token.
- Updated `__fixtures__/core.ts` to include the `setSecret` mock.
- Updated `__tests__/main.test.ts` to verify `setSecret` is called for the tokens.
2026-03-10 22:44:58 +00:00
Pet3cy
b7792492cd Merge pull request #12 from Pet3cy/fix-testing-improvement-parse-file-template-variables-6142620025282989819
🧪 [testing improvement] validate non-string file paths in parseFileTemplateVariables
2026-02-25 05:12:54 +01:00
google-labs-jules[bot]
a2600c61b7 test: validate non-string file paths in parseFileTemplateVariables
Add test cases to verify that `parseFileTemplateVariables` correctly
throws an error when a non-string value (e.g. number, boolean, object)
is provided as a file path in the input YAML. This ensures the existing
validation is properly tested.

Co-authored-by: Pet3cy <169947521+Pet3cy@users.noreply.github.com>
2026-02-25 04:12:17 +00:00
Pet3cy
306ffe21b9 Merge pull request #11 from Pet3cy/relax-header-validation-16962389466518057682
🧹 Relax overly restrictive HTTP header name validation
2026-02-24 18:45:30 +01:00
google-labs-jules[bot]
326b9a12f4 chore: relax HTTP header name validation to match RFC 7230
Updated the regex in `src/helpers.ts` to allow all valid characters in an HTTP token (RFC 7230, section 3.2.6), including symbols like `_`, `.`, `!`, and `*`. Previously, the validation was overly restrictive, only allowing alphanumeric characters and hyphens.

Also updated the corresponding unit test in `__tests__/helpers.test.ts` to reflect the change.
2026-02-24 17:44:57 +00:00
Pet3cy
8207a8ca01 Merge pull request #10 from Pet3cy/security-fix-sensitive-data-exposure-logs-8322086360319645856
🔒 [security fix] Fix sensitive data exposure in MCP Inference logs
2026-02-24 18:42:50 +01:00
google-labs-jules[bot]
c6c19e0fb7 🔒 [security fix] Fix sensitive data exposure in logs
- Change core.info to core.debug for model responses in src/inference.ts
- Change core.info to core.debug for tool execution details in src/mcp.ts
- Change core.info to core.debug for custom header logging in src/helpers.ts
- Remove sensitive response previews from error messages in src/inference.ts
- Update tests to reflect changes from core.info to core.debug
2026-02-24 17:42:20 +00:00
Paulo Santos
074e8b294d copilot review: add test for coverage of no params passed 2026-02-13 12:31:45 +00:00
Paulo Santos
6360e0db9b implement passing two action input properties to cover all model scenarios 2026-02-13 12:15:12 +00:00
Paulo Santos
725fb1c850 update max_tokens to max_completion_tokens 2026-02-04 21:29:53 +00:00
Yonatan Golick
15ae50ae2f Add CRLF injection protection for header values
Implement security validation to prevent HTTP header injection attacks:
- Reject header values containing \r or \n characters
- Add comprehensive test coverage for CRLF protection
- Replace multiline YAML test with proper rejection test

Security improvements:
- Validates header values to prevent header injection
- Clear warning messages when values are rejected
- Four new test cases covering LF, CR, CRLF, and multiline scenarios

This addresses a critical security concern where malicious headers
could be injected via newline characters in header values.

All 84 tests passing.
2026-01-18 12:19:43 +02:00
Yonatan Golick
ce720b3d0c Fix header validation per RFC 7230 and add null check
Address Copilot AI feedback:
- Remove underscore support from header names (RFC 7230 compliance)
- Add explicit null check for JSON parsing
- Update validation regex to /^[A-Za-z0-9-]+$/
- Add test case for null value handling
- Update documentation to clarify header name requirements

Changes:
- Header names now only accept alphanumeric characters and hyphens
- Improved error messages for invalid headers
- Added test for null JSON input
- Updated APIM example tests

All 81 tests passing.
2026-01-18 11:35:18 +02:00
Yonatan Golick
6d144ac474 Add custom headers support for API Management integration
This change adds support for custom HTTP headers in AI inference requests,
enabling integration with API Management platforms (Azure APIM, AWS API
Gateway, Kong, etc.) and custom request routing/tracking.

Features:
- New 'custom-headers' input supporting both YAML and JSON formats
- Auto-detection of input format for better UX
- Header name validation (alphanumeric, hyphens, underscores)
- Automatic masking of sensitive headers in logs
- Full backward compatibility (optional parameter)

Changes:
- Added parseCustomHeaders() function in helpers.ts
- Updated InferenceRequest interface with optional customHeaders field
- Modified simpleInference() and mcpInference() to pass headers to OpenAI client
- Added 18 comprehensive test cases
- Updated documentation with examples and use cases

All 80 tests passing. Zero breaking changes.
2026-01-18 11:24:13 +02:00
Maarten van Diemen
bbe0ccb244 Fix failing tests 2025-11-30 22:20:19 +01:00
Maarten van Diemen
ca3b99ea74 Undo changes in tests.
Undo linter change
2025-11-30 22:14:02 +01:00
Maarten van Diemen
8a5d2ea4a1 Merge branch 'main' into feature/pass-toolsets 2025-11-30 22:08:41 +01:00
Sean Goedecke
18d468666d fix: keep response-file temp file for downstream steps
The temporary file created for response-file was being cleaned up
before downstream steps could access it. Now using keep: true to
ensure the file persists until the job completes.

Also added script/ to eslint ignores for the mock server.
2025-11-27 21:06:42 +00:00
Maarten van Diemen
95443f8d18 Merge with main 2025-11-24 13:06:01 +01:00
David Sanders
48f0edec4d feat: support modelParameters in prompt.yaml files 2025-11-23 16:07:11 -08:00
Maarten van Diemen
932a853db4 Initial implementation for passing toolsets 2025-11-02 23:20:24 +01:00
Jessica Rudder
a2fd223fcf Properly clean up tmp files 2025-08-12 14:31:05 -07:00
Jessica Rudder
3ba8e1b39d Replace manual tmp file creation with tmp library which uses security best practices 2025-08-12 13:49:47 -07:00
Sean Goedecke
9133f81330 package 2025-08-06 00:54:19 +00:00
Sean Goedecke
866ae2b5d7 Ensure MCP loops output the right response format
In a tool loop, you can't set response_format because the model needs to
be able to think in plain English. But you still need the final response
to be in the desired format, so we add response_format only on the last
iteration.
2025-08-05 22:06:49 +00:00
Sean Goedecke
4685e0dcd4 Force exit once inference finishes in case we are holding any connections open 2025-08-05 21:42:07 +00:00
Sean Goedecke
18367df745 Merge branch 'main' into sgoedecke/use-openai-sdk 2025-08-05 02:49:44 +00:00
Sean Goedecke
4b5bb5c538 Use OpenAI SDK to avoid setting apiVersion manually 2025-08-05 02:09:17 +00:00
Sean Goedecke
15868b88f4 Allow templating variables from files 2025-08-05 01:32:32 +00:00
Sean Goedecke
3b5da63917 update tests 2025-08-04 22:44:17 +00:00
Marais Rossouw
7e2aa19f3b chore: use github's shared prettier-config 2025-07-24 19:11:15 +10:00
Marais Rossouw
4ba8e6bc1e feat: moves project to using vitest 2025-07-24 18:08:26 +10:00
Sean Goedecke
8f64ac1284 Fixup types and tests 2025-07-21 04:31:06 +00:00
Sean Goedecke
1780121e3b Support .prompt.yml files 2025-07-21 00:11:26 +00:00
Sean Goedecke
4fd6464105 Add read-only MCP support 2025-07-16 02:19:49 +00:00
Sean Goedecke
86c0691fbf Add tests 2025-07-16 00:12:41 +00:00
Matthew Leibowitz
9aac9c75b3 Formatting 2025-05-26 04:03:09 +02:00
Matthew Leibowitz
eb37c9a493 Formatting 2025-05-26 03:46:39 +02:00
Matthew Leibowitz
3e924fe06b Refactor the prompt reading logic 2025-05-25 19:08:36 +02:00
Matthew Leibowitz
96e0fda3bb Improve the tests a bit
Removed the duplicate code and just use helper functions.
2025-05-24 04:07:29 +02:00
Matthew Leibowitz
91ba53d8b4 feat: Add system-prompt-file input for file-based system prompts
This enhancement adds the ability to load a system prompt from a file, similar to
the existing prompt-file functionality, providing more flexibility when working with
complex system prompts.

Key changes:
- Added new `system-prompt-file` input to action.yml with proper description
- Updated main.ts implementation to handle file-based system prompts with:
  - File existence checking and appropriate error handling
  - Proper precedence (system-prompt-file takes priority over system-prompt)
  - Consistent error messages with existing prompt-file implementation

Test coverage added:
- Basic usage: Test verifies system-prompt-file loads content correctly
- Error handling: Test ensures proper errors when system-prompt-file doesn't exist
- Precedence: Test confirms system-prompt-file overrides system-prompt when both exist
- Integration: Test validates both prompt-file and system-prompt-file work together
- Max tokens: Test verifies custom token limits are properly passed to the model
- Testing infrastructure: Improved mock implementations that detect unexpected calls

Documentation:
- Updated README.md with system-prompt-file in inputs table
- Added dedicated usage example for system-prompt-file
- Fixed formatting in inputs table

CI/CD:
- Updated workflow to test system-prompt-file functionality with actual file content

This feature maintains backward compatibility while adding a useful option
for workflows that need to use more complex system prompts stored in files.
2025-05-24 03:50:15 +02:00
Aiqiao Yan
1c557cdc25 react to feedback 2025-04-17 20:23:07 +00:00
Aiqiao Yan
f1591cfa68 add test 2025-04-17 20:13:47 +00:00
Aiqiao Yan
43f6a3831f read prompt from file and print output to file 2025-04-17 17:41:35 +00:00
Sean Goedecke
6932781e1f fixup tests and npm run all 2025-04-06 23:21:29 +00:00
Sean Goedecke
0905e36402 Initial commit 2025-04-04 07:27:58 +11:00