sonar+gitlab提交阻断 增量扫描

通过本文,您将可以学习到 sonarqube、git\gitlab、shell、sonar-scanner、sonarlint

一、前言

 sonarqube 是一款开源的静态代码扫描工具。

实际生产应用中,sonarqube 如何落地,需要考虑以下四个维度:

1、规则的来源

现在规则的来源主要有三个途径:

(1)sonar way 官方内置规则,支持多种语言

(2)应用市场插件

(3)自定义规则插件

自定义规则插件缺点是难度大、开发周期长、版本迭代兼容要自己维护,优点是可定制化、灵活性较高。

2、扫描的分支

sonarqube 社区版只支持对 main 或者叫 master 这一个分支进行扫描。不过可通过导入插件,增加对多分支的支持。

3、全量扫描or增量扫描

全量扫描是针对整个工程代码进行扫描。这是 sonarqube 默认的扫描行为。

增量扫描是针对当次提交代码进行扫描。需要自己开发 shell 脚本支持。

全量扫描的缺点是,每次都要针对整个工程代码进行扫描,扫描时间长。我能不能只针对我当前提交的代码进行扫描呢?这便是增量扫描。增量扫描的缺点是,开发难度大。

4、扫描的时机

现在主流的接入方式,有三种扫描时机:

(1)Jenkins流水线 git 拉取代码后,maven 构建项目前扫描。

扫描失败,中止流水线。

(2)gitlab CI 流水线

与 Jenkins 流水线类似,也是扫描失败,中止流水线。

(3) git commit

git 提交代码时触发扫描。包括客户端钩子和服务端钩子。

客户端钩子——pre-commit。开发人员 git commit 提交代码到本地仓库时触发扫描,扫描完获取报告,失败则拒绝提交。

服务端 git hook 分为三种,分别是:

  • pre-receive(推送前)
  • update
  • post-receive(推送后)

这三个步骤就是我们本地 push 完代码服务端要做的事情,如图所示:

从质量保证 QA(Quality Assurance)的角度来说,代码扫描的时机,越早越好。如果是到项目构建的时候再来扫描,扫描不通过,就得打回去开发重新修改,修改完重新测试,重新启动流水线构建,整个周期会被拉长。

所以 pre-commit 和 pre-receive 的效果,会比代码已经进入仓库了,再来扫描的 Jenkins流水线、gitlab CI 流水线要好。

5、服务端or客户端?

服务端扫描 pre-receive 好,还是客户端扫描 pre-commit 好呢?

答案显而易见,服务端扫描好。

因为客户端扫描严重依赖开发人员本地环境下的 pre-commit 文件,如果这个文件被开发人员删除了,那客户端扫描无从谈起。而且如果扫描依赖一些软件,如 sonar-scanner,则每个开发的本地环境都需要安装,这个在项目比较大,开发人员比较多的时候,很难做到协调一致。

本文采用 pre-receive 钩子的方式,支持增量扫描与多分支扫描。

二、环境准备

1、一台装有 gitlab 的服务器。

gitlab 的安装,可以参考我的博文。docker 安装跟 Linux 裸机安装有所不同,推荐使用 docker 安装。 

docker 下安装 gitlab_gitlab docker 安装没有initial_root_password文件-CSDN博客

2、一台装有 sonarqube 9.9 LTS 的服务器。

sonarqube 的安装,可以参考我的博文。docker compose 下安装 sonarqube(带多分支插件)_docker-compose sonarqube-CSDN博客

三、步骤

1、安装 sonar-scanner

  • gitlab 是 docker 安装的情况

将 sonar-scanner-cli-5.0.1.3006-linux.zip 上传到 gitlab 服务器某一个文件夹下。

就比如 /usr/local/sonar

