Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
ff9881d9
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
ff9881d9
编写于
10月 08, 2018
作者:
N
Nick Thomas
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove unencrypted webhook token and URL columns
上级
c616327c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
31 addition
and
37 deletion
+31
-37
app/models/hooks/web_hook.rb
app/models/hooks/web_hook.rb
+0
-34
changelogs/unreleased/52367-cleanup-web-hooks-columns.yml
changelogs/unreleased/52367-cleanup-web-hooks-columns.yml
+5
-0
db/post_migrate/20181008145341_steal_encrypt_columns.rb
db/post_migrate/20181008145341_steal_encrypt_columns.rb
+15
-0
db/post_migrate/20181008145359_remove_web_hooks_token_and_url.rb
..._migrate/20181008145359_remove_web_hooks_token_and_url.rb
+10
-0
db/schema.rb
db/schema.rb
+1
-3
未找到文件。
app/models/hooks/web_hook.rb
浏览文件 @
ff9881d9
...
...
@@ -37,38 +37,4 @@ class WebHook < ActiveRecord::Base
def
allow_local_requests?
false
end
# In 11.4, the web_hooks table has both `token` and `encrypted_token` fields.
# Ensure that the encrypted version always takes precedence if present.
alias_method
:attr_encrypted_token
,
:token
def
token
attr_encrypted_token
.
presence
||
read_attribute
(
:token
)
end
# In 11.4, the web_hooks table has both `token` and `encrypted_token` fields.
# Pending a background migration to encrypt all fields, we should just clear
# the unencrypted value whenever the new value is set.
alias_method
:'attr_encrypted_token='
,
:'token='
def
token
=
(
value
)
self
.
attr_encrypted_token
=
value
write_attribute
(
:token
,
nil
)
end
# In 11.4, the web_hooks table has both `url` and `encrypted_url` fields.
# Ensure that the encrypted version always takes precedence if present.
alias_method
:attr_encrypted_url
,
:url
def
url
attr_encrypted_url
.
presence
||
read_attribute
(
:url
)
end
# In 11.4, the web_hooks table has both `url` and `encrypted_url` fields.
# Pending a background migration to encrypt all fields, we should just clear
# the unencrypted value whenever the new value is set.
alias_method
:'attr_encrypted_url='
,
:'url='
def
url
=
(
value
)
self
.
attr_encrypted_url
=
value
write_attribute
(
:url
,
nil
)
end
end
changelogs/unreleased/52367-cleanup-web-hooks-columns.yml
0 → 100644
浏览文件 @
ff9881d9
---
title
:
Remove legacy unencrypted webhook columns from the database
merge_request
:
22199
author
:
type
:
changed
db/post_migrate/20181008145341_steal_encrypt_columns.rb
0 → 100644
浏览文件 @
ff9881d9
class
StealEncryptColumns
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
Gitlab
::
BackgroundMigration
.
steal
(
'EncryptColumns'
)
end
def
down
# no-op
end
end
db/post_migrate/20181008145359_remove_web_hooks_token_and_url.rb
0 → 100644
浏览文件 @
ff9881d9
class
RemoveWebHooksTokenAndUrl
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
change
remove_column
:web_hooks
,
:token
,
:string
remove_column
:web_hooks
,
:url
,
:string
,
limit:
2000
end
end
db/schema.rb
浏览文件 @
ff9881d9
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2018100
2172433
)
do
ActiveRecord
::
Schema
.
define
(
version:
2018100
8145359
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -2256,7 +2256,6 @@ ActiveRecord::Schema.define(version: 20181002172433) do
add_index
"web_hook_logs"
,
[
"web_hook_id"
],
name:
"index_web_hook_logs_on_web_hook_id"
,
using: :btree
create_table
"web_hooks"
,
force: :cascade
do
|
t
|
t
.
string
"url"
,
limit:
2000
t
.
integer
"project_id"
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
...
...
@@ -2269,7 +2268,6 @@ ActiveRecord::Schema.define(version: 20181002172433) do
t
.
boolean
"note_events"
,
default:
false
,
null:
false
t
.
boolean
"enable_ssl_verification"
,
default:
true
t
.
boolean
"wiki_page_events"
,
default:
false
,
null:
false
t
.
string
"token"
t
.
boolean
"pipeline_events"
,
default:
false
,
null:
false
t
.
boolean
"confidential_issues_events"
,
default:
false
,
null:
false
t
.
boolean
"repository_update_events"
,
default:
false
,
null:
false
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录