-
Notifications
You must be signed in to change notification settings - Fork 316
fix(writers/python): prevent code injection via x-ms-enum description #7735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+145
−4
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1a7033d
fix(writers/python): prevent code injection via x-ms-enum description…
MIchaelMainer fd6f19c
fix(writers/python): prevent code injection via x-ms-enum description…
MIchaelMainer d65571d
Merge branch 'fix/python-enum-description-injection' of https://githu…
MIchaelMainer 3592adf
docs: add instructions for agents to run tests and fix failing tests …
MIchaelMainer b91b284
test(python): align deprecation warning assertion with description sa…
MIchaelMainer 7594334
docs: add central Copilot policies and validation checklist for repos…
MIchaelMainer 33c091c
Merge branch 'main' into fix/python-enum-description-injection
MIchaelMainer 7580cf2
fix: add Nerdbank.MessagePack explicit reference and note vulnerabili…
MIchaelMainer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| --- | ||
| applyTo: | ||
| - "**" | ||
| --- | ||
|
|
||
| # Kiota Central Copilot Policies | ||
|
|
||
| This file defines repository-wide defaults for Copilot behavior. It is always applied. | ||
|
|
||
| ## Scope and precedence | ||
|
|
||
| 1. Apply this file for all work in the repository. | ||
| 2. Also apply any matching files under `.github/instructions/`. | ||
| 3. If guidance conflicts, follow the more specific instruction file for the target paths. | ||
|
|
||
| ## Required defaults | ||
|
|
||
| 1. Keep changes minimal and targeted. Avoid unrelated refactors. | ||
| 2. Preserve existing style, naming, and public behavior unless the task requires changes. | ||
| 3. Add or update tests for behavior changes or bug fixes. | ||
| 4. Before proposing a commit, run relevant tests and ensure they pass. | ||
| 5. If tests fail, fix issues and re-run tests before considering the work complete. | ||
| 6. Prefer non-destructive actions and do not revert unrelated local changes. | ||
|
|
||
| ## Security review defaults | ||
|
|
||
| When modifying code generation or writer/refiner logic, treat schema-derived values as untrusted and ensure literal-context sanitization at the emission site. | ||
|
|
||
| Use language/literal-appropriate sanitizers from `src/Kiota.Builder/Writers/StringExtensions.cs` (and Dart convention helpers where applicable). | ||
|
|
||
| ## Writer hardening reminder | ||
|
|
||
| For writer changes that emit schema-derived text into generated code, ensure hostile content is escaped and covered by regression tests in `tests/Kiota.Builder.Tests/Writers/`. | ||
|
|
||
| ## Validation checklist | ||
|
|
||
| Before finishing implementation work: | ||
|
|
||
| 1. Build affected projects. | ||
| 2. Run targeted tests first, then broader tests if impact is unclear. | ||
| 3. Confirm no new warnings/errors were introduced by the change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| --- | ||
| applyTo: | ||
| - "**" | ||
| --- | ||
|
|
||
| # Pre-Commit Testing Requirements | ||
|
|
||
| Before creating any git commit, agents **must** run the relevant tests and verify they pass. | ||
|
|
||
| ## Rules | ||
|
|
||
| 1. **Always run tests before committing.** Never commit code that has not been validated by running the relevant test suite. | ||
| 2. **Scope tests appropriately.** Run at minimum the tests related to the files you changed. If unsure which tests cover your changes, run the full test project that contains the modified code. | ||
| 3. **Fix failing tests before committing.** If tests fail, diagnose and fix the issue. Do not commit with known test failures unless explicitly instructed by the user. | ||
| 4. **Re-run tests after fixing failures.** After making corrections, run tests again to confirm they pass. | ||
|
|
||
| ## Test Commands | ||
|
|
||
| | Project | Command | | ||
| |---------|---------| | ||
| | Kiota.Builder | `dotnet test tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj` | | ||
| | VS Code Extension | `cd vscode/packages && npm test` | | ||
|
|
||
| Use `--filter "FullyQualifiedName~ClassName"` to scope .NET tests to specific test classes when a full run is unnecessary. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.