# 安装 unzip 命令
yum -y install unzip# 解压 sonar-scanner-cli-5.0.1.3006-linux.zip
unzip sonar-scanner-cli-5.0.1.3006-linux.zip# 给文件夹重命名
mv sonar-scanner-cli-5.0.1.3006-linux.zip sonar-scanner# 查看当前有多少运行中的容器
docker ps# 将 sonar-scanner 文件夹内容拷贝进 gitlab 容器 /usr/local/sonar-scanner 下  
docker cp sonar-scanner gitlab:/usr/local/sonar-scanner

# 进入容器,查看 sonar-scanner 文件夹是否拷贝到位
docker exec -it gitlab /bin/bash
cd /usr/local
ls
# 修改 sonar-scanner 配置文件
cd sonar-scanner/conf
vi sonar-scanner.properties

sonar-scanner.properties 配置内容如下

#Configure here general information about the environment, such as SonarQube server connection details for example
#No information about specific project should appear here#----- Default SonarQube server
# 该项可配可不配
sonar.host.url=http://你的sonarqubeIP:9000#----- Default source code encoding
sonar.sourceEncoding=UTF-8

 至此,sonar-scanner 安装完成。

  • gitlab 是 Linux 裸机安装的情况

2、在 gitlab 管理中心找到项目的相对路径

以 root 用户登录 gitlab

拼接上 gitlab 的安装目录,就是项目的绝对路径

就比如我的 gitlab 是 docker 安装的,默认安装于 /srv/gitlab

则我的项目 sonar-test,存放于宿主机目录

这个路径,其实是会挂载进容器的(这个后面就能知道)

3、创建服务端 hook 文件

在刚才找到的项目路径下,创建 custom_hooks 文件夹和 pre-receive 文件

# 创建 custom_hooks 文件夹
mkdir custom_hooks
# 进入 custom_hooks 文件夹
cd custom_hooks
# 创建 pre-receive 文件
touch pre-receive
# 修改 pre-receive 文件
vim pre-receive

pre-receive 文件内容如下:

#!/bin/bashecho "开始代码扫描..."GIT_VERSION=`git version`
echo "git版本是:$GIT_VERSION"# 获取当前路径
BASE_PATH=`pwd`
echo "当前路径是:$BASE_PATH"ACCOUNT=`whoami`
echo "当前账户是:$ACCOUNT"# 从标准输入流读入参数
read normalInput
ARR=($normalInput)
OLD_REVISION=${ARR[0]}
CURRENT_REVISION=${ARR[1]}
BRANCH=${ARR[2]}echo "旧修订ID:$OLD_REVISION"
echo "新修订ID:$CURRENT_REVISION"echo "当前项目:$GL_PROJECT_PATH"
PROJECT_NAME=$(echo $GL_PROJECT_PATH | awk 'BEGIN{FS="/"}{print $NF}')
echo "项目名称:$PROJECT_NAME"echo "当前分支:$BRANCH"
BRANCH_NAME=$(echo $BRANCH | awk 'BEGIN{FS="/"}{print $NF}')
echo "分支名称:$BRANCH_NAME"export SONAR_SCANNER=/usr/local/sonar-scanner
PATH=$SONAR_SCANNER/bin:$PATH
export PATHif [ $BRANCH_NAME = "develop" ]; then# 过滤出当前提交中的 java 文件FILES=`git diff --name-only $OLD_REVISION $CURRENT_REVISION  | grep -e "\.java$"`if [ -n "$FILES" ]; thenSONARDIR=$BASE_PATH/"sonar"mkdir -p "${SONARDIR}"TEMPDIR=$BASE_PATH/"tmp"for FILE in ${FILES}; do# 创建目录并舍弃输出mkdir -p "${TEMPDIR}/`dirname ${FILE}`" >/dev/null# 创建文件git show $CURRENT_REVISION:$FILE > ${TEMPDIR}/${FILE}done;echo "进入临时文件夹"cd $TEMPDIRpwdSONAR_USER_HOME=$SONARDIR sonar-scanner -Dsonar.language=java -Dsonar.projectKey=$PROJECT_NAME -Dsonar.host.url=http://你的sonarqubeIP:端口 -Dsonar.login=你的项目Token -Dsonar.branch.name=$BRANCH_NAME -Dsonar.projectVersion=1.0 -Dsonar.java.binaries=./ -Dsonar.scm.disabled=truesleep 5srt=$(curl -u '你的项目Token:' http://你的sonarqubeIP:端口/api/qualitygates/project_status?projectKey="$PROJECT_NAME"\&branch="$BRANCH_NAME" | awk -F ":" '{print $3}' | awk -F "," '{print $1}')echo "代码检测结果$rt"echo "删除临时文件夹"rm -rf $TEMPDIRif [ $rt = "\"ERROR\"" ];thenecho "代码检测失败,拒绝提交"	  exit 1elif [ $rt = "\"OK\"" ];thenecho "代码检测成功,进入仓库"exit 0fi	fifi

说明:未完待续

 4、修改文件权限

chmod 777 pre-receive

5、验证

(1) 新建质量配置

在 sonarqube 中,点击 Quality Profiles 质量配置

在 Filter profiles by 输入 Java,找到默认配置 Sonar way。打开右侧齿轮,点击 Copy。

新建一个质量配置,名字叫 test

点击 Rules,将其他质量配置都去掉,只保留一条规则

Zero should not be a possible denominator 并设置为 Blocker 阻断

将 test 质量配置设置为 DEFAULT

(2) 新增质量阈

新增一个名叫 test 的质量阈

删除所有默认配置

增加一个针对所有代码(Overall Code)阻断问题(Blocker issues)大于(is greater than)0

的质量条件。表示代码检测中,只要出现一个以上阻断问题,代码检测就不通过。

(3)配置项目

打开项目配置,为项目添加一个 Java 语言的质量配置,选择我们刚才新建的 test

该质量配置,现在也是我们实例默认(DEFAULT)的质量配置。

配置项目质量阈,选择我们刚才新建的 test,保存。

在项目里面随便写几行不符合规则的代码,然后 commit 到本地仓库,push 到远程仓库的时候,

会提示被拦截。

在 git Console 标签页,会看到我们 SHELL 脚本写的日志

 Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote: 开始代码扫描...        
