Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | manifest now supports human-readable messages |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
657eb8d965eaf74e3f8273445d524696 |
User & Date: | dnc 2019-06-08 21:12:38 |
Context
2019-06-09
| ||
10:59 | cmd/hancock verify: produce concise human-readable summary check-in: d7ecc454b7 user: dnc tags: trunk | |
2019-06-08
| ||
21:12 | manifest now supports human-readable messages check-in: 657eb8d965 user: dnc tags: trunk | |
21:12 | clean up use of command package check-in: 0668aba314 user: dnc tags: trunk | |
Changes
Changes to cmd/hancock/manifest.go.
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
...
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
"src.d10.dev/hancock/model"
)
func init() {
command.RegisterOperation(command.Operation{
Handler: manifestMain,
Name: "manifest",
Syntax: "manifest [-r] [-role=<role>] <file or directory> [...]",
Description: "Creates summaries of a files, suitable for signing.",
})
}
func manifestMain() error {
recurseFlag := command.OperationFlagSet.Bool("r", false, "descend into directories, processing all files")
roleFlag := command.OperationFlagSet.String("role", "", "indicate relationship to source (i.e. author or auditor)")
invalidFlag := command.OperationFlagSet.Bool("invalid", false, "indicate that source is not endorsed")
deprecatedFlag := command.OperationFlagSet.Bool("deprecated", false, "indicate that source is not endorsed because deprecated")
bugFlag := command.OperationFlagSet.Bool("bug", false, "indicate that source is not endorsed because of known bug")
vulnFlag := command.OperationFlagSet.Bool("vulnerable", false, "indicate that source is not endorsed because of known vulnerability")
err := command.OperationFlagSet.Parse(command.Args()[1:])
if err != nil {
return err
}
// validate flags
var role model.Role
................................................................................
}
if *vulnFlag {
manifest.Quality |= model.Vulnerable
}
if manifest.Quality == 0 {
manifest.Quality = model.Valid // default, if no quality flag
}
// encoded manifest to stdout
fmt.Println(mustEncode(manifest))
return nil // continue walk
})
if err == noRecurse {
|
|
>
>
>
>
>
>
>
|
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
...
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
"src.d10.dev/hancock/model" ) func init() { command.RegisterOperation(command.Operation{ Handler: manifestMain, Name: "manifest", Syntax: "manifest [-r] [-role=<role>] [-message=<text>] <file or directory> [...]", Description: "Creates summaries of a files, suitable for signing.", }) } func manifestMain() error { recurseFlag := command.OperationFlagSet.Bool("r", false, "descend into directories, processing all files") roleFlag := command.OperationFlagSet.String("role", "", "indicate relationship to source (i.e. author or auditor)") invalidFlag := command.OperationFlagSet.Bool("invalid", false, "indicate that source is not endorsed") deprecatedFlag := command.OperationFlagSet.Bool("deprecated", false, "indicate that source is not endorsed because deprecated") bugFlag := command.OperationFlagSet.Bool("bug", false, "indicate that source is not endorsed because of known bug") vulnFlag := command.OperationFlagSet.Bool("vulnerable", false, "indicate that source is not endorsed because of known vulnerability") var messageFlag command.StringSet command.OperationFlagSet.Var(&messageFlag, "message", "optional rationale for testimony") err := command.OperationFlagSet.Parse(command.Args()[1:]) if err != nil { return err } // validate flags var role model.Role ................................................................................ } if *vulnFlag { manifest.Quality |= model.Vulnerable } if manifest.Quality == 0 { manifest.Quality = model.Valid // default, if no quality flag } if len(messageFlag) > 0 { manifest.Message = messageFlag.Strings() } // encoded manifest to stdout fmt.Println(mustEncode(manifest)) return nil // continue walk }) if err == noRecurse { |
Changes to model/manifest.go.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
// The Role of the authority producing testimony. I.e. the file's // author, or a third-party auditor. Role Role `json:"role"` // Timestamp indicates when manifest was produced. This does not // indicated the age of the file, or when testimony was signed. Time int64 `json:"timestamp"` } func NewFileManifest(path string) (*FileManifest, error) { f, err := os.Open(path) if err != nil { return nil, err } |
> > > |
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
// The Role of the authority producing testimony. I.e. the file's // author, or a third-party auditor. Role Role `json:"role"` // Timestamp indicates when manifest was produced. This does not // indicated the age of the file, or when testimony was signed. Time int64 `json:"timestamp"` // Rationale or explanation of testimony. Message []string `json:"message"` } func NewFileManifest(path string) (*FileManifest, error) { f, err := os.Open(path) if err != nil { return nil, err } |