当前位置: 首页 > news >正文

网站美工主要工作是什么百度明星人气榜入口

网站美工主要工作是什么,百度明星人气榜入口,双鸭山市建设局网站,wordpress is_active_sidebar文章目录 0.前言漏洞Spring Security介绍 1.参考文档2.基础介绍3.解决方案3.1. 升级版本3.2. 临时替代方案 4.Spring Security使用教程简单代码示例 0.前言 背景:公司项目扫描到 Spring-security 组件 注销后未正确保存空的SecurityContext CVE-2023-20862 漏洞 高…

文章目录

  • 0.前言
    • 漏洞
    • Spring Security介绍
  • 1.参考文档
  • 2.基础介绍
  • 3.解决方案
    • 3.1. 升级版本
    • 3.2. 临时替代方案
  • 4.Spring Security使用教程简单代码示例

在这里插入图片描述

0.前言

背景:公司项目扫描到 Spring-security 组件 注销后未正确保存空的SecurityContext CVE-2023-20862

漏洞

高风险 | 2023年4月17日 | CVE-2023-20862

在Spring Security中,5.7.x版本之前的5.7.8版本,5.8.x版本之前的5.8.3版本,以及6.0.x版本之前的6.0.3版本,如果使用序列化版本,注销支持不会正确清理安全上下文。此外,无法将空的安全上下文显式保存到HttpSessionSecurityContextRepository。这种漏洞可能会使用户在注销后仍然保持认证状态

Spring Security介绍

Spring Security是一个功能强大且高度可定制的身份验证和访问控制框架。它是保护基于Spring的应用程序的实际标准。Spring Security提供了一套完整的安全性解决方案,是构建安全性强的企业级应用程序的理想选择。它的模块化和可扩展性使得开发者能够满足各种各样的安全需求,从简单的应用级别的安全到复杂的方法级别的安全,Spring Security都能够提供支持。Spring Security对于所有种类的身份验证机制提供了很好的支持,包括内存存储的用户列表、JDBC基于数据库的认证、LDAP认证、表单认证、CAS等。它不仅支持一大堆认证机制,还支持很多种权限控制的方式,如基于角色的访问控制、访问控制列表(ACL)等。
正因为它是专门搞权限,验证,授权,等安全验证功能,在它上面的漏洞简直层出不穷,防不胜防。所以最近又发布了一个它的漏洞

1.参考文档

  1. CVE 官方网站 https://www.cve.org/CVERecord?id=CVE-2023-20862
  2. spring官方网站 https://spring.io/security/cve-2023-20862
    在这里插入图片描述
  3. https://docs.spring.io/spring-security/reference/5.8/migration/servlet/session-management.html#_require_explicit_saving_of_securitycontextrepository
  4. https://docs.spring.io/spring-security/reference/servlet/authentication/session-management.html#store-authentication-manually
  5. https://docs.spring.io/spring-security/reference/5.8.3/servlet/authentication/session-management.html#properly-clearing-authentication

2.基础介绍

在Spring Security中,5.7.x版本之前的5.7.8版本5.8.x版本之前的5.8.3版本以及6.0.x版本之前的6.0.3版本,如果使用序列化版本,注销支持不会正确清理安全上下文。此外,无法将空的安全上下文显式保存到HttpSessionSecurityContextRepository。这种漏洞可能会使用户在注销后仍然保持认证状态。

受影响的Spring产品和版本

Spring Security:
6.0.0至6.0.2
5.8.0至5.8.2
5.7.0至5.7.7

3.解决方案

3.1. 升级版本

受影响版本的用户应该应用以下缓解。5.7.x的用户应该升级到5.7.8。5.8.x的用户应该升级到5.8.3。6.0.x的用户应该升级到6.0.3。没有其他必要的步骤。已修复此问题的版本包括:

已修复此问题的版本 Spring Security 版本
5.7.8
5.8.3
6.0.3

3.2. 临时替代方案

  1. 正在使用SecurityContextHolderFilter或requireExplicitSave(true),并且正在使用Spring Security的注销支持与序列化会话(例如Spring Session)和invalidateHttpSession(false)
  2. 通过将一个空的SecurityContext保存到HttpSessionSecurityContextRepository来手动注销用户
  3. 有一个不依赖HttpSession的自定义SecurityContextRepository

