Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
songlinfeng
container-toolkit
Commits
d7e13eb9
Commit
d7e13eb9
authored
Oct 22, 2025
by
songlinfeng
Browse files
add dtk-container-toolkit
parent
fcdba4f3
Changes
345
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1764 additions
and
0 deletions
+1764
-0
vendor/github.com/opencontainers/runtime-tools/generate/seccomp/parse_action.go
...containers/runtime-tools/generate/seccomp/parse_action.go
+135
-0
vendor/github.com/opencontainers/runtime-tools/generate/seccomp/parse_architecture.go
...ners/runtime-tools/generate/seccomp/parse_architecture.go
+55
-0
vendor/github.com/opencontainers/runtime-tools/generate/seccomp/parse_arguments.go
...tainers/runtime-tools/generate/seccomp/parse_arguments.go
+73
-0
vendor/github.com/opencontainers/runtime-tools/generate/seccomp/parse_remove.go
...containers/runtime-tools/generate/seccomp/parse_remove.go
+52
-0
vendor/github.com/opencontainers/runtime-tools/generate/seccomp/seccomp_default.go
...tainers/runtime-tools/generate/seccomp/seccomp_default.go
+606
-0
vendor/github.com/opencontainers/runtime-tools/generate/seccomp/seccomp_default_linux.go
...s/runtime-tools/generate/seccomp/seccomp_default_linux.go
+17
-0
vendor/github.com/opencontainers/runtime-tools/generate/seccomp/seccomp_default_unsupported.go
...ime-tools/generate/seccomp/seccomp_default_unsupported.go
+16
-0
vendor/github.com/opencontainers/runtime-tools/generate/seccomp/syscall_compare.go
...tainers/runtime-tools/generate/seccomp/syscall_compare.go
+124
-0
vendor/github.com/opencontainers/runtime-tools/validate/capabilities/validate.go
...ontainers/runtime-tools/validate/capabilities/validate.go
+31
-0
vendor/github.com/opencontainers/runtime-tools/validate/capabilities/validate_linux.go
...ers/runtime-tools/validate/capabilities/validate_linux.go
+16
-0
vendor/github.com/opencontainers/runtime-tools/validate/capabilities/validate_unsupported.go
...ntime-tools/validate/capabilities/validate_unsupported.go
+13
-0
vendor/github.com/pelletier/go-toml/.dockerignore
vendor/github.com/pelletier/go-toml/.dockerignore
+2
-0
vendor/github.com/pelletier/go-toml/.gitignore
vendor/github.com/pelletier/go-toml/.gitignore
+5
-0
vendor/github.com/pelletier/go-toml/CONTRIBUTING.md
vendor/github.com/pelletier/go-toml/CONTRIBUTING.md
+132
-0
vendor/github.com/pelletier/go-toml/Dockerfile
vendor/github.com/pelletier/go-toml/Dockerfile
+11
-0
vendor/github.com/pelletier/go-toml/LICENSE
vendor/github.com/pelletier/go-toml/LICENSE
+247
-0
vendor/github.com/pelletier/go-toml/Makefile
vendor/github.com/pelletier/go-toml/Makefile
+29
-0
vendor/github.com/pelletier/go-toml/PULL_REQUEST_TEMPLATE.md
vendor/github.com/pelletier/go-toml/PULL_REQUEST_TEMPLATE.md
+5
-0
vendor/github.com/pelletier/go-toml/README.md
vendor/github.com/pelletier/go-toml/README.md
+176
-0
vendor/github.com/pelletier/go-toml/SECURITY.md
vendor/github.com/pelletier/go-toml/SECURITY.md
+19
-0
No files found.
Too many changes to show.
To preserve performance only
345 of 345+
files are displayed.
Plain diff
Email patch
vendor/github.com/opencontainers/runtime-tools/generate/seccomp/parse_action.go
0 → 100644
View file @
d7e13eb9
package
seccomp
import
(
"fmt"
"strconv"
"strings"
rspec
"github.com/opencontainers/runtime-spec/specs-go"
)
// SyscallOpts contain options for parsing syscall rules
type
SyscallOpts
struct
{
Action
string
Syscall
string
Index
string
Value
string
ValueTwo
string
Operator
string
}
// ParseSyscallFlag takes a SyscallOpts struct and the seccomp configuration
// and sets the new syscall rule accordingly
func
ParseSyscallFlag
(
args
SyscallOpts
,
config
*
rspec
.
LinuxSeccomp
)
error
{
var
arguments
[]
string
if
args
.
Index
!=
""
&&
args
.
Value
!=
""
&&
args
.
ValueTwo
!=
""
&&
args
.
Operator
!=
""
{
arguments
=
[]
string
{
args
.
Action
,
args
.
Syscall
,
args
.
Index
,
args
.
Value
,
args
.
ValueTwo
,
args
.
Operator
}
}
else
{
arguments
=
[]
string
{
args
.
Action
,
args
.
Syscall
}
}
action
,
_
:=
parseAction
(
arguments
[
0
])
if
action
==
config
.
DefaultAction
&&
args
.
argsAreEmpty
()
{
// default already set, no need to make changes
return
nil
}
var
newSyscall
rspec
.
LinuxSyscall
numOfArgs
:=
len
(
arguments
)
if
numOfArgs
==
6
||
numOfArgs
==
2
{
argStruct
,
err
:=
parseArguments
(
arguments
[
1
:
])
if
err
!=
nil
{
return
err
}
newSyscall
=
newSyscallStruct
(
arguments
[
1
],
action
,
argStruct
)
}
else
{
return
fmt
.
Errorf
(
"incorrect number of arguments to ParseSyscall: %d"
,
numOfArgs
)
}
descison
,
err
:=
decideCourseOfAction
(
&
newSyscall
,
config
.
Syscalls
)
if
err
!=
nil
{
return
err
}
delimDescison
:=
strings
.
Split
(
descison
,
":"
)
if
delimDescison
[
0
]
==
seccompAppend
{
config
.
Syscalls
=
append
(
config
.
Syscalls
,
newSyscall
)
}
if
delimDescison
[
0
]
==
seccompOverwrite
{
indexForOverwrite
,
err
:=
strconv
.
ParseInt
(
delimDescison
[
1
],
10
,
32
)
if
err
!=
nil
{
return
err
}
config
.
Syscalls
[
indexForOverwrite
]
=
newSyscall
}
return
nil
}
var
actions
=
map
[
string
]
rspec
.
LinuxSeccompAction
{
"allow"
:
rspec
.
ActAllow
,
"errno"
:
rspec
.
ActErrno
,
"kill"
:
rspec
.
ActKill
,
"trace"
:
rspec
.
ActTrace
,
"trap"
:
rspec
.
ActTrap
,
}
// Take passed action, return the SCMP_ACT_<ACTION> version of it
func
parseAction
(
action
string
)
(
rspec
.
LinuxSeccompAction
,
error
)
{
a
,
ok
:=
actions
[
action
]
if
!
ok
{
return
""
,
fmt
.
Errorf
(
"unrecognized action: %s"
,
action
)
}
return
a
,
nil
}
// ParseDefaultAction sets the default action of the seccomp configuration
// and then removes any rules that were already specified with this action
func
ParseDefaultAction
(
action
string
,
config
*
rspec
.
LinuxSeccomp
)
error
{
if
action
==
""
{
return
nil
}
defaultAction
,
err
:=
parseAction
(
action
)
if
err
!=
nil
{
return
err
}
config
.
DefaultAction
=
defaultAction
err
=
RemoveAllMatchingRules
(
config
,
defaultAction
)
if
err
!=
nil
{
return
err
}
return
nil
}
// ParseDefaultActionForce simply sets the default action of the seccomp configuration
func
ParseDefaultActionForce
(
action
string
,
config
*
rspec
.
LinuxSeccomp
)
error
{
if
action
==
""
{
return
nil
}
defaultAction
,
err
:=
parseAction
(
action
)
if
err
!=
nil
{
return
err
}
config
.
DefaultAction
=
defaultAction
return
nil
}
func
newSyscallStruct
(
name
string
,
action
rspec
.
LinuxSeccompAction
,
args
[]
rspec
.
LinuxSeccompArg
)
rspec
.
LinuxSyscall
{
syscallStruct
:=
rspec
.
LinuxSyscall
{
Names
:
[]
string
{
name
},
Action
:
action
,
Args
:
args
,
}
return
syscallStruct
}
func
(
s
SyscallOpts
)
argsAreEmpty
()
bool
{
return
(
s
.
Index
==
""
&&
s
.
Value
==
""
&&
s
.
ValueTwo
==
""
&&
s
.
Operator
==
""
)
}
vendor/github.com/opencontainers/runtime-tools/generate/seccomp/parse_architecture.go
0 → 100644
View file @
d7e13eb9
package
seccomp
import
(
"fmt"
rspec
"github.com/opencontainers/runtime-spec/specs-go"
)
// ParseArchitectureFlag takes the raw string passed with the --arch flag, parses it
// and updates the Seccomp config accordingly
func
ParseArchitectureFlag
(
architectureArg
string
,
config
*
rspec
.
LinuxSeccomp
)
error
{
correctedArch
,
err
:=
parseArch
(
architectureArg
)
if
err
!=
nil
{
return
err
}
shouldAppend
:=
true
for
_
,
alreadySpecified
:=
range
config
.
Architectures
{
if
correctedArch
==
alreadySpecified
{
shouldAppend
=
false
}
}
if
shouldAppend
{
config
.
Architectures
=
append
(
config
.
Architectures
,
correctedArch
)
}
return
nil
}
func
parseArch
(
arch
string
)
(
rspec
.
Arch
,
error
)
{
arches
:=
map
[
string
]
rspec
.
Arch
{
"x86"
:
rspec
.
ArchX86
,
"amd64"
:
rspec
.
ArchX86_64
,
"x32"
:
rspec
.
ArchX32
,
"arm"
:
rspec
.
ArchARM
,
"arm64"
:
rspec
.
ArchAARCH64
,
"mips"
:
rspec
.
ArchMIPS
,
"mips64"
:
rspec
.
ArchMIPS64
,
"mips64n32"
:
rspec
.
ArchMIPS64N32
,
"mipsel"
:
rspec
.
ArchMIPSEL
,
"mipsel64"
:
rspec
.
ArchMIPSEL64
,
"mipsel64n32"
:
rspec
.
ArchMIPSEL64N32
,
"parisc"
:
rspec
.
ArchPARISC
,
"parisc64"
:
rspec
.
ArchPARISC64
,
"ppc"
:
rspec
.
ArchPPC
,
"ppc64"
:
rspec
.
ArchPPC64
,
"ppc64le"
:
rspec
.
ArchPPC64LE
,
"s390"
:
rspec
.
ArchS390
,
"s390x"
:
rspec
.
ArchS390X
,
}
a
,
ok
:=
arches
[
arch
]
if
!
ok
{
return
""
,
fmt
.
Errorf
(
"unrecognized architecture: %s"
,
arch
)
}
return
a
,
nil
}
vendor/github.com/opencontainers/runtime-tools/generate/seccomp/parse_arguments.go
0 → 100644
View file @
d7e13eb9
package
seccomp
import
(
"fmt"
"strconv"
rspec
"github.com/opencontainers/runtime-spec/specs-go"
)
// parseArguments takes a list of arguments (delimArgs). It parses and fills out
// the argument information and returns a slice of arg structs
func
parseArguments
(
delimArgs
[]
string
)
([]
rspec
.
LinuxSeccompArg
,
error
)
{
nilArgSlice
:=
[]
rspec
.
LinuxSeccompArg
{}
numberOfArgs
:=
len
(
delimArgs
)
// No parameters passed with syscall
if
numberOfArgs
==
1
{
return
nilArgSlice
,
nil
}
// Correct number of parameters passed with syscall
if
numberOfArgs
==
5
{
syscallIndex
,
err
:=
strconv
.
ParseUint
(
delimArgs
[
1
],
10
,
0
)
if
err
!=
nil
{
return
nilArgSlice
,
err
}
syscallValue
,
err
:=
strconv
.
ParseUint
(
delimArgs
[
2
],
10
,
64
)
if
err
!=
nil
{
return
nilArgSlice
,
err
}
syscallValueTwo
,
err
:=
strconv
.
ParseUint
(
delimArgs
[
3
],
10
,
64
)
if
err
!=
nil
{
return
nilArgSlice
,
err
}
syscallOp
,
err
:=
parseOperator
(
delimArgs
[
4
])
if
err
!=
nil
{
return
nilArgSlice
,
err
}
argStruct
:=
rspec
.
LinuxSeccompArg
{
Index
:
uint
(
syscallIndex
),
Value
:
syscallValue
,
ValueTwo
:
syscallValueTwo
,
Op
:
syscallOp
,
}
argSlice
:=
[]
rspec
.
LinuxSeccompArg
{}
argSlice
=
append
(
argSlice
,
argStruct
)
return
argSlice
,
nil
}
return
nilArgSlice
,
fmt
.
Errorf
(
"incorrect number of arguments passed with syscall: %d"
,
numberOfArgs
)
}
func
parseOperator
(
operator
string
)
(
rspec
.
LinuxSeccompOperator
,
error
)
{
operators
:=
map
[
string
]
rspec
.
LinuxSeccompOperator
{
"NE"
:
rspec
.
OpNotEqual
,
"LT"
:
rspec
.
OpLessThan
,
"LE"
:
rspec
.
OpLessEqual
,
"EQ"
:
rspec
.
OpEqualTo
,
"GE"
:
rspec
.
OpGreaterEqual
,
"GT"
:
rspec
.
OpGreaterThan
,
"ME"
:
rspec
.
OpMaskedEqual
,
}
o
,
ok
:=
operators
[
operator
]
if
!
ok
{
return
""
,
fmt
.
Errorf
(
"unrecognized operator: %s"
,
operator
)
}
return
o
,
nil
}
vendor/github.com/opencontainers/runtime-tools/generate/seccomp/parse_remove.go
0 → 100644
View file @
d7e13eb9
package
seccomp
import
(
"fmt"
"reflect"
"strings"
rspec
"github.com/opencontainers/runtime-spec/specs-go"
)
// RemoveAction takes the argument string that was passed with the --remove flag,
// parses it, and updates the Seccomp config accordingly
func
RemoveAction
(
arguments
string
,
config
*
rspec
.
LinuxSeccomp
)
error
{
if
config
==
nil
{
return
fmt
.
Errorf
(
"Cannot remove action from nil Seccomp pointer"
)
}
syscallsToRemove
:=
strings
.
Split
(
arguments
,
","
)
for
counter
,
syscallStruct
:=
range
config
.
Syscalls
{
if
reflect
.
DeepEqual
(
syscallsToRemove
,
syscallStruct
.
Names
)
{
config
.
Syscalls
=
append
(
config
.
Syscalls
[
:
counter
],
config
.
Syscalls
[
counter
+
1
:
]
...
)
}
}
return
nil
}
// RemoveAllSeccompRules removes all seccomp syscall rules
func
RemoveAllSeccompRules
(
config
*
rspec
.
LinuxSeccomp
)
error
{
if
config
==
nil
{
return
fmt
.
Errorf
(
"Cannot remove action from nil Seccomp pointer"
)
}
newSyscallSlice
:=
[]
rspec
.
LinuxSyscall
{}
config
.
Syscalls
=
newSyscallSlice
return
nil
}
// RemoveAllMatchingRules will remove any syscall rules that match the specified action
func
RemoveAllMatchingRules
(
config
*
rspec
.
LinuxSeccomp
,
seccompAction
rspec
.
LinuxSeccompAction
)
error
{
if
config
==
nil
{
return
fmt
.
Errorf
(
"Cannot remove action from nil Seccomp pointer"
)
}
for
_
,
syscall
:=
range
config
.
Syscalls
{
if
reflect
.
DeepEqual
(
syscall
.
Action
,
seccompAction
)
{
RemoveAction
(
strings
.
Join
(
syscall
.
Names
,
","
),
config
)
}
}
return
nil
}
vendor/github.com/opencontainers/runtime-tools/generate/seccomp/seccomp_default.go
0 → 100644
View file @
d7e13eb9
package
seccomp
import
(
"runtime"
"github.com/opencontainers/runtime-spec/specs-go"
rspec
"github.com/opencontainers/runtime-spec/specs-go"
)
func
arches
()
[]
rspec
.
Arch
{
native
:=
runtime
.
GOARCH
switch
native
{
case
"amd64"
:
return
[]
rspec
.
Arch
{
rspec
.
ArchX86_64
,
rspec
.
ArchX86
,
rspec
.
ArchX32
}
case
"arm64"
:
return
[]
rspec
.
Arch
{
rspec
.
ArchARM
,
rspec
.
ArchAARCH64
}
case
"mips64"
:
return
[]
rspec
.
Arch
{
rspec
.
ArchMIPS
,
rspec
.
ArchMIPS64
,
rspec
.
ArchMIPS64N32
}
case
"mips64n32"
:
return
[]
rspec
.
Arch
{
rspec
.
ArchMIPS
,
rspec
.
ArchMIPS64
,
rspec
.
ArchMIPS64N32
}
case
"mipsel64"
:
return
[]
rspec
.
Arch
{
rspec
.
ArchMIPSEL
,
rspec
.
ArchMIPSEL64
,
rspec
.
ArchMIPSEL64N32
}
case
"mipsel64n32"
:
return
[]
rspec
.
Arch
{
rspec
.
ArchMIPSEL
,
rspec
.
ArchMIPSEL64
,
rspec
.
ArchMIPSEL64N32
}
case
"s390x"
:
return
[]
rspec
.
Arch
{
rspec
.
ArchS390
,
rspec
.
ArchS390X
}
default
:
return
[]
rspec
.
Arch
{}
}
}
// DefaultProfile defines the whitelist for the default seccomp profile.
func
DefaultProfile
(
rs
*
specs
.
Spec
)
*
rspec
.
LinuxSeccomp
{
syscalls
:=
[]
rspec
.
LinuxSyscall
{
{
Names
:
[]
string
{
"accept"
,
"accept4"
,
"access"
,
"alarm"
,
"bind"
,
"brk"
,
"capget"
,
"capset"
,
"chdir"
,
"chmod"
,
"chown"
,
"chown32"
,
"clock_getres"
,
"clock_gettime"
,
"clock_nanosleep"
,
"close"
,
"connect"
,
"copy_file_range"
,
"creat"
,
"dup"
,
"dup2"
,
"dup3"
,
"epoll_create"
,
"epoll_create1"
,
"epoll_ctl"
,
"epoll_ctl_old"
,
"epoll_pwait"
,
"epoll_wait"
,
"epoll_wait_old"
,
"eventfd"
,
"eventfd2"
,
"execve"
,
"execveat"
,
"exit"
,
"exit_group"
,
"faccessat"
,
"fadvise64"
,
"fadvise64_64"
,
"fallocate"
,
"fanotify_mark"
,
"fchdir"
,
"fchmod"
,
"fchmodat"
,
"fchown"
,
"fchown32"
,
"fchownat"
,
"fcntl"
,
"fcntl64"
,
"fdatasync"
,
"fgetxattr"
,
"flistxattr"
,
"flock"
,
"fork"
,
"fremovexattr"
,
"fsetxattr"
,
"fstat"
,
"fstat64"
,
"fstatat64"
,
"fstatfs"
,
"fstatfs64"
,
"fsync"
,
"ftruncate"
,
"ftruncate64"
,
"futex"
,
"futimesat"
,
"getcpu"
,
"getcwd"
,
"getdents"
,
"getdents64"
,
"getegid"
,
"getegid32"
,
"geteuid"
,
"geteuid32"
,
"getgid"
,
"getgid32"
,
"getgroups"
,
"getgroups32"
,
"getitimer"
,
"getpeername"
,
"getpgid"
,
"getpgrp"
,
"getpid"
,
"getppid"
,
"getpriority"
,
"getrandom"
,
"getresgid"
,
"getresgid32"
,
"getresuid"
,
"getresuid32"
,
"getrlimit"
,
"get_robust_list"
,
"getrusage"
,
"getsid"
,
"getsockname"
,
"getsockopt"
,
"get_thread_area"
,
"gettid"
,
"gettimeofday"
,
"getuid"
,
"getuid32"
,
"getxattr"
,
"inotify_add_watch"
,
"inotify_init"
,
"inotify_init1"
,
"inotify_rm_watch"
,
"io_cancel"
,
"ioctl"
,
"io_destroy"
,
"io_getevents"
,
"ioprio_get"
,
"ioprio_set"
,
"io_setup"
,
"io_submit"
,
"ipc"
,
"kill"
,
"landlock_add_rule"
,
"landlock_create_ruleset"
,
"landlock_restrict_self"
,
"lchown"
,
"lchown32"
,
"lgetxattr"
,
"link"
,
"linkat"
,
"listen"
,
"listxattr"
,
"llistxattr"
,
"_llseek"
,
"lremovexattr"
,
"lseek"
,
"lsetxattr"
,
"lstat"
,
"lstat64"
,
"madvise"
,
"memfd_create"
,
"mincore"
,
"mkdir"
,
"mkdirat"
,
"mknod"
,
"mknodat"
,
"mlock"
,
"mlock2"
,
"mlockall"
,
"mmap"
,
"mmap2"
,
"mprotect"
,
"mq_getsetattr"
,
"mq_notify"
,
"mq_open"
,
"mq_timedreceive"
,
"mq_timedsend"
,
"mq_unlink"
,
"mremap"
,
"msgctl"
,
"msgget"
,
"msgrcv"
,
"msgsnd"
,
"msync"
,
"munlock"
,
"munlockall"
,
"munmap"
,
"nanosleep"
,
"newfstatat"
,
"_newselect"
,
"open"
,
"openat"
,
"pause"
,
"pipe"
,
"pipe2"
,
"poll"
,
"ppoll"
,
"prctl"
,
"pread64"
,
"preadv"
,
"prlimit64"
,
"pselect6"
,
"pwrite64"
,
"pwritev"
,
"read"
,
"readahead"
,
"readlink"
,
"readlinkat"
,
"readv"
,
"recv"
,
"recvfrom"
,
"recvmmsg"
,
"recvmsg"
,
"remap_file_pages"
,
"removexattr"
,
"rename"
,
"renameat"
,
"renameat2"
,
"restart_syscall"
,
"rmdir"
,
"rt_sigaction"
,
"rt_sigpending"
,
"rt_sigprocmask"
,
"rt_sigqueueinfo"
,
"rt_sigreturn"
,
"rt_sigsuspend"
,
"rt_sigtimedwait"
,
"rt_tgsigqueueinfo"
,
"sched_getaffinity"
,
"sched_getattr"
,
"sched_getparam"
,
"sched_get_priority_max"
,
"sched_get_priority_min"
,
"sched_getscheduler"
,
"sched_rr_get_interval"
,
"sched_setaffinity"
,
"sched_setattr"
,
"sched_setparam"
,
"sched_setscheduler"
,
"sched_yield"
,
"seccomp"
,
"select"
,
"semctl"
,
"semget"
,
"semop"
,
"semtimedop"
,
"send"
,
"sendfile"
,
"sendfile64"
,
"sendmmsg"
,
"sendmsg"
,
"sendto"
,
"setfsgid"
,
"setfsgid32"
,
"setfsuid"
,
"setfsuid32"
,
"setgid"
,
"setgid32"
,
"setgroups"
,
"setgroups32"
,
"setitimer"
,
"setpgid"
,
"setpriority"
,
"setregid"
,
"setregid32"
,
"setresgid"
,
"setresgid32"
,
"setresuid"
,
"setresuid32"
,
"setreuid"
,
"setreuid32"
,
"setrlimit"
,
"set_robust_list"
,
"setsid"
,
"setsockopt"
,
"set_thread_area"
,
"set_tid_address"
,
"setuid"
,
"setuid32"
,
"setxattr"
,
"shmat"
,
"shmctl"
,
"shmdt"
,
"shmget"
,
"shutdown"
,
"sigaltstack"
,
"signalfd"
,
"signalfd4"
,
"sigreturn"
,
"socket"
,
"socketcall"
,
"socketpair"
,
"splice"
,
"stat"
,
"stat64"
,
"statfs"
,
"statfs64"
,
"statx"
,
"symlink"
,
"symlinkat"
,
"sync"
,
"sync_file_range"
,
"syncfs"
,
"sysinfo"
,
"syslog"
,
"tee"
,
"tgkill"
,
"time"
,
"timer_create"
,
"timer_delete"
,
"timerfd_create"
,
"timerfd_gettime"
,
"timerfd_settime"
,
"timer_getoverrun"
,
"timer_gettime"
,
"timer_settime"
,
"times"
,
"tkill"
,
"truncate"
,
"truncate64"
,
"ugetrlimit"
,
"umask"
,
"uname"
,
"unlink"
,
"unlinkat"
,
"utime"
,
"utimensat"
,
"utimes"
,
"vfork"
,
"vmsplice"
,
"wait4"
,
"waitid"
,
"waitpid"
,
"write"
,
"writev"
,
},
Action
:
rspec
.
ActAllow
,
Args
:
[]
rspec
.
LinuxSeccompArg
{},
},
{
Names
:
[]
string
{
"personality"
},
Action
:
rspec
.
ActAllow
,
Args
:
[]
rspec
.
LinuxSeccompArg
{
{
Index
:
0
,
Value
:
0x0
,
Op
:
rspec
.
OpEqualTo
,
},
},
},
{
Names
:
[]
string
{
"personality"
},
Action
:
rspec
.
ActAllow
,
Args
:
[]
rspec
.
LinuxSeccompArg
{
{
Index
:
0
,
Value
:
0x0008
,
Op
:
rspec
.
OpEqualTo
,
},
},
},
{
Names
:
[]
string
{
"personality"
},
Action
:
rspec
.
ActAllow
,
Args
:
[]
rspec
.
LinuxSeccompArg
{
{
Index
:
0
,
Value
:
0xffffffff
,
Op
:
rspec
.
OpEqualTo
,
},
},
},
}
var
sysCloneFlagsIndex
uint
capSysAdmin
:=
false
caps
:=
make
(
map
[
string
]
bool
)
for
_
,
cap
:=
range
rs
.
Process
.
Capabilities
.
Bounding
{
caps
[
cap
]
=
true
}
for
_
,
cap
:=
range
rs
.
Process
.
Capabilities
.
Effective
{
caps
[
cap
]
=
true
}
for
_
,
cap
:=
range
rs
.
Process
.
Capabilities
.
Inheritable
{
caps
[
cap
]
=
true
}
for
_
,
cap
:=
range
rs
.
Process
.
Capabilities
.
Permitted
{
caps
[
cap
]
=
true
}
for
_
,
cap
:=
range
rs
.
Process
.
Capabilities
.
Ambient
{
caps
[
cap
]
=
true
}
for
cap
:=
range
caps
{
switch
cap
{
case
"CAP_DAC_READ_SEARCH"
:
syscalls
=
append
(
syscalls
,
[]
rspec
.
LinuxSyscall
{
{
Names
:
[]
string
{
"open_by_handle_at"
},
Action
:
rspec
.
ActAllow
,
Args
:
[]
rspec
.
LinuxSeccompArg
{},
},
}
...
)
case
"CAP_SYS_ADMIN"
:
capSysAdmin
=
true
syscalls
=
append
(
syscalls
,
[]
rspec
.
LinuxSyscall
{
{
Names
:
[]
string
{
"bpf"
,
"clone"
,
"fanotify_init"
,
"lookup_dcookie"
,
"mount"
,
"name_to_handle_at"
,
"perf_event_open"
,
"setdomainname"
,
"sethostname"
,
"setns"
,
"umount"
,
"umount2"
,
"unshare"
,
},
Action
:
rspec
.
ActAllow
,
Args
:
[]
rspec
.
LinuxSeccompArg
{},
},
}
...
)
case
"CAP_SYS_BOOT"
:
syscalls
=
append
(
syscalls
,
[]
rspec
.
LinuxSyscall
{
{
Names
:
[]
string
{
"reboot"
},
Action
:
rspec
.
ActAllow
,
Args
:
[]
rspec
.
LinuxSeccompArg
{},
},
}
...
)
case
"CAP_SYS_CHROOT"
:
syscalls
=
append
(
syscalls
,
[]
rspec
.
LinuxSyscall
{
{
Names
:
[]
string
{
"chroot"
},
Action
:
rspec
.
ActAllow
,
Args
:
[]
rspec
.
LinuxSeccompArg
{},
},
}
...
)
case
"CAP_SYS_MODULE"
:
syscalls
=
append
(
syscalls
,
[]
rspec
.
LinuxSyscall
{
{
Names
:
[]
string
{
"delete_module"
,
"init_module"
,
"finit_module"
,
"query_module"
,
},
Action
:
rspec
.
ActAllow
,
Args
:
[]
rspec
.
LinuxSeccompArg
{},
},
}
...
)
case
"CAP_SYS_PACCT"
:
syscalls
=
append
(
syscalls
,
[]
rspec
.
LinuxSyscall
{
{
Names
:
[]
string
{
"acct"
},
Action
:
rspec
.
ActAllow
,
Args
:
[]
rspec
.
LinuxSeccompArg
{},
},
}
...
)
case
"CAP_SYS_PTRACE"
:
syscalls
=
append
(
syscalls
,
[]
rspec
.
LinuxSyscall
{
{
Names
:
[]
string
{
"kcmp"
,
"process_vm_readv"
,
"process_vm_writev"
,
"ptrace"
,
},
Action
:
rspec
.
ActAllow
,
Args
:
[]
rspec
.
LinuxSeccompArg
{},
},
}
...
)
case
"CAP_SYS_RAWIO"
:
syscalls
=
append
(
syscalls
,
[]
rspec
.
LinuxSyscall
{
{
Names
:
[]
string
{
"iopl"
,
"ioperm"
,
},
Action
:
rspec
.
ActAllow
,
Args
:
[]
rspec
.
LinuxSeccompArg
{},
},
}
...
)
case
"CAP_SYS_TIME"
:
syscalls
=
append
(
syscalls
,
[]
rspec
.
LinuxSyscall
{
{
Names
:
[]
string
{
"settimeofday"
,
"stime"
,
"adjtimex"
,
},
Action
:
rspec
.
ActAllow
,
Args
:
[]
rspec
.
LinuxSeccompArg
{},
},
}
...
)
case
"CAP_SYS_TTY_CONFIG"
:
syscalls
=
append
(
syscalls
,
[]
rspec
.
LinuxSyscall
{
{
Names
:
[]
string
{
"vhangup"
},
Action
:
rspec
.
ActAllow
,
Args
:
[]
rspec
.
LinuxSeccompArg
{},
},
}
...
)
}
}
if
!
capSysAdmin
{
syscalls
=
append
(
syscalls
,
[]
rspec
.
LinuxSyscall
{
{
Names
:
[]
string
{
"clone"
},
Action
:
rspec
.
ActAllow
,
Args
:
[]
rspec
.
LinuxSeccompArg
{
{
Index
:
sysCloneFlagsIndex
,
Value
:
CloneNewNS
|
CloneNewUTS
|
CloneNewIPC
|
CloneNewUser
|
CloneNewPID
|
CloneNewNet
|
CloneNewCgroup
,
ValueTwo
:
0
,
Op
:
rspec
.
OpMaskedEqual
,
},
},
},
}
...
)
}
arch
:=
runtime
.
GOARCH
switch
arch
{
case
"arm"
,
"arm64"
:
syscalls
=
append
(
syscalls
,
[]
rspec
.
LinuxSyscall
{
{
Names
:
[]
string
{
"breakpoint"
,
"cacheflush"
,
"set_tls"
,
},
Action
:
rspec
.
ActAllow
,
Args
:
[]
rspec
.
LinuxSeccompArg
{},
},
}
...
)
case
"amd64"
,
"x32"
:
syscalls
=
append
(
syscalls
,
[]
rspec
.
LinuxSyscall
{
{
Names
:
[]
string
{
"arch_prctl"
},
Action
:
rspec
.
ActAllow
,
Args
:
[]
rspec
.
LinuxSeccompArg
{},
},
}
...
)
fallthrough
case
"x86"
:
syscalls
=
append
(
syscalls
,
[]
rspec
.
LinuxSyscall
{
{
Names
:
[]
string
{
"modify_ldt"
},
Action
:
rspec
.
ActAllow
,
Args
:
[]
rspec
.
LinuxSeccompArg
{},
},
}
...
)
case
"s390"
,
"s390x"
:
syscalls
=
append
(
syscalls
,
[]
rspec
.
LinuxSyscall
{
{
Names
:
[]
string
{
"s390_pci_mmio_read"
,
"s390_pci_mmio_write"
,
"s390_runtime_instr"
,
},
Action
:
rspec
.
ActAllow
,
Args
:
[]
rspec
.
LinuxSeccompArg
{},
},
}
...
)
/* Flags parameter of the clone syscall is the 2nd on s390 */
syscalls
=
append
(
syscalls
,
[]
rspec
.
LinuxSyscall
{
{
Names
:
[]
string
{
"clone"
},
Action
:
rspec
.
ActAllow
,
Args
:
[]
rspec
.
LinuxSeccompArg
{
{
Index
:
1
,
Value
:
2080505856
,
ValueTwo
:
0
,
Op
:
rspec
.
OpMaskedEqual
,
},
},
},
}
...
)
}
return
&
rspec
.
LinuxSeccomp
{
DefaultAction
:
rspec
.
ActErrno
,
Architectures
:
arches
(),
Syscalls
:
syscalls
,
}
}
vendor/github.com/opencontainers/runtime-tools/generate/seccomp/seccomp_default_linux.go
0 → 100644
View file @
d7e13eb9
//go:build linux
// +build linux
package
seccomp
import
"golang.org/x/sys/unix"
// System values passed through on linux
const
(
CloneNewIPC
=
unix
.
CLONE_NEWIPC
CloneNewNet
=
unix
.
CLONE_NEWNET
CloneNewNS
=
unix
.
CLONE_NEWNS
CloneNewPID
=
unix
.
CLONE_NEWPID
CloneNewUser
=
unix
.
CLONE_NEWUSER
CloneNewUTS
=
unix
.
CLONE_NEWUTS
CloneNewCgroup
=
unix
.
CLONE_NEWCGROUP
)
vendor/github.com/opencontainers/runtime-tools/generate/seccomp/seccomp_default_unsupported.go
0 → 100644
View file @
d7e13eb9
//go:build !linux
// +build !linux
package
seccomp
// These are copied from linux/amd64 syscall values, as a reference for other
// platforms to have access to
const
(
CloneNewIPC
=
0x8000000
CloneNewNet
=
0x40000000
CloneNewNS
=
0x20000
CloneNewPID
=
0x20000000
CloneNewUser
=
0x10000000
CloneNewUTS
=
0x4000000
CloneNewCgroup
=
0x02000000
)
vendor/github.com/opencontainers/runtime-tools/generate/seccomp/syscall_compare.go
0 → 100644
View file @
d7e13eb9
package
seccomp
import
(
"fmt"
"reflect"
"strconv"
"strings"
rspec
"github.com/opencontainers/runtime-spec/specs-go"
)
// Determine if a new syscall rule should be appended, overwrite an existing rule
// or if no action should be taken at all
func
decideCourseOfAction
(
newSyscall
*
rspec
.
LinuxSyscall
,
syscalls
[]
rspec
.
LinuxSyscall
)
(
string
,
error
)
{
ruleForSyscallAlreadyExists
:=
false
var
sliceOfDeterminedActions
[]
string
for
i
,
syscall
:=
range
syscalls
{
if
sameName
(
&
syscall
,
newSyscall
)
{
ruleForSyscallAlreadyExists
=
true
if
identical
(
newSyscall
,
&
syscall
)
{
sliceOfDeterminedActions
=
append
(
sliceOfDeterminedActions
,
nothing
)
}
if
sameAction
(
newSyscall
,
&
syscall
)
{
if
bothHaveArgs
(
newSyscall
,
&
syscall
)
{
sliceOfDeterminedActions
=
append
(
sliceOfDeterminedActions
,
seccompAppend
)
}
if
onlyOneHasArgs
(
newSyscall
,
&
syscall
)
{
if
firstParamOnlyHasArgs
(
newSyscall
,
&
syscall
)
{
sliceOfDeterminedActions
=
append
(
sliceOfDeterminedActions
,
"overwrite:"
+
strconv
.
Itoa
(
i
))
}
else
{
sliceOfDeterminedActions
=
append
(
sliceOfDeterminedActions
,
nothing
)
}
}
}
if
!
sameAction
(
newSyscall
,
&
syscall
)
{
if
bothHaveArgs
(
newSyscall
,
&
syscall
)
{
if
sameArgs
(
newSyscall
,
&
syscall
)
{
sliceOfDeterminedActions
=
append
(
sliceOfDeterminedActions
,
"overwrite:"
+
strconv
.
Itoa
(
i
))
}
if
!
sameArgs
(
newSyscall
,
&
syscall
)
{
sliceOfDeterminedActions
=
append
(
sliceOfDeterminedActions
,
seccompAppend
)
}
}
if
onlyOneHasArgs
(
newSyscall
,
&
syscall
)
{
sliceOfDeterminedActions
=
append
(
sliceOfDeterminedActions
,
seccompAppend
)
}
if
neitherHasArgs
(
newSyscall
,
&
syscall
)
{
sliceOfDeterminedActions
=
append
(
sliceOfDeterminedActions
,
"overwrite:"
+
strconv
.
Itoa
(
i
))
}
}
}
}
if
!
ruleForSyscallAlreadyExists
{
sliceOfDeterminedActions
=
append
(
sliceOfDeterminedActions
,
seccompAppend
)
}
// Nothing has highest priority
for
_
,
determinedAction
:=
range
sliceOfDeterminedActions
{
if
determinedAction
==
nothing
{
return
determinedAction
,
nil
}
}
// Overwrite has second highest priority
for
_
,
determinedAction
:=
range
sliceOfDeterminedActions
{
if
strings
.
Contains
(
determinedAction
,
seccompOverwrite
)
{
return
determinedAction
,
nil
}
}
// Append has the lowest priority
for
_
,
determinedAction
:=
range
sliceOfDeterminedActions
{
if
determinedAction
==
seccompAppend
{
return
determinedAction
,
nil
}
}
return
""
,
fmt
.
Errorf
(
"Trouble determining action: %s"
,
sliceOfDeterminedActions
)
}
func
hasArguments
(
config
*
rspec
.
LinuxSyscall
)
bool
{
nilSyscall
:=
new
(
rspec
.
LinuxSyscall
)
return
!
sameArgs
(
nilSyscall
,
config
)
}
func
identical
(
config1
,
config2
*
rspec
.
LinuxSyscall
)
bool
{
return
reflect
.
DeepEqual
(
config1
,
config2
)
}
func
sameName
(
config1
,
config2
*
rspec
.
LinuxSyscall
)
bool
{
return
reflect
.
DeepEqual
(
config1
.
Names
,
config2
.
Names
)
}
func
sameAction
(
config1
,
config2
*
rspec
.
LinuxSyscall
)
bool
{
return
config1
.
Action
==
config2
.
Action
}
func
sameArgs
(
config1
,
config2
*
rspec
.
LinuxSyscall
)
bool
{
return
reflect
.
DeepEqual
(
config1
.
Args
,
config2
.
Args
)
}
func
bothHaveArgs
(
config1
,
config2
*
rspec
.
LinuxSyscall
)
bool
{
return
hasArguments
(
config1
)
&&
hasArguments
(
config2
)
}
func
onlyOneHasArgs
(
config1
,
config2
*
rspec
.
LinuxSyscall
)
bool
{
conf1
:=
hasArguments
(
config1
)
conf2
:=
hasArguments
(
config2
)
return
(
conf1
&&
!
conf2
)
||
(
!
conf1
&&
conf2
)
}
func
neitherHasArgs
(
config1
,
config2
*
rspec
.
LinuxSyscall
)
bool
{
return
!
hasArguments
(
config1
)
&&
!
hasArguments
(
config2
)
}
func
firstParamOnlyHasArgs
(
config1
,
config2
*
rspec
.
LinuxSyscall
)
bool
{
return
!
hasArguments
(
config1
)
&&
hasArguments
(
config2
)
}
vendor/github.com/opencontainers/runtime-tools/validate/capabilities/validate.go
0 → 100644
View file @
d7e13eb9
package
capabilities
import
(
"fmt"
"strings"
"github.com/syndtr/gocapability/capability"
)
// CapValid checks whether a capability is valid
func
CapValid
(
c
string
,
hostSpecific
bool
)
error
{
isValid
:=
false
if
!
strings
.
HasPrefix
(
c
,
"CAP_"
)
{
return
fmt
.
Errorf
(
"capability %s must start with CAP_"
,
c
)
}
for
_
,
cap
:=
range
capability
.
List
()
{
if
c
==
fmt
.
Sprintf
(
"CAP_%s"
,
strings
.
ToUpper
(
cap
.
String
()))
{
if
hostSpecific
&&
cap
>
LastCap
()
{
return
fmt
.
Errorf
(
"%s is not supported on the current host"
,
c
)
}
isValid
=
true
break
}
}
if
!
isValid
{
return
fmt
.
Errorf
(
"invalid capability: %s"
,
c
)
}
return
nil
}
vendor/github.com/opencontainers/runtime-tools/validate/capabilities/validate_linux.go
0 → 100644
View file @
d7e13eb9
package
capabilities
import
(
"github.com/syndtr/gocapability/capability"
)
// LastCap return last cap of system
func
LastCap
()
capability
.
Cap
{
last
:=
capability
.
CAP_LAST_CAP
// hack for RHEL6 which has no /proc/sys/kernel/cap_last_cap
if
last
==
capability
.
Cap
(
63
)
{
last
=
capability
.
CAP_BLOCK_SUSPEND
}
return
last
}
vendor/github.com/opencontainers/runtime-tools/validate/capabilities/validate_unsupported.go
0 → 100644
View file @
d7e13eb9
//go:build !linux
// +build !linux
package
capabilities
import
(
"github.com/syndtr/gocapability/capability"
)
// LastCap return last cap of system
func
LastCap
()
capability
.
Cap
{
return
capability
.
Cap
(
-
1
)
}
vendor/github.com/pelletier/go-toml/.dockerignore
0 → 100644
View file @
d7e13eb9
cmd/tomll/tomll
cmd/tomljson/tomljson
vendor/github.com/pelletier/go-toml/.gitignore
0 → 100644
View file @
d7e13eb9
test_program/test_program_bin
fuzz/
cmd/tomll/tomll
cmd/tomljson/tomljson
cmd/tomltestgen/tomltestgen
vendor/github.com/pelletier/go-toml/CONTRIBUTING.md
0 → 100644
View file @
d7e13eb9
## Contributing
Thank you for your interest in go-toml! We appreciate you considering
contributing to go-toml!
The main goal is the project is to provide an easy-to-use TOML
implementation for Go that gets the job done and gets out of your way –
dealing with TOML is probably not the central piece of your project.
As the single maintainer of go-toml, time is scarce. All help, big or
small, is more than welcomed!
### Ask questions
Any question you may have, somebody else might have it too. Always feel
free to ask them on the
[
issues tracker
][
issues-tracker
]
. We will try to
answer them as clearly and quickly as possible, time permitting.
Asking questions also helps us identify areas where the documentation needs
improvement, or new features that weren't envisioned before. Sometimes, a
seemingly innocent question leads to the fix of a bug. Don't hesitate and
ask away!
### Improve the documentation
The best way to share your knowledge and experience with go-toml is to
improve the documentation. Fix a typo, clarify an interface, add an
example, anything goes!
The documentation is present in the
[
README
][
readme
]
and thorough the
source code. On release, it gets updated on
[
pkg.go.dev
][
pkg.go.dev
]
. To make a
change to the documentation, create a pull request with your proposed
changes. For simple changes like that, the easiest way to go is probably
the "Fork this project and edit the file" button on Github, displayed at
the top right of the file. Unless it's a trivial change (for example a
typo), provide a little bit of context in your pull request description or
commit message.
### Report a bug
Found a bug! Sorry to hear that :(. Help us and other track them down and
fix by reporting it.
[
File a new bug report
][
bug-report
]
on the
[
issues
tracker
][
issues-tracker
]
. The template should provide enough guidance on
what to include. When in doubt: add more details! By reducing ambiguity and
providing more information, it decreases back and forth and saves everyone
time.
### Code changes
Want to contribute a patch? Very happy to hear that!
First, some high-level rules:
*
A short proposal with some POC code is better than a lengthy piece of
text with no code. Code speaks louder than words.
*
No backward-incompatible patch will be accepted unless discussed.
Sometimes it's hard, and Go's lack of versioning by default does not
help, but we try not to break people's programs unless we absolutely have
to.
*
If you are writing a new feature or extending an existing one, make sure
to write some documentation.
*
Bug fixes need to be accompanied with regression tests.
*
New code needs to be tested.
*
Your commit messages need to explain why the change is needed, even if
already included in the PR description.
It does sound like a lot, but those best practices are here to save time
overall and continuously improve the quality of the project, which is
something everyone benefits from.
#### Get started
The fairly standard code contribution process looks like that:
1.
[
Fork the project
][
fork
]
.
2.
Make your changes, commit on any branch you like.
3.
[
Open up a pull request
][
pull-request
]
4.
Review, potential ask for changes.
5.
Merge. You're in!
Feel free to ask for help! You can create draft pull requests to gather
some early feedback!
#### Run the tests
You can run tests for go-toml using Go's test tool:
`go test ./...`
.
When creating a pull requests, all tests will be ran on Linux on a few Go
versions (Travis CI), and on Windows using the latest Go version
(AppVeyor).
#### Style
Try to look around and follow the same format and structure as the rest of
the code. We enforce using
`go fmt`
on the whole code base.
---
### Maintainers-only
#### Merge pull request
Checklist:
*
Passing CI.
*
Does not introduce backward-incompatible changes (unless discussed).
*
Has relevant doc changes.
*
Has relevant unit tests.
1.
Merge using "squash and merge".
2.
Make sure to edit the commit message to keep all the useful information
nice and clean.
3.
Make sure the commit title is clear and contains the PR number (#123).
#### New release
1.
Go to
[
releases
][
releases
]
. Click on "X commits to master since this
release".
2.
Make note of all the changes. Look for backward incompatible changes,
new features, and bug fixes.
3.
Pick the new version using the above and semver.
4.
Create a
[
new release
][
new-release
]
.
5.
Follow the same format as
[
1.1.0
][
release-110
]
.
[
issues-tracker
]:
https://github.com/pelletier/go-toml/issues
[
bug-report
]:
https://github.com/pelletier/go-toml/issues/new?template=bug_report.md
[
pkg.go.dev
]:
https://pkg.go.dev/github.com/pelletier/go-toml
[
readme
]:
./README.md
[
fork
]:
https://help.github.com/articles/fork-a-repo
[
pull-request
]:
https://help.github.com/en/articles/creating-a-pull-request
[
releases
]:
https://github.com/pelletier/go-toml/releases
[
new-release
]:
https://github.com/pelletier/go-toml/releases/new
[
release-110
]:
https://github.com/pelletier/go-toml/releases/tag/v1.1.0
vendor/github.com/pelletier/go-toml/Dockerfile
0 → 100644
View file @
d7e13eb9
FROM
golang:1.12-alpine3.9 as builder
WORKDIR
/go/src/github.com/pelletier/go-toml
COPY
. .
ENV
CGO_ENABLED=0
ENV
GOOS=linux
RUN
go
install
./...
FROM
scratch
COPY
--from=builder /go/bin/tomll /usr/bin/tomll
COPY
--from=builder /go/bin/tomljson /usr/bin/tomljson
COPY
--from=builder /go/bin/jsontoml /usr/bin/jsontoml
vendor/github.com/pelletier/go-toml/LICENSE
0 → 100644
View file @
d7e13eb9
The bulk of github.com/pelletier/go-toml is distributed under the MIT license
(see below), with the exception of localtime.go and localtime.test.go.
Those two files have been copied over from Google's civil library at revision
ed46f5086358513cf8c25f8e3f022cb838a49d66, and are distributed under the Apache
2.0 license (see below).
github.com/pelletier/go-toml:
The MIT License (MIT)
Copyright (c) 2013 - 2021 Thomas Pelletier, Eric Anderton
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
localtime.go, localtime_test.go:
Originals:
https://raw.githubusercontent.com/googleapis/google-cloud-go/ed46f5086358513cf8c25f8e3f022cb838a49d66/civil/civil.go
https://raw.githubusercontent.com/googleapis/google-cloud-go/ed46f5086358513cf8c25f8e3f022cb838a49d66/civil/civil_test.go
Changes:
* Renamed files from civil* to localtime*.
* Package changed from civil to toml.
* 'Local' prefix added to all structs.
License:
https://raw.githubusercontent.com/googleapis/google-cloud-go/ed46f5086358513cf8c25f8e3f022cb838a49d66/LICENSE
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
vendor/github.com/pelletier/go-toml/Makefile
0 → 100644
View file @
d7e13eb9
export
CGO_ENABLED
=
0
go
:=
go
go.goos
?=
$(
shell
echo
`
go version
`
|cut
-f4
-d
' '
|cut
-d
'/'
-f1
)
go.goarch
?=
$(
shell
echo
`
go version
`
|cut
-f4
-d
' '
|cut
-d
'/'
-f2
)
out.tools
:=
tomll tomljson jsontoml
out.dist
:=
$
(
out.tools:
=
_
$(go.goos)
_
$(go.goarch)
.tar.xz
)
sources
:=
$(
wildcard
**
/
*
.go
)
.PHONY
:
tools
:
$(out.tools)
$(out.tools)
:
$(sources)
GOOS
=
$(go.goos)
GOARCH
=
$(go.goarch)
$(go)
build ./cmd/
$@
.PHONY
:
dist
:
$(out.dist)
$(out.dist)
:
%_$(go.goos)_$(go.goarch).tar.xz: %
if
[
"
$(go.goos)
"
=
"windows"
]
;
then
\
tar
-cJf
$@
$^
.exe
;
\
else
\
tar
-cJf
$@
$^
;
\
fi
.PHONY
:
clean
:
rm
-rf
$(out.tools)
$(out.dist)
vendor/github.com/pelletier/go-toml/PULL_REQUEST_TEMPLATE.md
0 → 100644
View file @
d7e13eb9
**Issue:**
add link to pelletier/go-toml issue here
Explanation of what this pull request does.
More detailed description of the decisions being made and the reasons why (if the patch is non-trivial).
vendor/github.com/pelletier/go-toml/README.md
0 → 100644
View file @
d7e13eb9
# go-toml
Go library for the
[
TOML
](
https://toml.io/
)
format.
This library supports TOML version
[
v1.0.0-rc.3
](
https://toml.io/en/v1.0.0-rc.3
)
[

](https://pkg.go.dev/github.com/pelletier/go-toml)
[

](https://github.com/pelletier/go-toml/blob/master/LICENSE)
[

](https://dev.azure.com/pelletierthomas/go-toml-ci/_build/latest?definitionId=1&branchName=master)
[

](https://codecov.io/gh/pelletier/go-toml)
[

](https://goreportcard.com/report/github.com/pelletier/go-toml)
[

](https://app.fossa.io/projects/git%2Bgithub.com%2Fpelletier%2Fgo-toml?ref=badge_shield)
## Development status
**ℹ️ Consider go-toml v2!**
The next version of go-toml is in
[
active development
][
v2-dev
]
, and
[
nearing completion
][
v2-map
]
.
Though technically in beta, v2 is already more tested,
[
fixes bugs
][
v1-bugs
]
,
and
[
much faster
][
v2-bench
]
. If you only need reading and writing TOML documents
(majority of cases), those features are implemented and the API unlikely to
change.
The remaining features will be added shortly. While pull-requests are welcome on
v1, no active development is expected on it. When v2.0.0 is released, v1 will be
deprecated.
👉
[
go-toml v2
][
v2
]
[
v2
]:
https://github.com/pelletier/go-toml/tree/v2
[
v2-map
]:
https://github.com/pelletier/go-toml/discussions/506
[
v2-dev
]:
https://github.com/pelletier/go-toml/tree/v2
[
v1-bugs
]:
https://github.com/pelletier/go-toml/issues?q=is%3Aissue+is%3Aopen+label%3Av2-fixed
[
v2-bench
]:
https://github.com/pelletier/go-toml/tree/v2#benchmarks
## Features
Go-toml provides the following features for using data parsed from TOML documents:
*
Load TOML documents from files and string data
*
Easily navigate TOML structure using Tree
*
Marshaling and unmarshaling to and from data structures
*
Line & column position data for all parsed elements
*
[
Query support similar to JSON-Path
](
query/
)
*
Syntax errors contain line and column numbers
## Import
```
go
import
"github.com/pelletier/go-toml"
```
## Usage example
Read a TOML document:
```
go
config
,
_
:=
toml
.
Load
(
`
[postgres]
user = "pelletier"
password = "mypassword"`
)
// retrieve data directly
user
:=
config
.
Get
(
"postgres.user"
)
.
(
string
)
// or using an intermediate object
postgresConfig
:=
config
.
Get
(
"postgres"
)
.
(
*
toml
.
Tree
)
password
:=
postgresConfig
.
Get
(
"password"
)
.
(
string
)
```
Or use Unmarshal:
```
go
type
Postgres
struct
{
User
string
Password
string
}
type
Config
struct
{
Postgres
Postgres
}
doc
:=
[]
byte
(
`
[Postgres]
User = "pelletier"
Password = "mypassword"`
)
config
:=
Config
{}
toml
.
Unmarshal
(
doc
,
&
config
)
fmt
.
Println
(
"user="
,
config
.
Postgres
.
User
)
```
Or use a query:
```
go
// use a query to gather elements without walking the tree
q
,
_
:=
query
.
Compile
(
"$..[user,password]"
)
results
:=
q
.
Execute
(
config
)
for
ii
,
item
:=
range
results
.
Values
()
{
fmt
.
Printf
(
"Query result %d: %v
\n
"
,
ii
,
item
)
}
```
## Documentation
The documentation and additional examples are available at
[
pkg.go.dev
](
https://pkg.go.dev/github.com/pelletier/go-toml
)
.
## Tools
Go-toml provides three handy command line tools:
*
`tomll`
: Reads TOML files and lints them.
```
go install github.com/pelletier/go-toml/cmd/tomll
tomll --help
```
*
`tomljson`
: Reads a TOML file and outputs its JSON representation.
```
go install github.com/pelletier/go-toml/cmd/tomljson
tomljson --help
```
*
`jsontoml`
: Reads a JSON file and outputs a TOML representation.
```
go install github.com/pelletier/go-toml/cmd/jsontoml
jsontoml --help
```
### Docker image
Those tools are also available as a Docker image from
[
dockerhub
](
https://hub.docker.com/r/pelletier/go-toml
)
. For example, to
use
`tomljson`
:
```
docker run -v $PWD:/workdir pelletier/go-toml tomljson /workdir/example.toml
```
Only master (
`latest`
) and tagged versions are published to dockerhub. You
can build your own image as usual:
```
docker build -t go-toml .
```
## Contribute
Feel free to report bugs and patches using GitHub's pull requests system on
[
pelletier/go-toml
](
https://github.com/pelletier/go-toml
)
. Any feedback would be
much appreciated!
### Run tests
`go test ./...`
### Fuzzing
The script
`./fuzz.sh`
is available to
run
[
go-fuzz
](
https://github.com/dvyukov/go-fuzz
)
on go-toml.
## Versioning
Go-toml follows
[
Semantic Versioning
](
http://semver.org/
)
. The supported version
of
[
TOML
](
https://github.com/toml-lang/toml
)
is indicated at the beginning of
this document. The last two major versions of Go are supported
(see
[
Go Release Policy
](
https://golang.org/doc/devel/release.html#policy
)
).
## License
The MIT License (MIT) + Apache 2.0. Read
[
LICENSE
](
LICENSE
)
.
vendor/github.com/pelletier/go-toml/SECURITY.md
0 → 100644
View file @
d7e13eb9
# Security Policy
## Supported Versions
Use this section to tell people about which versions of your project are
currently being supported with security updates.
| Version | Supported |
| ---------- | ------------------ |
| Latest 2.x | :white_check_mark: |
| All 1.x | :x: |
| All 0.x | :x: |
## Reporting a Vulnerability
Email a vulnerability report to
`security@pelletier.codes`
. Make sure to include
as many details as possible to reproduce the vulnerability. This is a
side-project: I will try to get back to you as quickly as possible, time
permitting in my personal life. Providing a working patch helps very much!
Prev
1
…
8
9
10
11
12
13
14
15
16
…
18
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment