Skip to content

Commit 9899a20

Browse files
authored
chore(deps): update to CTFd 3.7.7 and add accounts blacklist support (#142)
1 parent b0c2f86 commit 9899a20

File tree

7 files changed

+20
-4
lines changed

7 files changed

+20
-4
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
services:
1616
ctfd:
17-
image: ctfd/ctfd:3.7.5@sha256:7f456b23727286c9df2b58e0b7398cc0196e2b74e4c1c5b3cda7a5b71034637d
17+
image: ctfd/ctfd:3.7.7@sha256:9847758cdafc5ab86bdc121353dcf5a27a29ce313587270ee90a71bfbda2b910
1818
ports:
1919
- 8000:8000
2020
steps:

action.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ inputs:
3939
# Accounts
4040
accounts_domain_whitelist:
4141
description: 'The domain whitelist (a list separated by colons) to allow users to have email addresses from.'
42+
accounts_domain_blacklist:
43+
description: 'The domain blacklist (a list separated by colons) to block users to have email addresses from.'
4244
accounts_verify_emails:
4345
description: 'Whether to verify emails once a user register or not.'
4446
default: 'false'
@@ -169,6 +171,7 @@ runs:
169171
THEME_FOOTER: ${{ inputs.theme_footer }}
170172
THEME_SETTINGS: ${{ inputs.theme_settings }}
171173
ACCOUNTS_DOMAIN_WHITELIST: ${{ inputs.accounts_domain_whitelist }}
174+
ACCOUNTS_DOMAIN_BLACKLIST: ${{ inputs.accounts_domain_blacklist }}
172175
ACCOUNTS_VERIFY_EMAILS: ${{ inputs.accounts_verify_emails }}
173176
ACCOUNTS_TEAM_CREATION: ${{ inputs.accounts_team_creation }}
174177
ACCOUNTS_TEAM_SIZE: ${{ inputs.accounts_team_size }}

cmd/ctfd-setup/main.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ func main() {
129129
EnvVars: []string{"ACCOUNTS_DOMAIN_WHITELIST", "PLUGIN_ACCOUNTS_DOMAIN_WHITELIST"},
130130
Category: configuration,
131131
},
132+
&cli.StringFlag{
133+
Name: "accounts.domain_blacklist",
134+
Usage: "The domain blacklist (a list separated by colons) to block users to have email addresses from.",
135+
EnvVars: []string{"ACCOUNTS_DOMAIN_BLACKLIST", "PLUGIN_ACCOUNTS_DOMAIN_BLACKLIST"},
136+
Category: configuration,
137+
},
132138
&cli.BoolFlag{
133139
Name: "accounts.verify_emails",
134140
Usage: "Whether to verify emails once a user register or not.",
@@ -534,6 +540,7 @@ func run(ctx *cli.Context) error {
534540
},
535541
Accounts: &ctfdsetup.Accounts{
536542
DomainWhitelist: stringPtr(ctx, "accounts.domain_whitelist"),
543+
DomainBlacklist: stringPtr(ctx, "accounts.domain_blacklist"),
537544
VerifyEmails: ctx.Bool("accounts.verify_emails"),
538545
TeamCreation: boolPtr(ctx, "accounts.team_creation"),
539546
TeamSize: intPtr(ctx, "accounts.team_size"),

config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ type (
7474
// The domain whitelist (a list separated by colons) to allow users to have email addresses from.
7575
DomainWhitelist *string `yaml:"domain_whitelist,omitempty" json:"domain_whitelist,omitempty"`
7676

77+
// The domain blacklist (a list separated by colons) to blocks users to have email addresses from.
78+
DomainBlacklist *string `yaml:"domain_blacklist,omitempty" json:"domain_blacklist,omitempty"`
79+
7780
// Whether to verify emails once a user register or not.
7881
VerifyEmails bool `yaml:"verify_emails,omitempty" json:"verify_emails,omitempty"`
7982

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/ctfer-io/ctfd-setup
33
go 1.22.2
44

55
require (
6-
github.com/ctfer-io/go-ctfd v0.11.0
6+
github.com/ctfer-io/go-ctfd v0.12.0
77
github.com/invopop/jsonschema v0.13.0
88
github.com/pkg/errors v0.9.1
99
github.com/stretchr/testify v1.10.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMU
44
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
55
github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc=
66
github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
7-
github.com/ctfer-io/go-ctfd v0.11.0 h1:4Rdya1kgT5clYuoLmIeRBplTVLJoLUVGcp7DE4GfwoE=
8-
github.com/ctfer-io/go-ctfd v0.11.0/go.mod h1:ebgSW8LdP/qtRCpglK4djBp+g6kU5YM98XBZKowiCeY=
7+
github.com/ctfer-io/go-ctfd v0.12.0 h1:HiftQofP/NQ7FlHfc8dqYM5fuLAlGkv2bP3KbveA8bk=
8+
github.com/ctfer-io/go-ctfd v0.12.0/go.mod h1:ebgSW8LdP/qtRCpglK4djBp+g6kU5YM98XBZKowiCeY=
99
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1010
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
1111
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

setup.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ func updateSetup(ctx context.Context, client *api.Client, conf *Config) error {
9595
return errors.Wrap(err, "patching CTF logo")
9696
}
9797
}
98+
// TODO else delete logo
9899

99100
// Push small icon
100101
if conf.Theme.SmallIcon.Name != "" {
@@ -112,6 +113,7 @@ func updateSetup(ctx context.Context, client *api.Client, conf *Config) error {
112113
return errors.Wrap(err, "patching CTF small icon")
113114
}
114115
}
116+
// TODO else delete small icon
115117

116118
// Update configs attributes
117119
params := &api.PatchConfigsParams{
@@ -123,6 +125,7 @@ func updateSetup(ctx context.Context, client *api.Client, conf *Config) error {
123125
ThemeHeader: ptr(string(conf.Theme.Header.Content)),
124126
ThemeSettings: ptr(string(conf.Theme.Settings.Content)),
125127
DomainWhitelist: conf.Accounts.DomainWhitelist,
128+
DomainBlacklist: conf.Accounts.DomainBlacklist,
126129
IncorrectSubmissionsPerMin: conf.Accounts.IncorrectSubmissionsPerMinute,
127130
NameChanges: conf.Accounts.NameChanges,
128131
NumTeams: conf.Accounts.NumTeams,

0 commit comments

Comments
 (0)