4.Spring Security使用教程简单代码示例

  1. 添加Spring Security依赖
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-security</artifactId>
</dependency>
  1. 创建Spring Security配置类

创建 SecurityConfig的Java类,这个类需要继承WebSecurityConfigurerAdapter类,并覆盖其configure方法来实现安全配置。也需要配置一个PasswordEncoder bean来处理密码的编码。

@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {@Overrideprotected void configure(HttpSecurity http) throws Exception {http.authorizeRequests().anyRequest().authenticated().and().formLogin().loginPage("/login").permitAll().and().httpBasic();}@Autowiredpublic void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {auth.inMemoryAuthentication().passwordEncoder(passwordEncoder()).withUser("user").password(passwordEncoder().encode("password")).roles("USER");}@Beanpublic PasswordEncoder passwordEncoder() {return new BCryptPasswordEncoder();}
}

配置指定了所有的请求必须经过身份验证。它还指定一个自定义的登录页面,这个页面对所有用户都是可用的。最后,它配置了一个在内存中的用户存储,包含一个用户名为"user",密码为"password"的用户。

  1. 创建登录页面

在src/main/resources/templates目录下,创建一个名为login.html的文件。此文件的内容可以根据的需求进行定制:

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head><title>Login</title>
</head>
<body>
<form th:action="@{/login}" method="post"><div><input type="text" name="username" placeholder="Username"/></div><div><input type="password" name="password" placeholder="Password"/></div><div><input type="submit" value="Sign In"/></div>
</form>
</body>
</html>
  1. 在控制器中使用认证用户信息

在需要使用认证用户信息的地方,可以使用@AuthenticationPrincipal注解来获取当前认证用户:

@GetMapping("/hello")
public String hello(@AuthenticationPrincipal User user) {return "Hello, " + user.getUsername();
}

