Skip to content

Commit dcf21dc

Browse files
committed
Merge remote-tracking branch 'origin/main' into forgefriends-mr44
2 parents a8c5b17 + 159c3f4 commit dcf21dc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+628
-492
lines changed

Makefile

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,9 @@ lint: lint-frontend lint-backend
313313
lint-frontend: node_modules
314314
npx eslint --color --max-warnings=0 web_src/js build templates *.config.js docs/assets/js
315315
npx stylelint --color --max-warnings=0 web_src/less
316-
npx editorconfig-checker templates
317316

318317
.PHONY: lint-backend
319-
lint-backend: golangci-lint vet
318+
lint-backend: golangci-lint vet editorconfig-checker
320319

321320
.PHONY: watch
322321
watch:
@@ -405,6 +404,11 @@ test-sqlite-migration: migrations.sqlite.test migrations.individual.sqlite.test
405404
GITEA_ROOT="$(CURDIR)" GITEA_CONF=integrations/sqlite.ini ./migrations.sqlite.test
406405
GITEA_ROOT="$(CURDIR)" GITEA_CONF=integrations/sqlite.ini ./migrations.individual.sqlite.test
407406

407+
.PHONY: test-sqlite-migration\#%
408+
test-sqlite-migration\#%: migrations.sqlite.test migrations.individual.sqlite.test generate-ini-sqlite
409+
GITEA_ROOT="$(CURDIR)" GITEA_CONF=integrations/sqlite.ini ./migrations.individual.sqlite.test -test.run $(subst .,/,$*)
410+
411+
408412
generate-ini-mysql:
409413
sed -e 's|{{TEST_MYSQL_HOST}}|${TEST_MYSQL_HOST}|g' \
410414
-e 's|{{TEST_MYSQL_DBNAME}}|${TEST_MYSQL_DBNAME}|g' \
@@ -510,6 +514,10 @@ bench-pgsql: integrations.pgsql.test generate-ini-pgsql
510514
integration-test-coverage: integrations.cover.test generate-ini-mysql
511515
GITEA_ROOT="$(CURDIR)" GITEA_CONF=integrations/mysql.ini ./integrations.cover.test -test.coverprofile=integration.coverage.out
512516

517+
.PHONY: integration-test-coverage-sqlite
518+
integration-test-coverage-sqlite: integrations.cover.sqlite.test generate-ini-sqlite
519+
GITEA_ROOT="$(CURDIR)" GITEA_CONF=integrations/sqlite.ini ./integrations.cover.sqlite.test -test.coverprofile=integration.coverage.out
520+
513521
integrations.mysql.test: git-check $(GO_SOURCES)
514522
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/integrations -o integrations.mysql.test
515523

@@ -528,6 +536,9 @@ integrations.sqlite.test: git-check $(GO_SOURCES)
528536
integrations.cover.test: git-check $(GO_SOURCES)
529537
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/integrations -coverpkg $(shell echo $(GO_PACKAGES) | tr ' ' ',') -o integrations.cover.test
530538

539+
integrations.cover.sqlite.test: git-check $(GO_SOURCES)
540+
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/integrations -coverpkg $(shell echo $(GO_PACKAGES) | tr ' ' ',') -o integrations.cover.sqlite.test -tags '$(TEST_TAGS)'
541+
531542
.PHONY: migrations.mysql.test
532543
migrations.mysql.test: $(GO_SOURCES)
533544
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/integrations/migration-test -o migrations.mysql.test
@@ -784,6 +795,13 @@ golangci-lint-check:
784795
curl -sfL "https://raw.githubusercontent.com/golangci/golangci-lint/v${MIN_GOLANGCI_LINT_VER_FMT}/install.sh" | sh -s -- -b $(GOPATH)/bin v$(MIN_GOLANGCI_LINT_VER_FMT); \
785796
fi
786797

798+
.PHONY: editorconfig-checker
799+
editorconfig-checker:
800+
@hash editorconfig-checker > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
801+
$(GO) install github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@50adf46752da119dfef66e57be3ce2693ea4aa9c; \
802+
fi
803+
editorconfig-checker templates
804+
787805
.PHONY: docker
788806
docker:
789807
docker build --disable-content-trust=false -t $(DOCKER_REF) .