remote: git版本是:git version 2.43.0        
remote: 当前路径是:/var/opt/gitlab/git-data/repositories/@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b.git        
remote: 当前账户是:git        
remote: 旧修订ID:871ca52c316d810194a44657f6e3f46aee7fffb9        
remote: 新修订ID:c83f9099f6bbd3ba04691cd7a9e315604923ba60        
remote: 当前项目:macrosoft/sonar-test        
remote: 项目名称:sonar-test        
remote: 当前分支:refs/heads/master        
remote: 分支名称:master        
remote: 进入临时文件夹        
remote: /var/opt/gitlab/git-data/repositories/@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b.git/tmp        
remote: INFO: Scanner configuration file: /usr/local/sonar-scanner/conf/sonar-scanner.properties        
remote: INFO: Project root configuration file: NONE        
remote: INFO: SonarScanner 5.0.1.3006        
remote: INFO: Java 17.0.7 Eclipse Adoptium (64-bit)        
remote: INFO: Linux 3.10.0-1062.18.1.el7.x86_64 amd64        
remote: INFO: User cache: /var/opt/gitlab/git-data/repositories/@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b.git/sonar/cache        
remote: INFO: Analyzing on SonarQube server 9.9.4.87374        
remote: INFO: Default locale: "en_US", source code encoding: "UTF-8"        
remote: INFO: Load global settings        
remote: INFO: Load global settings (done) | time=138ms        
remote: INFO: Server id: 243B8A4D-AY4oeopTrXOQ26gUW39N        
remote: INFO: User cache: /var/opt/gitlab/git-data/repositories/@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b.git/sonar/cache        
remote: INFO: Load/download plugins        
remote: INFO: Load plugins index        
remote: INFO: Load plugins index (done) | time=102ms        
remote: INFO: Load/download plugins (done) | time=319ms        
remote: INFO: Process project properties        
remote: INFO: Process project properties (done) | time=1ms        
remote: INFO: Execute project builders        
remote: INFO: Execute project builders (done) | time=4ms        
remote: INFO: Project key: sonar-test        
remote: INFO: Base dir: /var/opt/gitlab/git-data/repositories/@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b.git/tmp        
remote: INFO: Working dir: /var/opt/gitlab/git-data/repositories/@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b.git/tmp/.scannerwork        
remote: INFO: Load project settings for component key: 'sonar-test'        
remote: INFO: Load project settings for component key: 'sonar-test' (done) | time=25ms        
remote: INFO: Load project branches        
remote: INFO: Load project branches (done) | time=39ms        
remote: INFO: Load branch configuration        
remote: INFO: Load branch configuration (done) | time=13ms        
remote: INFO: Load quality profiles        
remote: INFO: Load quality profiles (done) | time=64ms        
remote: INFO: Load active rules        
remote: INFO: Load active rules (done) | time=1141ms        
remote: INFO: Load analysis cache        
remote: INFO: Load analysis cache (404) | time=15ms        
remote: INFO: Branch name: master        
remote: INFO: Load project repositories        
remote: INFO: Load project repositories (done) | time=32ms        
remote: INFO: Indexing files...        
remote: INFO: Project configuration:        
remote: INFO: 3 files indexed        
remote: INFO: Quality profile for java: test        
remote: INFO: ------------- Run sensors on module sonar-test        
remote: INFO: Load metrics repository        
remote: INFO: Load metrics repository (done) | time=29ms        
remote: INFO: Sensor JavaSensor [java]        
remote: INFO: Configured Java source version (sonar.java.source): none        
remote: INFO: JavaClasspath initialization        
remote: INFO: JavaClasspath initialization (done) | time=5ms        
remote: INFO: JavaTestClasspath initialization        
remote: INFO: JavaTestClasspath initialization (done) | time=1ms        
remote: INFO: Server-side caching is enabled. The Java analyzer will not try to leverage data from a previous analysis.        
remote: INFO: Using ECJ batch to parse 3 Main java source files with batch size 98 KB.        
remote: INFO: Starting batch processing.        
remote: INFO: The Java analyzer cannot skip unchanged files in this context. A full analysis is performed for all files.        
remote: INFO: 100% analyzed        
remote: INFO: Batch processing: Done.        
remote: INFO: Did not optimize analysis for any files, performed a full analysis for all 3 files.        
remote: INFO: No "Test" source files to scan.        
remote: INFO: No "Generated" source files to scan.        
remote: INFO: Sensor JavaSensor [java] (done) | time=2039ms        
remote: INFO: Sensor JaCoCo XML Report Importer [jacoco]        
remote: INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml        
remote: INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer        
remote: INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=5ms        
remote: INFO: Sensor CSS Rules [javascript]        
remote: INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.        
remote: INFO: Sensor CSS Rules [javascript] (done) | time=2ms        
remote: INFO: Sensor C# Project Type Information [csharp]        
remote: INFO: Sensor C# Project Type Information [csharp] (done) | time=1ms        
remote: INFO: Sensor C# Analysis Log [csharp]        
remote: INFO: Sensor C# Analysis Log [csharp] (done) | time=34ms        
remote: INFO: Sensor C# Properties [csharp]        
remote: INFO: Sensor C# Properties [csharp] (done) | time=1ms        
remote: INFO: Sensor SurefireSensor [java]        
remote: INFO: parsing [/var/opt/gitlab/git-data/repositories/@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b.git/tmp/target/surefire-reports]        
remote: INFO: Sensor SurefireSensor [java] (done) | time=4ms        
remote: INFO: Sensor HTML [web]        
remote: INFO: Sensor HTML [web] (done) | time=10ms        
remote: INFO: Sensor TextAndSecretsSensor [text]        
remote: INFO: 3 source files to be analyzed        
remote: INFO: 3/3 source files have been analyzed        
remote: INFO: Sensor TextAndSecretsSensor [text] (done) | time=64ms        
remote: INFO: Sensor VB.NET Project Type Information [vbnet]        
remote: INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=3ms        
remote: INFO: Sensor VB.NET Analysis Log [vbnet]        
remote: INFO: Sensor VB.NET Analysis Log [vbnet] (done) | time=42ms        
remote: INFO: Sensor VB.NET Properties [vbnet]        
remote: INFO: Sensor VB.NET Properties [vbnet] (done) | time=0ms        
remote: INFO: Sensor com.github.mc1arke.sonarqube.plugin.scanner.ScannerPullRequestPropertySensor        
remote: INFO: Sensor com.github.mc1arke.sonarqube.plugin.scanner.ScannerPullRequestPropertySensor (done) | time=2ms        
remote: INFO: Sensor IaC Docker Sensor [iac]        
remote: INFO: 0 source files to be analyzed        
remote: INFO: 0/0 source files have been analyzed        
remote: INFO: Sensor IaC Docker Sensor [iac] (done) | time=149ms        
remote: INFO: ------------- Run sensors on project        
remote: INFO: Sensor Analysis Warnings import [csharp]        
remote: INFO: Sensor Analysis Warnings import [csharp] (done) | time=3ms        
remote: INFO: Sensor Zero Coverage Sensor        
remote: INFO: Sensor Zero Coverage Sensor (done) | time=17ms        
remote: INFO: Sensor Java CPD Block Indexer        
remote: INFO: Sensor Java CPD Block Indexer (done) | time=38ms        
remote: INFO: SCM Publisher is disabled        
remote: INFO: CPD Executor 3 files had no CPD blocks        
remote: INFO: CPD Executor Calculating CPD for 0 files        
remote: INFO: CPD Executor CPD calculation finished (done) | time=0ms        
remote: INFO: Analysis report generated in 137ms, dir size=97.8 kB        
remote: INFO: Analysis report compressed in 55ms, zip size=16.8 kB        
remote: INFO: Analysis report uploaded in 44ms        
remote: INFO: ANALYSIS SUCCESSFUL, you can find the results at: http://47.120.3.240:9000/dashboard?id=sonar-test&branch=master        
remote: INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report        
remote: INFO: More about the report processing at http://你的sonarqube:9000/api/ce/task?id=AY52Q8sMVWuDRjAxy0tr        
remote: INFO: Analysis total time: 9.598 s        
remote: INFO: ------------------------------------------------------------------------        
remote: INFO: EXECUTION SUCCESS        
remote: INFO: ------------------------------------------------------------------------        
remote: INFO: Total time: 12.726s        
remote: INFO: Final Memory: 19M/70M        
remote: INFO: ------------------------------------------------------------------------        
remote:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current        
remote:                                  Dload  Upload   Total   Spent    Left  Speed        
remote: 
remote:   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0        
remote: 100   370    0   370    0     0  14036      0 --:--:-- --:--:-- --:--:-- 14230        
remote: 代码检测结果"ERROR"        
remote: 删除临时文件夹        
remote: 代码检测失败,拒绝提交        
error: failed to push some refs to 'http://你的 sonarqube IP/macrosoft/sonar-test.git'
To http://47.119.174.163/macrosoft/sonar-test.git
!    refs/heads/master:refs/heads/master    [remote rejected] (pre-receive hook declined)
Done

 在 sonarqube 对应分支,就能看到检测失败,而且报错内容,就是我们代码写的内容。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://xiahunao.cn/news/2905801.html

