Skip to content

Feature/add GitHub lfs - #79

Open
Zherphy wants to merge 5 commits into
release/1230from
feature/add-github-lfs
Open

Feature/add GitHub lfs#79
Zherphy wants to merge 5 commits into
release/1230from
feature/add-github-lfs

Conversation

@Zherphy

@Zherphy Zherphy commented Mar 25, 2026

Copy link
Copy Markdown
Collaborator

描述

相关 Issue

变更类型

  • Bug 修复
  • 新功能
  • 代码重构
  • 文档更新
  • 样式改进
  • 性能优化
  • 测试相关
  • 其他

@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

Zherphy, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown

Linking Issue Notice

@Zherphy , the pull request must be linked to at least one issue.
If an issue has already been linked, but the needs-issue label remains, you can remove the label by commenting /check-issue .

@opensourceways-robot

Copy link
Copy Markdown

开始门禁检查,等门禁检查通过后可以合入

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
安全编码扫描
漏洞扫描
Check代码检查
开源license合规扫描
UT测试覆盖率
开发阶段设计文档检查
流水线链接 点击跳转查看日志

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态 日志
DT覆盖率 36.2% 查看日志
敏感信息扫描 查看日志
开源代码漏洞扫描 查看日志
Check代码检查 查看日志
安全编码扫描 查看日志
流水线链接 点击跳转

@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

Zherphy, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-robot

Copy link
Copy Markdown

开始门禁检查,等门禁检查通过后可以合入

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
安全编码扫描
漏洞扫描
Check代码检查
开源license合规扫描
DT覆盖率
开发阶段设计文档检查
流水线链接 点击跳转查看日志

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态 日志
DT覆盖率 44.1% 查看日志
敏感信息扫描 查看日志
开源代码漏洞扫描 查看日志
Check代码检查 查看日志
安全编码扫描 查看日志
流水线链接 点击跳转

@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

Zherphy, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
安全编码扫描
漏洞扫描
Check代码检查
开源license合规扫描
UT测试覆盖率
开发阶段设计文档检查
流水线链接 点击跳转查看日志

@opensourceways-bot

Copy link
Copy Markdown

Welcome To opensourceways Community

Hey @Zherphy , thanks for your contribution to the community.

Bot Usage Manual

I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands.

Contact Guide

If you have any questions, please contact the SIG: infratructure ,
and any of the maintainers: @GeorgeCao-hw, @TangJia025, @pkking, @zhongjun2 ,
and any of the committers: @Goalina, @Zherphy, @tfhddd .

@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

Zherphy, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
安全编码扫描
漏洞扫描
Check代码检查
开源license合规扫描
UT测试覆盖率
开发阶段设计文档检查
流水线链接 点击跳转查看日志

@Zherphy
Zherphy force-pushed the feature/add-github-lfs branch from 64f207b to a5d4f57 Compare May 28, 2026 01:39
@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

Zherphy, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
安全编码扫描
漏洞扫描
Check代码检查
开源license合规扫描
UT测试覆盖率
开发阶段设计文档检查
流水线链接 点击跳转查看日志

@Zherphy
Zherphy force-pushed the feature/add-github-lfs branch from a5d4f57 to a6ea029 Compare May 28, 2026 02:03
@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

Zherphy, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
安全编码扫描
漏洞扫描
Check代码检查
开源license合规扫描
UT测试覆盖率
开发阶段设计文档检查
流水线链接 点击跳转查看日志

Add support for verifying GitHub user permissions on the LFS batch
endpoint. A new GITHUB_MODEL config switch selects between the existing
Gitee/GitCode authorization+metadata path and the GitHub authorization
+metadata path within the same /objects/batch route.

Key changes:
- auth: new GitHub auth module with org whitelist and permission check
- config: new DefaultGithubToken and GithubModel fields
- server: handleBatch dispatches to GitHub or Gitee auth/metadata based
  on GITHUB_MODEL; IsGithubAuthorized wired through Options
- main: register GithubAuth() as IsGithubAuthorized
- config.example.yml: document GIT_CODE_SWITCH and GITHUB_MODEL
- ignore local coverage and test output artifacts
@Zherphy
Zherphy force-pushed the feature/add-github-lfs branch from a6ea029 to 44db7ce Compare June 3, 2026 00:32
@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

Zherphy, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
安全编码扫描
漏洞扫描
Check代码检查
开源license合规扫描
UT测试覆盖率
开发阶段设计文档检查
流水线链接 点击跳转查看日志

- gitleaks: replace demo API keys in .ai/skills/local-ci-go/ docs with
  low-entropy placeholders (sk-YOUR_API_KEY_HERE), eliminating 5 false
  positives from the generic-api-key rule
- bandit: fix command injection in scripts/lfsNameQuery.py force_remove
  (B605 HIGH) by removing os.system + f-string; use shutil.which("git")
  for subprocess invocations (B607); annotate safe list-args subprocess
  calls with # nosec B603/B404
- trivy: upgrade Go 1.24.11 -> 1.26.5 in go.mod / workflow-validation.yml
  to fix 26 stdlib CVEs (crypto/tls, net/url, html/template, etc.); sync
  version references in CLAUDE.md and .ai/architect docs

Add lessons-learned LL-006/007/008 and anti-patterns AP-004/005 to
prevent recurrence per CLAUDE.md rule 6.
@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

Zherphy, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
安全编码扫描
漏洞扫描
Check代码检查
开源license合规扫描
UT测试覆盖率
开发阶段设计文档检查
流水线链接 点击跳转查看日志

Previous commit only replaced placeholders in the working tree, but
gitleaks scans the full git history (166 commits). The original demo
API keys still exist in commit 44db7ce, so PR #83 gate re-failed.

Add .gitleaksignore with the 5 fingerprints from 44db7ce (all inside
.ai/skills/local-ci-go/ example docs). Fingerprints are stable as
long as history is not rewritten.

Also correct LL-006: gitleaks scans git log --all, so working-tree
edits alone are insufficient once a secret is committed; the
.gitleaksignore file is the only low-risk cleanup path (short of
force-pushing rewritten history).
@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

Zherphy, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
安全编码扫描
漏洞扫描
Check代码检查
开源license合规扫描
UT测试覆盖率
开发阶段设计文档检查
流水线链接 点击跳转查看日志

Add unit tests for the GitHub LFS integration paths that were left
uncovered (61.8% incremental coverage < 80% gate):

server/server_test.go:
- TestAddGithubMetaData (+ AfterFuncRecover variant)
- TestAddMetaData (gitee / atomGit / insert-error, + AfterFuncRecover)
- TestDealWithGithubAuthError (no-auth / invalid-format / 401/403/500)
- TestHandleBatch_GithubModel, TestHandleBatch_InvalidOwnerRepo
- TestHandleGithubBatch_InvalidOwnerRepo, _DownloadSuccess

auth/github_auth_test.go:
- TestVerifyGithubDownload_NonCollaboratorFallback{Pass,Forbidden}
- TestVerifyGithubDownload_InsufficientPermission
- TestVerifyGithubUpload_APIError

Key function coverage after: addGithubMetaData 0% -> 100%,
addMetaData 0% -> 100%, handleBatch 63.3% -> 80%,
dealWithGithubAuthError 50% -> 95.5%, handleGithubBatch 68.2% -> 95.5%,
verifyGithubUpload/Download/Delete 100%.

The AfterFunc variants monkey-patch time.AfterFunc to run the
callback immediately and use a panicking checkRepoOidName mock to
exercise the defer/recover branch inside the async metadata step.
@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

Zherphy, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
安全编码扫描
漏洞扫描
Check代码检查
开源license合规扫描
UT测试覆盖率
开发阶段设计文档检查
流水线链接 点击跳转查看日志

PR #83 gate reports Python(Inc) ERROR because diff-cover cannot find
coverage.xml -- the project had no pytest infrastructure before, so
the bandit fix in scripts/lfsNameQuery.py had no coverage data to
analyze.

Changes:
- scripts/lfsNameQuery.py: move `sys.exit(1)` for missing git binary
  from module top level into _require_git() called from main(), so
  pytest can import the module in environments without git
- scripts/test_lfsNameQuery.py: 22 test cases mocking subprocess.run;
  covers force_remove, _handle_remove_readonly, branch_has_lfsconfig,
  clone_repo_skip_lfs, get_all_branches_lfs_mapping and main
  (88% branch coverage)
- pytest.ini: testpaths=scripts, addopts include --cov=scripts
  --cov-report=xml:coverage.xml --cov-branch, exclude venv/.ai
- requirements-dev.txt: pytest>=7.4 and pytest-cov>=4.1 (ASCII-only
  to avoid Windows GBK decode error during pip install)
- .github/workflows/workflow-validation.yml: new python-test job
  (setup-python 3.11 + pytest + upload coverage.xml artifact)
- .gitignore: exclude coverage.xml, .coverage, .pytest_cache/,
  __pycache__/, *.pyc, venv/, .venv/

Local: `python -m pytest` -> 22 passed; coverage.xml generated at repo
root; `go test ./...` still passes.
@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

Zherphy, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedpypi/​pytest@​8.4.29099100100100
Addedpypi/​pytest-cov@​6.3.0100100100100100

View full report

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.

3 participants