docs/content/doc/advanced/external-renderers.en-us.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,27 @@ Once your configuration changes have been made, restart Gitea to have changes ta
103103
**Note**: Prior to Gitea 1.12 there was a single `markup.sanitiser` section with keys that were redefined for multiple rules, however,
104104
there were significant problems with this method of configuration necessitating configuration through multiple sections.
105105

106+
### Example: HTML
107+
108+
Render HTML files directly:
109+
110+
```ini
111+
[markup.html]
112+
ENABLED = true
113+
FILE_EXTENSIONS = .html,.htm
114+
RENDER_COMMAND = cat
115+
; Input is not a standard input but a file
116+
IS_INPUT_FILE = true
117+
118+
[markup.sanitizer.html.1]
119+
ELEMENT = div
120+
ALLOW_ATTR = class
121+
122+
[markup.sanitizer.html.2]
123+
ELEMENT = a
124+
ALLOW_ATTR = class
125+
```
126+
106127
### Example: Office DOCX
107128

108129
Display Office DOCX files with [`pandoc`](https://pandoc.org/):

docs/content/doc/installation/on-cloud-provider.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,9 @@ To deploy Gitea to DigitalOcean, have a look at the [DigitalOcean Marketplace](h
4848
[Linode](https://www.linode.com/) has Gitea as an app in their marketplace.
4949

5050
To deploy Gitea to Linode, have a look at the [Linode Marketplace](https://www.linode.com/marketplace/apps/linode/gitea/).
51+
52+
## alwaysdata
53+
54+
[alwaysdata](https://www.alwaysdata.com/) has Gitea as an app in their marketplace.
55+
56+
To deploy Gitea to alwaysdata, have a look at the [alwaysdata Marketplace](https://www.alwaysdata.com/en/marketplace/gitea/).

integrations/signin_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ func TestSignin(t *testing.T) {
5151
{username: "wrongUsername", password: "password", message: i18n.Tr("en", "form.username_password_incorrect")},
5252
{username: "user15", password: "wrongPassword", message: i18n.Tr("en", "form.username_password_incorrect")},
5353
{username: "[email protected]", password: "wrongPassword", message: i18n.Tr("en", "form.username_password_incorrect")},
54-
// test for duplicate email
55-
{username: "[email protected]", password: "password", message: i18n.Tr("en", "form.email_been_used")},
5654
}
5755

5856
for _, s := range samples {

models/auth/webauthn.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type WebAuthnCredential struct {
4343
Name string
4444
LowerName string `xorm:"unique(s)"`
4545
UserID int64 `xorm:"INDEX unique(s)"`
46-
CredentialID string `xorm:"INDEX"`
46+
CredentialID string `xorm:"INDEX VARCHAR(410)"`
4747
PublicKey []byte
4848
AttestationType string
4949
AAGUID []byte

models/db/context.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,17 @@ func DeleteByBean(ctx context.Context, bean interface{}) (int64, error) {
148148
return GetEngine(ctx).Delete(bean)
149149
}
150150

151+
// DeleteBeans deletes all given beans, beans should contain delete conditions.
152+
func DeleteBeans(ctx context.Context, beans ...interface{}) (err error) {
153+
e := GetEngine(ctx)
154+
for i := range beans {
155+
if _, err = e.Delete(beans[i]); err != nil {
156+
return err
157+
}
158+
}
159+
return nil
160+
}
161+
151162
// CountByBean counts the number of database records according non-empty fields of the bean as conditions.
152163
func CountByBean(ctx context.Context, bean interface{}) (int64, error) {
153164
return GetEngine(ctx).Count(bean)

models/issue_stopwatch.go

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"code.gitea.io/gitea/models/db"
1313
user_model "code.gitea.io/gitea/models/user"
1414
"code.gitea.io/gitea/modules/timeutil"
15+
"code.gitea.io/gitea/modules/util"
1516
)
1617

1718
// ErrIssueStopwatchNotExist represents an error that stopwatch is not exist
@@ -53,7 +54,7 @@ func (s Stopwatch) Seconds() int64 {
5354

5455
// Duration returns a human-readable duration string based on local server time
5556
func (s Stopwatch) Duration() string {
56-
return SecToTime(s.Seconds())
57+
return util.SecToTime(s.Seconds())
5758
}
5859

5960
func getStopwatch(ctx context.Context, userID, issueID int64) (sw *Stopwatch, exists bool, err error) {
@@ -164,7 +165,7 @@ func FinishIssueStopwatch(ctx context.Context, user *user_model.User, issue *Iss
164165
Doer: user,
165166
Issue: issue,
166167
Repo: issue.Repo,
167-
Content: SecToTime(timediff),
168+
Content: util.SecToTime(timediff),
168169
Type: CommentTypeStopTracking,
169170
TimeID: tt.ID,
170171
}); err != nil {
@@ -263,32 +264,3 @@ func cancelStopwatch(ctx context.Context, user *user_model.User, issue *Issue) e
263264
}
264265
return nil
265266
}
266-
267-
// SecToTime converts an amount of seconds to a human-readable string (example: 66s -> 1min 6s)
268-
func SecToTime(duration int64) string {
269-
seconds := duration % 60
270-
minutes := (duration / (60)) % 60
271-
hours := duration / (60 * 60)
272-
273-
var hrs string
274-
275-
if hours > 0 {
276-
hrs = fmt.Sprintf("%dh", hours)
277-
}
278-
if minutes > 0 {
279-
if hours == 0 {
280-
hrs = fmt.Sprintf("%dmin", minutes)
281-
} else {
282-
hrs = fmt.Sprintf("%s %dmin", hrs, minutes)
283-
}
284-
}
285-
if seconds > 0 {
286-
if hours == 0 && minutes == 0 {
287-
hrs = fmt.Sprintf("%ds", seconds)
288-
} else {
289-
hrs = fmt.Sprintf("%s %ds", hrs, seconds)
290-
}
291-
}
292-
293-
return hrs
294-
}

models/issue_tracked_time.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"code.gitea.io/gitea/models/db"
1212
user_model "code.gitea.io/gitea/models/user"
1313
"code.gitea.io/gitea/modules/setting"
14+
"code.gitea.io/gitea/modules/util"
1415

1516
"xorm.io/builder"
1617
)
@@ -177,7 +178,7 @@ func AddTime(user *user_model.User, issue *Issue, amount int64, created time.Tim
177178
Issue: issue,
178179
Repo: issue.Repo,
179180
Doer: user,
180-
Content: SecToTime(amount),
181+
Content: util.SecToTime(amount),
181182
Type: CommentTypeAddTimeManual,
182183
TimeID: t.ID,
183184
}); err != nil {
@@ -226,7 +227,7 @@ func TotalTimes(options *FindTrackedTimesOptions) (map[*user_model.User]string,
226227
}
227228
return nil, err
228229
}
229-
totalTimes[user] = SecToTime(total)
230+
totalTimes[user] = util.SecToTime(total)
230231
}
231232
return totalTimes, nil
232233
}
@@ -260,7 +261,7 @@ func DeleteIssueUserTimes(issue *Issue, user *user_model.User) error {
260261
Issue: issue,
261262
Repo: issue.Repo,
262263
Doer: user,
263-
Content: "- " + SecToTime(removedTime),
264+
Content: "- " + util.SecToTime(removedTime),
264265
Type: CommentTypeDeleteTimeManual,
265266
}); err != nil {
266267
return err
@@ -289,7 +290,7 @@ func DeleteTime(t *TrackedTime) error {
289290
Issue: t.Issue,
290291
Repo: t.Issue.Repo,
291292
Doer: t.User,
292-
Content: "- " + SecToTime(t.Time),
293+
Content: "- " + util.SecToTime(t.Time),
293294
Type: CommentTypeDeleteTimeManual,
294295
}); err != nil {
295296
return err

models/issue_tracked_time_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func TestAddTime(t *testing.T) {
3434
assert.Equal(t, int64(3661), tt.Time)
3535

3636
comment := unittest.AssertExistsAndLoadBean(t, &Comment{Type: CommentTypeAddTimeManual, PosterID: 3, IssueID: 1}).(*Comment)
37-
assert.Equal(t, comment.Content, "1h 1min 1s")
37+
assert.Equal(t, comment.Content, "1h 1m 1s")
3838
}
3939

4040
func TestGetTrackedTimes(t *testing.T) {
@@ -86,15 +86,15 @@ func TestTotalTimes(t *testing.T) {
8686
assert.Len(t, total, 1)
8787
for user, time := range total {
8888
assert.Equal(t, int64(1), user.ID)
89-
assert.Equal(t, "6min 40s", time)
89+
assert.Equal(t, "6m 40s", time)
9090
}
9191

9292
total, err = TotalTimes(&FindTrackedTimesOptions{IssueID: 2})
9393
assert.NoError(t, err)
9494
assert.Len(t, total, 2)
9595
for user, time := range total {
9696
if user.ID == 2 {
97-
assert.Equal(t, "1h 1min 2s", time)
97+
assert.Equal(t, "1h 1m 2s", time)
9898
} else if user.ID == 1 {
9999
assert.Equal(t, "20s", time)
100100
} else {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
-
2+
id: 1
3+
credential_id: "TVHE44TOH7DF7V48SEAIT3EMMJ7TGBOQ289E5AQB34S98LFCUFJ7U2NAVI8RJG6K2F4TC8AQ8KBNO7AGEOQOL9NE43GR63HTEHJSLOG="
4+
-
5+
id: 2
6+
credential_id: "TVHE44TOH7DF7V48SEAIT3EMMJ7TGBOQ289E5AQB34S98LFCUFJ7U2NAVI8RJG6K2F4TC8AQ8KBNO7AGEOQOL9NE43GR63HTEHJSLOG="
7+
-
8+
id: 3
9+
credential_id: "TVHE44TOH7DF7V48SEAIT3EMMJ7TGBOQ289E5AQB34S98LFCUFJ7U2NAVI8RJG6K2F4TC8AQ8KBNO7AGEOQOL9NE43GR63HTEHJSLOG="
10+
-
11+
id: 4
12+
credential_id: "TVHE44TOH7DF7V48SEAIT3EMMJ7TGBOQ289E5AQB34S98LFCUFJ7U2NAVI8RJG6K2F4TC8AQ8KBNO7AGEOQOL9NE43GR63HTEHJSLOG="
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
-
2+
id: 1
3+
name: "u2fkey-correctly-migrated"
4+
user_id: 1
5+
raw: 0x05040d0967a2cad045011631187576492a0beb5b377954b4f694c5afc8bdf25270f87f09a9ab6ce9c282f447ba71b2f2bae2105b32b847e0704f310f48644e3eddf240efe2e213b889daf3fc88e3952e8dd6b4cfd82f1a1212e2ab4b19389455ecf3e67f0aeafc91b9c0d413c9d6215a45177c1d5076358aa6ee20e1b30e3d7467cae2308202bd308201a5a00302010202041e8f8734300d06092a864886f70d01010b0500302e312c302a0603550403132359756269636f2055324620526f6f742043412053657269616c203435373230303633313020170d3134303830313030303030305a180f32303530303930343030303030305a306e310b300906035504061302534531123010060355040a0c0959756269636f20414231223020060355040b0c1941757468656e74696361746f72204174746573746174696f6e3127302506035504030c1e59756269636f205532462045452053657269616c203531323732323734303059301306072a8648ce3d020106082a8648ce3d03010703420004a879f82338ed1494bac0704bcc7fc663d1b271715976243101c7605115d7c1529e281c1c67322d384b5cd55dd3e9818d5fd85c22af326e0c64fc20afe33f2366a36c306a302206092b0601040182c40a020415312e332e362e312e342e312e34313438322e312e373013060b2b0601040182e51c0201010404030204303021060b2b0601040182e51c010104041204102fc0579f811347eab116bb5a8db9202a300c0603551d130101ff04023000300d06092a864886f70d01010b050003820101008693ff62df0d5779d4748d7fc8d10227318a8e580e6a3a57c108e94e03c38568b366894fce5624be4a3efd7f34118b3d993743f792a1989160c8fc9ae0b04e3df9ee15e3e88c04fc82a8dcbf5818e108dcc2968577ae79ff662b94734e3dec4597305d73e6e55ee2beb9cd9678ca0935e533eb638f8e26fabb817cda441fbe9831832ae5f6e2ad992f9ebbdb4c62238b8f8d7ab481d6d3263bcdbf9e4a57550370988ad5813440fa032cadb6723cadd8f8d7ba809f75b43cffa0a5b9add14232ef9d9e14812638233c4ca4a873b9f8ac98e32ba19167606e15909fcddb4a2dffbdae4620249f9a6646ac81e4832d1119febfaa731a882da25a77827d46d190173046022100b579338a44c236d3f214b2e150011a08cf251193ecfae2244edb0a5794e9b301022100fab468862c47d98204d437cf2be8c54a5a4ecd1ebb1c61a6c23da7b9c75f6841
6+
counter: 0
7+
- id: 2
8+
name: "u2fkey-incorrectly-migrated"
9+
user_id: 1
10+
raw: 0x05040d0967a2cad045011631187576492a0beb5b377954b4f694c5afc8bdf25270f87f09a9ab6ce9c282f447ba71b2f2bae2105b32b847e0704f310f48644e3eddf240efe2e213b889daf3fc88e3952e8dd6b4cfd82f1a1212e2ab4b19389455ecf3e67f0aeafc91b9c0d413c9d6215a45177c1d5076358aa6ee20e1b30e3d7467cae2308202bd308201a5a00302010202041e8f8734300d06092a864886f70d01010b0500302e312c302a0603550403132359756269636f2055324620526f6f742043412053657269616c203435373230303633313020170d3134303830313030303030305a180f32303530303930343030303030305a306e310b300906035504061302534531123010060355040a0c0959756269636f20414231223020060355040b0c1941757468656e74696361746f72204174746573746174696f6e3127302506035504030c1e59756269636f205532462045452053657269616c203531323732323734303059301306072a8648ce3d020106082a8648ce3d03010703420004a879f82338ed1494bac0704bcc7fc663d1b271715976243101c7605115d7c1529e281c1c67322d384b5cd55dd3e9818d5fd85c22af326e0c64fc20afe33f2366a36c306a302206092b0601040182c40a020415312e332e362e312e342e312e34313438322e312e373013060b2b0601040182e51c0201010404030204303021060b2b0601040182e51c010104041204102fc0579f811347eab116bb5a8db9202a300c0603551d130101ff04023000300d06092a864886f70d01010b050003820101008693ff62df0d5779d4748d7fc8d10227318a8e580e6a3a57c108e94e03c38568b366894fce5624be4a3efd7f34118b3d993743f792a1989160c8fc9ae0b04e3df9ee15e3e88c04fc82a8dcbf5818e108dcc2968577ae79ff662b94734e3dec4597305d73e6e55ee2beb9cd9678ca0935e533eb638f8e26fabb817cda441fbe9831832ae5f6e2ad992f9ebbdb4c62238b8f8d7ab481d6d3263bcdbf9e4a57550370988ad5813440fa032cadb6723cadd8f8d7ba809f75b43cffa0a5b9add14232ef9d9e14812638233c4ca4a873b9f8ac98e32ba19167606e15909fcddb4a2dffbdae4620249f9a6646ac81e4832d1119febfaa731a882da25a77827d46d190173046022100b579338a44c236d3f214b2e150011a08cf251193ecfae2244edb0a5794e9b301022100fab468862c47d98204d437cf2be8c54a5a4ecd1ebb1c61a6c23da7b9c75f6841
11+
counter: 0
12+
- id: 3
13+
name: "u2fkey-deleted"
14+
user_id: 1
15+
raw: 0x05040d0967a2cad045011631187576492a0beb5b377954b4f694c5afc8bdf25270f87f09a9ab6ce9c282f447ba71b2f2bae2105b32b847e0704f310f48644e3eddf240efe2e213b889daf3fc88e3952e8dd6b4cfd82f1a1212e2ab4b19389455ecf3e67f0aeafc91b9c0d413c9d6215a45177c1d5076358aa6ee20e1b30e3d7467cae2308202bd308201a5a00302010202041e8f8734300d06092a864886f70d01010b0500302e312c302a0603550403132359756269636f2055324620526f6f742043412053657269616c203435373230303633313020170d3134303830313030303030305a180f32303530303930343030303030305a306e310b300906035504061302534531123010060355040a0c0959756269636f20414231223020060355040b0c1941757468656e74696361746f72204174746573746174696f6e3127302506035504030c1e59756269636f205532462045452053657269616c203531323732323734303059301306072a8648ce3d020106082a8648ce3d03010703420004a879f82338ed1494bac0704bcc7fc663d1b271715976243101c7605115d7c1529e281c1c67322d384b5cd55dd3e9818d5fd85c22af326e0c64fc20afe33f2366a36c306a302206092b0601040182c40a020415312e332e362e312e342e312e34313438322e312e373013060b2b0601040182e51c0201010404030204303021060b2b0601040182e51c010104041204102fc0579f811347eab116bb5a8db9202a300c0603551d130101ff04023000300d06092a864886f70d01010b050003820101008693ff62df0d5779d4748d7fc8d10227318a8e580e6a3a57c108e94e03c38568b366894fce5624be4a3efd7f34118b3d993743f792a1989160c8fc9ae0b04e3df9ee15e3e88c04fc82a8dcbf5818e108dcc2968577ae79ff662b94734e3dec4597305d73e6e55ee2beb9cd9678ca0935e533eb638f8e26fabb817cda441fbe9831832ae5f6e2ad992f9ebbdb4c62238b8f8d7ab481d6d3263bcdbf9e4a57550370988ad5813440fa032cadb6723cadd8f8d7ba809f75b43cffa0a5b9add14232ef9d9e14812638233c4ca4a873b9f8ac98e32ba19167606e15909fcddb4a2dffbdae4620249f9a6646ac81e4832d1119febfaa731a882da25a77827d46d190173046022100b579338a44c236d3f214b2e150011a08cf251193ecfae2244edb0a5794e9b301022100fab468862c47d98204d437cf2be8c54a5a4ecd1ebb1c61a6c23da7b9c75f6841
16+
counter: 0
17+
- id: 4
18+
name: "u2fkey-wrong-user-id"
19+
user_id: 2
20+
raw: 0x05040d0967a2cad045011631187576492a0beb5b377954b4f694c5afc8bdf25270f87f09a9ab6ce9c282f447ba71b2f2bae2105b32b847e0704f310f48644e3eddf240efe2e213b889daf3fc88e3952e8dd6b4cfd82f1a1212e2ab4b19389455ecf3e67f0aeafc91b9c0d413c9d6215a45177c1d5076358aa6ee20e1b30e3d7467cae2308202bd308201a5a00302010202041e8f8734300d06092a864886f70d01010b0500302e312c302a0603550403132359756269636f2055324620526f6f742043412053657269616c203435373230303633313020170d3134303830313030303030305a180f32303530303930343030303030305a306e310b300906035504061302534531123010060355040a0c0959756269636f20414231223020060355040b0c1941757468656e74696361746f72204174746573746174696f6e3127302506035504030c1e59756269636f205532462045452053657269616c203531323732323734303059301306072a8648ce3d020106082a8648ce3d03010703420004a879f82338ed1494bac0704bcc7fc663d1b271715976243101c7605115d7c1529e281c1c67322d384b5cd55dd3e9818d5fd85c22af326e0c64fc20afe33f2366a36c306a302206092b0601040182c40a020415312e332e362e312e342e312e34313438322e312e373013060b2b0601040182e51c0201010404030204303021060b2b0601040182e51c010104041204102fc0579f811347eab116bb5a8db9202a300c0603551d130101ff04023000300d06092a864886f70d01010b050003820101008693ff62df0d5779d4748d7fc8d10227318a8e580e6a3a57c108e94e03c38568b366894fce5624be4a3efd7f34118b3d993743f792a1989160c8fc9ae0b04e3df9ee15e3e88c04fc82a8dcbf5818e108dcc2968577ae79ff662b94734e3dec4597305d73e6e55ee2beb9cd9678ca0935e533eb638f8e26fabb817cda441fbe9831832ae5f6e2ad992f9ebbdb4c62238b8f8d7ab481d6d3263bcdbf9e4a57550370988ad5813440fa032cadb6723cadd8f8d7ba809f75b43cffa0a5b9add14232ef9d9e14812638233c4ca4a873b9f8ac98e32ba19167606e15909fcddb4a2dffbdae4620249f9a6646ac81e4832d1119febfaa731a882da25a77827d46d190173046022100b579338a44c236d3f214b2e150011a08cf251193ecfae2244edb0a5794e9b301022100fab468862c47d98204d437cf2be8c54a5a4ecd1ebb1c61a6c23da7b9c75f6841
21+
counter: 0
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
-
2+
id: 1
3+
lower_name: "u2fkey-correctly-migrated"
4+
name: "u2fkey-correctly-migrated"
5+
user_id: 1
6+
credential_id: "TVHE44TOH7DF7V48SEAIT3EMMJ7TGBOQ289E5AQB34S98LFCUFJ7U2NAVI8RJG6K2F4TC8AQ8KBNO7AGEOQOL9NE43GR63HTEHJSLOG="
7+
public_key: 0x040d0967a2cad045011631187576492a0beb5b377954b4f694c5afc8bdf25270f87f09a9ab6ce9c282f447ba71b2f2bae2105b32b847e0704f310f48644e3eddf2
8+
attestation_type: 'fido-u2f'
9+
sign_count: 1
10+
clone_warning: false
11+
-
12+
id: 2
13+
lower_name: "u2fkey-incorrectly-migrated"
14+
name: "u2fkey-incorrectly-migrated"
15+
user_id: 1
16+
credential_id: "TVHE44TOH7DF7V48SEAIT3EMMJ7TGBOQ289E5AQB34S98LFCUFJ7U2NAVI8RJG6K2F4TC8A"
17+
public_key: 0x040d0967a2cad045011631187576492a0beb5b377954b4f694c5afc8bdf25270f87f09a9ab6ce9c282f447ba71b2f2bae2105b32b847e0704f310f48644e3eddf2
18+
attestation_type: 'fido-u2f'
19+
sign_count: 1
20+
clone_warning: false
21+
-
22+
id: 4
23+
lower_name: "u2fkey-wrong-user-id"
24+
name: "u2fkey-wrong-user-id"
25+
user_id: 1
26+
credential_id: "THIS SHOULD CHANGE"
27+
public_key: 0x040d0967a2cad045011631187576492a0beb5b377954b4f694c5afc8bdf25270f87f09a9ab6ce9c282f447ba71b2f2bae2105b32b847e0704f310f48644e3eddf2
28+
attestation_type: 'fido-u2f'
29+
sign_count: 1
30+
clone_warning: false

models/migrations/migrations.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,13 @@ var migrations = []Migration{
367367
// v206 -> v207
368368
NewMigration("Add authorize column to team_unit table", addAuthorizeColForTeamUnit),
369369
// v207 -> v208
370-
NewMigration("Add webauthn table and migrate u2f data to webauthn", addWebAuthnCred),
370+
NewMigration("Add webauthn table and migrate u2f data to webauthn - NO-OPED", addWebAuthnCred),
371371
// v208 -> v209
372-
NewMigration("Use base32.HexEncoding instead of base64 encoding for cred ID as it is case insensitive", useBase32HexForCredIDInWebAuthnCredential),
372+
NewMigration("Use base32.HexEncoding instead of base64 encoding for cred ID as it is case insensitive - NO-OPED", useBase32HexForCredIDInWebAuthnCredential),
373+
// v209 -> v210
374+
NewMigration("Increase WebAuthentication CredentialID size to 410 - NO-OPED", increaseCredentialIDTo410),
375+
// v210 -> v211
376+
NewMigration("v208 was completely broken - remigrate", remigrateU2FCredentials),
373377
}
374378

375379
// GetCurrentDBVersion returns the current db version

0 commit comments

Comments
 (0)