Title: Validate config key names before writing by Byron · Pull Request #2142 · gitpython-developers/GitPython · GitHub
Open Graph Title: Validate config key names before writing by Byron · Pull Request #2142 · gitpython-developers/GitPython
X Title: Validate config key names before writing by Byron · Pull Request #2142 · gitpython-developers/GitPython
Description: Tasks refackiew Codex created this PR on behalf of Byron. Byron will review it before any merge decision. Summary Reject CR, LF, and NUL in config section and option names before writing. Apply the same guard to add_section(), set(), set_value(), add_value(), and destination names in rename_section(). Add a regression test for section and option name injection while confirming safe writes still work. Git reference Git itself rejects config keys containing newlines. I checked Git source commit 94f057755b7941b321fd11fec1b2e3ca5313a4e0, where config.c reports invalid keys containing newlines, and local git version 2.50.1 rejects newline-bearing config keys. Validation uv run --with gitdb --with pytest --with pytest-cov --with ddt --with pytest-mock --with pytest-instafail --with pytest-sugar python -m pytest test/test_config.py::TestBase::test_set_value_rejects_unsafe_section_and_option_names --no-cov uv run --with gitdb --with pytest --with pytest-cov --with ddt --with pytest-mock --with pytest-instafail --with pytest-sugar python -m pytest test/test_config.py --no-cov uv run --with ruff ruff check git/config.py test/test_config.py codex review --uncommitted codex review --commit e226e42b38c7684cb10e1d13f264b08977892039
Open Graph Description: Tasks refackiew Codex created this PR on behalf of Byron. Byron will review it before any merge decision. Summary Reject CR, LF, and NUL in config section and option names before writing. Appl...
X Description: Tasks refackiew Codex created this PR on behalf of Byron. Byron will review it before any merge decision. Summary Reject CR, LF, and NUL in config section and option names before writing. Appl...
Opengraph URL: https://github.com/gitpython-developers/GitPython/pull/2142
X: @github
Domain: redirect.github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:f769ba09-c4ff-174b-d2f3-e396c5b962bf |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9396:206F88:44B8851:5F8B046:6A54E224 |
| html-safe-nonce | a4047c4385907cff8da1f8b67efe48a58cc823d889055af5b5401f08730a8c53 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Mzk2OjIwNkY4ODo0NEI4ODUxOjVGOEIwNDY6NkE1NEUyMjQiLCJ2aXNpdG9yX2lkIjoiNjYyNTcyNTMwNDkwNzU1NTM2NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7fd247901624a7305c4afbd3098c08fba331caa6b12924b123b760a5d1125080 |
| hovercard-subject-tag | pull_request:3630868062 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/gitpython-developers/GitPython/pull/2142/files |
| twitter:image | https://avatars.githubusercontent.com/u/63622?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/63622?s=400&v=4 |
| og:image:alt | Tasks refackiew Codex created this PR on behalf of Byron. Byron will review it before any merge decision. Summary Reject CR, LF, and NUL in config section and option names before writing. Appl... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | a556215b071af6609619e2bbe6f00bdfbf0812ad723b1ae6c301858a7a829f54 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/gitpython-developers/GitPython git https://github.com/gitpython-developers/GitPython.git |
| octolytics-dimension-user_id | 503709 |
| octolytics-dimension-user_login | gitpython-developers |
| octolytics-dimension-repository_id | 1126087 |
| octolytics-dimension-repository_nwo | gitpython-developers/GitPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1126087 |
| octolytics-dimension-repository_network_root_nwo | gitpython-developers/GitPython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 00f21e38abd06cd6752db5c227083570f72fdb6c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width