fix: remove committed oauth secrets, correct package typos, enable tests, rewrite readme - #42
Merged
Merged
Conversation
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 少一位数字的笔误
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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.propertiescontains 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.anysctoinfo.xiaomo.asyncinfo.xiaomo.core.untilstoinfo.xiaomo.core.utilsBoth 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:
RabbitMqTestshas no@SpringBootTest, so its@Autowiredsenderfield is null and the test would NPE the moment it ran. Fixed properly rather than papered over:@SpringBootTest(classes = RabbitMqMain.class)@Disabledwith an explicit reason — it needs a reachable RabbitMQ broker — instead of leaving a test that is guaranteed to failtesttoinfo.xiaomo.rabbitmqto match the main source layoutTests 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:
socketlistens on 8081, everything else on 8080) is stated explicitlymvnandjavacommands — both were actually run and verified, includingmvn spring-boot:run -pl order/swagger-ui.htmland/v3/api-docs; the old knife4j/doc.htmlno longer exists after build: upgrade all dependencies to latest (Spring Boot 2.5 to 4.1) #41git.oschina.netdomain, updated togitee.com(verified the mirror still resolves)LICENSEchangeLog.md, with the full record added therechangeLog.md:http://localhost:808/doc.htmlwas missing a digitVerification
mvn clean installpasses on all 17 modules with tests enabled.Not done
I deliberately left these alone rather than sweeping them into this PR:
printStackTracecalls and 32System.out.printlncalls. 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.ymlis 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.