mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-09-13 03:31:58 +00:00
Allow to set custom trusted clone plugins (#4352)
Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Thomas Anderson <127358482+zc-devs@users.noreply.github.com> Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -98,7 +98,6 @@ type Compiler struct {
|
||||
defaultClonePlugin string
|
||||
trustedClonePlugins []string
|
||||
securityTrustedPipeline bool
|
||||
netrcOnlyTrusted bool
|
||||
}
|
||||
|
||||
// New creates a new Compiler with options.
|
||||
@@ -196,7 +195,7 @@ func (c *Compiler) Compile(conf *yaml_types.Workflow) (*backend_types.Config, er
|
||||
}
|
||||
|
||||
// only inject netrc if it's a trusted repo or a trusted plugin
|
||||
if !c.netrcOnlyTrusted || c.securityTrustedPipeline || (container.IsPlugin() && container.IsTrustedCloneImage(c.trustedClonePlugins)) {
|
||||
if c.securityTrustedPipeline || (container.IsPlugin() && container.IsTrustedCloneImage(c.trustedClonePlugins)) {
|
||||
for k, v := range c.cloneEnv {
|
||||
step.Environment[k] = v
|
||||
}
|
||||
@@ -252,7 +251,7 @@ func (c *Compiler) Compile(conf *yaml_types.Workflow) (*backend_types.Config, er
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// inject netrc if it's a trusted repo or a trusted clone-plugin
|
||||
// only inject netrc if it's a trusted repo or a trusted plugin
|
||||
if c.securityTrustedPipeline || (container.IsPlugin() && container.IsTrustedCloneImage(c.trustedClonePlugins)) {
|
||||
for k, v := range c.cloneEnv {
|
||||
step.Environment[k] = v
|
||||
|
@@ -176,13 +176,6 @@ func WithTrustedSecurity(trusted bool) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// WithNetrcOnlyTrusted configures the compiler with the netrcOnlyTrusted repo option.
|
||||
func WithNetrcOnlyTrusted(only bool) Option {
|
||||
return func(compiler *Compiler) {
|
||||
compiler.netrcOnlyTrusted = only
|
||||
}
|
||||
}
|
||||
|
||||
type ProxyOptions struct {
|
||||
NoProxy string
|
||||
HTTPProxy string
|
||||
|
Reference in New Issue
Block a user