如若内容造成侵权/违法违规/事实不符,请联系瞎胡闹网进行投诉反馈,一经查实,立即删除!

相关文章

【学习笔记】java项目—苍穹外卖day01

文章目录 苍穹外卖-day01课程内容1. 软件开发整体介绍1.1 软件开发流程1.2 角色分工1.3 软件环境 2. 苍穹外卖项目介绍2.1 项目介绍2.2 产品原型2.3 技术选型 3. 开发环境搭建3.1 前端环境搭建3.2 后端环境搭建3.2.1 熟悉项目结构3.2.2 Git版本控制3.2.3 数据库环境搭建3.2.4 前…

git配置SSH 密钥

git配置SSH 密钥 1.window配置ssh1.安装ssh2.安装 Git(安装教程参见安装Git)并保证版本大于 1.9![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/e59f4e16b83c45649f1d9d7bd6bf92c0.png)3.SSH 尽量保持最新,6.5之前的版本由于使用…

SpringBoot国际化配置流程(超详细)

前言 最新第一次在做SpringBoot的国际化,网上搜了很多相关的资料,都是一些简单的使用例子,达不到在实际项目中使用的要求,因此本次将结合查询的资料以及自己的实践整理出SpringBoot配置国际化的流程。 SpringBoot国际化 "i…