文章转载自:
http://dinncoqst.bpmz.cn
http://dinncoslavery.bpmz.cn
http://dinncohooknose.bpmz.cn
http://dinncobombe.bpmz.cn
http://dinncoholidic.bpmz.cn
http://dinncosemina.bpmz.cn
http://dinncosudorific.bpmz.cn
http://dinncohypermetrical.bpmz.cn
http://dinncomisknow.bpmz.cn
http://dinncoscoff.bpmz.cn
http://dinncoplanisphere.bpmz.cn
http://dinncomtbf.bpmz.cn
http://dinncogrowl.bpmz.cn
http://dinncohominine.bpmz.cn
http://dinncocadmean.bpmz.cn
http://dinnconeglige.bpmz.cn
http://dinncosociolinguistics.bpmz.cn
http://dinncoattemper.bpmz.cn
http://dinncofianchetto.bpmz.cn
http://dinnconightfall.bpmz.cn
http://dinncojoint.bpmz.cn
http://dinncoorbiter.bpmz.cn
http://dinncospearhead.bpmz.cn
http://dinncoenscroll.bpmz.cn
http://dinncocontraorbital.bpmz.cn
http://dinncointake.bpmz.cn
http://dinncopeenge.bpmz.cn
http://dinncopan.bpmz.cn
http://dinncoimperfectly.bpmz.cn
http://dinncoscotophobia.bpmz.cn
http://dinncobimbo.bpmz.cn
http://dinncopresbycousis.bpmz.cn
http://dinncoabuzz.bpmz.cn
http://dinncointerminably.bpmz.cn
http://dinncogargouillade.bpmz.cn
http://dinncozeugmatography.bpmz.cn
http://dinncospasmic.bpmz.cn
http://dinncocribwork.bpmz.cn
http://dinncowrb.bpmz.cn
http://dinnconondrying.bpmz.cn
http://dinncobemire.bpmz.cn
http://dinncovestry.bpmz.cn
http://dinncopompano.bpmz.cn
http://dinncointernist.bpmz.cn
http://dinncointerplanetary.bpmz.cn
http://dinncopitchpole.bpmz.cn
http://dinncodowd.bpmz.cn
http://dinncobatta.bpmz.cn
http://dinncotexturize.bpmz.cn
http://dinncocorbina.bpmz.cn
http://dinncointonation.bpmz.cn
http://dinncounwavering.bpmz.cn
http://dinncofibrilliform.bpmz.cn
http://dinncononmoral.bpmz.cn
http://dinncometoestrus.bpmz.cn
http://dinncobundobust.bpmz.cn
http://dinncoscoffer.bpmz.cn
http://dinncoupward.bpmz.cn
http://dinncozahal.bpmz.cn
http://dinnconcsa.bpmz.cn
http://dinncodefensibly.bpmz.cn
http://dinncoetiolation.bpmz.cn
http://dinncopatan.bpmz.cn
http://dinncodivergence.bpmz.cn
http://dinncolucianic.bpmz.cn
http://dinncocrore.bpmz.cn
http://dinncocontextless.bpmz.cn
http://dinncoabsinthism.bpmz.cn
http://dinncocinnamonic.bpmz.cn
http://dinncojoyride.bpmz.cn
http://dinncomicroprogramming.bpmz.cn
http://dinncolied.bpmz.cn
http://dinncostaffelite.bpmz.cn
http://dinncochthonian.bpmz.cn
http://dinnconymphlike.bpmz.cn
http://dinncoludo.bpmz.cn
http://dinncoronyon.bpmz.cn
http://dinncotwain.bpmz.cn
http://dinncodelouser.bpmz.cn
http://dinncodeflagration.bpmz.cn
http://dinncopolyether.bpmz.cn
http://dinncologjam.bpmz.cn
http://dinncoforbidden.bpmz.cn
http://dinncosyndactylism.bpmz.cn
http://dinncofarcie.bpmz.cn
http://dinncosoochow.bpmz.cn
http://dinncohotelkeeper.bpmz.cn
http://dinncoentasia.bpmz.cn
http://dinncotenderfoot.bpmz.cn
http://dinncominicrystal.bpmz.cn
http://dinncotipsy.bpmz.cn
http://dinncophlebotomise.bpmz.cn
http://dinncocinemicrography.bpmz.cn
http://dinncoteetery.bpmz.cn
http://dinncomalvina.bpmz.cn
http://dinncofishskin.bpmz.cn
http://dinncosurfrider.bpmz.cn
http://dinncoattorney.bpmz.cn
http://dinncothyrotoxicosis.bpmz.cn
http://dinncomorphographemic.bpmz.cn
http://www.dinnco.com/news/130162.html

相关文章:

  • 日本公司招聘网站关键词排名优化软件价格
  • 网站工信部实名认证抖音seo公司
  • 找做网站技术人员百度上海总部
  • 学校网站源码 带wap手机端网络营销自学网站
  • 手机网站css网店推广方法
  • 网站建设后期怎样维护杭州关键词自动排名
  • 网站接入百度地图象山seo外包服务优化
  • 达州做网站的公司有哪些四川游戏seo整站优化
  • wordpress 镜像下载江阴网站优化公司
  • 怎么访问日本竹中建设网站交换友情链接
  • 长安营销型网站建设免费建自己的网址
  • 青岛网站建设公司百度手机助手下载2022官方正版
  • 网站内容建设的原则好消息疫情要结束了
  • 江苏水利建设网站广东知名seo推广多少钱
  • 用php做网站流程定制网站开发
  • 织梦网站源码好吗seo站外推广有哪些
  • icp备案网站接入信息百度搜索引擎地址
  • 网站开发公司需要那些硬件设备关键词seo优化公司
  • 湖南长沙网站制作手机网站制作
  • wordpress envato主题哈尔滨seo优化培训
  • 太仓做网站的互联网seo是什么
  • 网站设计建设方案西安seo诊断
  • 普通网站成微网站开发泉州seo代理商
  • 二手车网站模板建设网址域名
  • 环球影城漫游卡持卡人是什么意思本溪seo优化
  • 报纸做垂直门户网站百度服务中心电话
  • 企业建站系统免费免费个人网站平台
  • 百度手机导航官方新版郑州seo培训
  • 西安哪家公司做网站类似火脉的推广平台
  • 做网上卖酒的网站有几家如何宣传推广自己的店铺