Skip to content

fix: remove committed oauth secrets, correct package typos, enable tests, rewrite readme - #42

Merged
houko merged 3 commits into
mainfrom
chore/cleanup-secrets-tests-and-readme
Sep 9, 2026
Merged

fix: remove committed oauth secrets, correct package typos, enable tests, rewrite readme#42
houko merged 3 commits into
mainfrom
chore/cleanup-secrets-tests-and-readme

Conversation

@houko

@houko houko commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Follow-up to #41, which was merged before these three commits landed. Covers the repository issues found while doing that upgrade, plus a Readme rewrite.

Committed OAuth secrets

core/src/main/resources/config/oauth.properties contains real third-party login credentials — app IDs and secrets for QQ, Sina Weibo, Baidu, Renren, OSChina and Douban. They have been sitting in this public repository since 2016. Nothing in the Java sources references the file or any of those keys, so it is dead config that has been leaking credentials for nine years.

This commit replaces every value with a placeholder and adds a note suggesting environment-variable injection.

This does not undo the exposure. The secrets remain in git history, the repository is public, and it has forks. Sanitizing the current file only stops future readers of the working tree. The only real remediation is revoking and reissuing each app secret at its provider. I did not rewrite git history — that is destructive, breaks every fork and clone, and is your call to make, not mine.

Package name typos

  • info.xiaomo.anysc to info.xiaomo.async
  • info.xiaomo.core.untils to info.xiaomo.core.utils

Both were misspelled since the original commit. Mechanical rename, references updated, build verified.

Tests were never running

The parent POM configured surefire with <skipTests>true</skipTests>, so no test in the project has ever executed. Now that there is a real build CI (added in #41), that switch is removed.

Removing it exposed the reason it was probably set: RabbitMqTests has no @SpringBootTest, so its @Autowired sender field is null and the test would NPE the moment it ran. Fixed properly rather than papered over:

  • added @SpringBootTest(classes = RabbitMqMain.class)
  • added @Disabled with an explicit reason — it needs a reachable RabbitMQ broker — instead of leaving a test that is guaranteed to fail
  • moved from package test to info.xiaomo.rabbitmq to match the main source layout

Tests run: 1, Failures: 0, Errors: 0, Skipped: 1.

Readme rewrite

The Readme was missing the single thing a reader of this project most needs: what each of the 16 modules actually demonstrates. Added a module table covering the demonstrated technology, the entry-point class, and which external services each module requires.

Also corrected:

  • tech stack and versions updated to what the project actually uses now, and the port difference (socket listens on 8081, everything else on 8080) is stated explicitly
  • quick-start section gives copy-pasteable mvn and java commands — both were actually run and verified, including mvn spring-boot:run -pl order
  • API documentation URLs point at springdoc's /swagger-ui.html and /v3/api-docs; the old knife4j /doc.html no longer exists after build: upgrade all dependencies to latest (Spring Boot 2.5 to 4.1) #41
  • the Gitee mirror link used the retired git.oschina.net domain, updated to gitee.com (verified the mirror still resolves)
  • the issue-feedback list was numbered 1, 2, 4
  • the License section pasted the entire MIT text inline; it now links to LICENSE
  • badges: the dead Travis badge was already replaced in build: upgrade all dependencies to latest (Spring Boot 2.5 to 4.1) #41; added CodeQL, Spring Boot and JDK badges
  • the changelog was a flat 30-line list mixing 2017 and 2020 entries; the Readme now keeps only major milestones and links to changeLog.md, with the full record added there
  • fixed a typo in changeLog.md: http://localhost:808/doc.html was missing a digit

Verification

mvn clean install passes on all 17 modules with tests enabled.

Not done

I deliberately left these alone rather than sweeping them into this PR:

  • 26 printStackTrace calls and 32 System.out.println calls. These are stylistic issues in demo code; rewriting them would produce a large diff with no behavioural benefit and would bury the substantive changes above.
  • .travis.yml is kept. travis-ci.org shut down in 2021 so the config is almost certainly dead, but it is not blocking anything and deleting it is your decision.

core/src/main/resources/config/oauth.properties 里提交了 QQ / 微博 / 百度 / 人人 / 开源中国 / 豆瓣的真实第三方登录密钥, 自 2016 年起一直暴露在公开仓库中。该文件没有被任何 java 代码引用。现全部替换为占位符。

注意: 这些密钥仍存在于 git 历史中, 本次提交并不能撤销泄露, 必须到各平台吊销重发。

同时修正两处包名拼写错误:
- info.xiaomo.anysc -> info.xiaomo.async
- info.xiaomo.core.untils -> info.xiaomo.core.utils
parent pom 里的 surefire 配置了 skipTests=true, 全项目的测试从来不会执行。既然现在有了构建 CI, 这个开关就该拿掉。

唯一的测试 RabbitMqTests 此前没有 @SpringBootTest, @Autowired 的 sender 实际是 null, 一旦执行就会 NPE —— 正是因为测试从不执行, 这个问题一直没有暴露。现改为:
- 补上 @SpringBootTest(classes = RabbitMqMain.class)
- 加 @disabled 并注明需要一台可连接的 RabbitMQ, 而不是留一个必然失败的用例
- 从 package test 移到 info.xiaomo.rabbitmq, 与主代码包结构对齐
原 Readme 缺少这个项目最需要的东西: 16 个模块分别在演示什么。补上模块一览表(演示内容 / 启动类 / 需要的外部服务), 并修正了若干过时或错误的内容:

- 技术栈与版本更新到当前实际值, 端口差异(socket 用 8081)明确写出
- 快速开始给出可直接复制的 mvn / java 命令, 均已实测
- API 文档地址更新为 springdoc 的 /swagger-ui.html 与 /v3/api-docs
- 码云链接的 git.oschina.net 旧域名更新为 gitee.com
- 问题反馈的编号 1/2/4 修正, License 由整段正文改为指向 LICENSE 文件
- 徽章补上 CodeQL / Spring Boot / JDK, 并指向新的构建 workflow
- 更新日志改为只保留主要节点并链到 changeLog.md, 完整记录同步补进 changeLog.md
- 顺带修掉 changeLog.md 里 http://localhost:808/doc.html 少一位数字的笔误
@houko
houko merged commit f52d94b into main Sep 9, 2026
2 checks passed
@houko
houko deleted the chore/cleanup-secrets-tests-and-readme branch September 9, 2026 01:12
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.

1 participant