猫,路由器,WIFI

家庭网络常识 1:猫、路由器、wifi_哔哩哔哩_bilibili 入户光纤插到猫上面,网线连接猫和路由器,网线连接路由器和电脑。路由器可以发射WIFI。 手机通过WIFI连接到路由器。 左边是猫,右边是光猫。 (modem) …

JAVA面试八股文之集合

JAVA集合相关 集合?说一说Java提供的常见集合?hashmap的key可以为null嘛?hashMap线程是否安全, 如果不安全, 如何解决?HashSet和TreeSet?ArrayList底层是如何实现的?ArrayList listnew ArrayList(10)中的li…

《QT实用小工具·一》电池电量组件

1、概述 项目源码放在文章末尾 本项目实现了一个电池电量控件,包含如下功能: 可设置电池电量,动态切换电池电量变化。可设置电池电量警戒值。可设置电池电量正常颜色和报警颜色。可设置边框渐变颜色。可设置电量变化时每次移动的步长。可设置…

淘宝订单中的涉及红包检测、优惠券检测方案|工具|API

首先,检测订单红包的核心价值是什么? “红包的本质就是薅平台羊毛:不用怀疑,平台对于这种损害平台利益的行为肯定是最高等级的稽查”。那么,在日常运营中,需要尽可能过滤这类订单。 其次,如何使…

堆的应用(堆排序,TOP-K问题)详细讲解

所有人都关心我飞的高不高,只有我妈关心我翅膀硬不硬 一、堆的应用 1. 堆排序 1.1 建堆 1.2 利用堆删除思想来进行排序 2.TOP-K问题 二、完结撒❀ –❀–❀–❀–❀–❀–❀–❀–❀–❀–❀–❀–❀–❀–❀–❀-正文开始-❀–❀–❀–❀–❀–❀–❀–❀–…

斜率优化dp 笔记

任务安排1 有 N 个任务排成一个序列在一台机器上等待执行,它们的顺序不得改变。 机器会把这 N 个任务分成若干批,每一批包含连续的若干个任务。 从时刻 00 开始,任务被分批加工,执行第 i 个任务所需的时间是 Ti。 另外&#x…

【LVGL-字库应用】

LVGL-中文字库应用 ■ LVGL-内部字库■ LVGL 内部字库的使用流程: ■ LVGL-自定义字库■ 方法一:C 语言数组(内部读取)-在线转换工具■ 方法二:C 语言数组(内部读取)-利用离线字体转换软件&…

销售的业绩和合同无法统一管理可以通过系统实现吗?

这个问题我们在日常管理中也遇到过,在没有使用软件之前,合同原件没有专人负责打理,销售人员签了合同后,直接把原件随手放在柜子里,或者把数据记录到excel表中。 但是每个人的工作习惯不一样,记录的表格也不…

Spring boot 发送文本邮件 和 html模板邮件

Spring boot 发送文本邮件 和 html模板邮件 提示:这里使用 spring-boot-starter-mail 发送文本邮件 和 html模板邮件 文章目录 Spring boot 发送文本邮件 和 html模板邮件一、开启QQ邮箱里的POP3/SMTP服务①:开启步骤 二、简单配置①:引入依赖…

Linux系统使用Docker部署MinIO结合内网穿透实现公网访问本地存储服务

文章目录 前言1. Docker 部署MinIO2. 本地访问MinIO3. Linux安装Cpolar4. 配置MinIO公网地址5. 远程访问MinIO管理界面6. 固定MinIO公网地址 前言 MinIO是一个开源的对象存储服务器,可以在各种环境中运行,例如本地、Docker容器、Kubernetes集群等。它兼…

①胃癌单细胞和配对转录组揭示胃肿瘤微环境(文献和数据)

目录 文献内容 胃癌细胞微环境格局 肿瘤基质的特征存在活化的成纤维细胞 肿瘤内皮细胞与血管生成途径 巨噬细胞显示炎症二分法 淋巴细胞转向免疫抑制和分化表型 细胞通信网络揭示了胃癌发展的潜在驱动因素 胃癌免疫治疗批量RNA-seq的整合揭示了细胞和分子的反应倾向 数…

Web漏洞-深入WAF注入绕过

目录 简要其他测试绕过 方式一:白名单(实战中意义不大) 方式二:静态资源 方式三: url白名单 方式四:爬虫白名单 #阿里云盾防SQL注入简要分析 #安全狗云盾SQL注入插件脚本编写 在攻防实战中,往往需要掌握一些特性,比如服务…

Zabbix6 - Centos7源码编译部署HA高可用集群手册

Zabbix6 - Centos7源码编译部署HA高可用集群手册 HA高可用集群 总所周知,在我们IT运维的圈圈中,HA高可用集群服务算是逼格最高的吧也是运维里保障力度最大的环境。 HA是HighlyAvailable缩写,是双机集群系统简称,提高可用性集群,是保证业务连续性的有效解决方案,一般有两个…

6款好用的AI写作助手,为大家解决创作困难

写作出高质量的文章对于每个创作者来说是非常重要,但有时候在面对繁重的写作任务时,大家可能会陷入创作困境,思绪纷乱、灵感枯竭。,但随着人工智能技术的不断发展,AI写作助手已经成为了许多创作者的得力帮手&#xff0…

Java代码混淆技术在应用程序保护中的关键作用与应用

摘要 本文探讨了代码混淆在保护Java代码安全性和知识产权方面的重要意义。通过混淆技术,可以有效防止代码被反编译、逆向工程或恶意篡改,提高代码的安全性。常见的Java代码混淆工具如IPAGuard、Allatori、DashO、Zelix KlassMaster和yGuard等&#xff0…

Acwing_795前缀和 【一维前缀和】+【模板】二维前缀和

Acwing_795前缀和 【一维前缀和】 题目&#xff1a; 代码&#xff1a; #include <bits/stdc.h> #define int long long #define INF 0X3f3f3f3f #define endl \n using namespace std; const int N 100010; int arr[N];int n,m; int l,r; signed main(){std::ios::s…

OpenHarmony实战开发-Web组件的使用

介绍 本篇Codelab使用ArkTS语言实现一个简单的免登录过程&#xff0c;向大家介绍基本的cookie管理操作。主要包含以下功能&#xff1a; 获取指定url对应的cookie的值。设置cookie。清除所有cookie。免登录访问账户中心。 原理说明 本应用旨在说明Web组件中cookie的管理操作。…