Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rekor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SafSec
rekor
Commits
ea7b6072
Unverified
Commit
ea7b6072
authored
4 years ago
by
dlorenc
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #193 from dlorenc/morets
Add timestamps to the log_info output.
parents
fb0b1f6e
4189e108
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cmd/cli/app/log_info.go
+15
-8
15 additions, 8 deletions
cmd/cli/app/log_info.go
cmd/cli/app/log_proof.go
+7
-9
7 additions, 9 deletions
cmd/cli/app/log_proof.go
cmd/cli/app/verify.go
+4
-5
4 additions, 5 deletions
cmd/cli/app/verify.go
with
26 additions
and
22 deletions
cmd/cli/app/log_info.go
+
15
−
8
View file @
ea7b6072
...
...
@@ -25,6 +25,7 @@ import (
"errors"
"fmt"
"strings"
"time"
"github.com/sigstore/rekor/cmd/cli/app/state"
...
...
@@ -42,13 +43,19 @@ import (
)
type
logInfoCmdOutput
struct
{
TreeSize
int64
RootHash
string
TreeSize
int64
RootHash
string
TimestampNanos
uint64
}
func
(
l
*
logInfoCmdOutput
)
String
()
string
{
// Verification is always successful if we return an object.
return
fmt
.
Sprintf
(
"Verification Successful!
\n
Tree Size: %v
\n
Root Hash: %s
\n
"
,
l
.
TreeSize
,
l
.
RootHash
)
ts
:=
time
.
Unix
(
0
,
int64
(
l
.
TimestampNanos
))
.
UTC
()
.
Format
(
time
.
RFC3339
)
return
fmt
.
Sprintf
(
`Verification Successful!
Tree Size: %v
Root Hash: %s
Timestamp: %s
`
,
l
.
TreeSize
,
l
.
RootHash
,
ts
)
}
// logInfoCmd represents the current information about the transparency log
...
...
@@ -113,6 +120,11 @@ var logInfoCmd = &cobra.Command{
if
err
!=
nil
{
return
nil
,
err
}
cmdOutput
:=
&
logInfoCmdOutput
{
TreeSize
:
*
logInfo
.
TreeSize
,
RootHash
:
*
logInfo
.
RootHash
,
TimestampNanos
:
lr
.
TimestampNanos
,
}
if
lr
.
TreeSize
!=
uint64
(
*
logInfo
.
TreeSize
)
{
return
nil
,
errors
.
New
(
"tree size in signed tree head does not match value returned in API call"
)
...
...
@@ -122,11 +134,6 @@ var logInfoCmd = &cobra.Command{
return
nil
,
errors
.
New
(
"root hash in signed tree head does not match value returned in API call"
)
}
cmdOutput
:=
&
logInfoCmdOutput
{
TreeSize
:
int64
(
lr
.
TreeSize
),
RootHash
:
hex
.
EncodeToString
(
lr
.
RootHash
),
}
oldState
:=
state
.
Load
(
serverURL
)
if
oldState
!=
nil
{
persistedSize
:=
oldState
.
TreeSize
...
...
This diff is collapsed.
Click to expand it.
cmd/cli/app/log_proof.go
+
7
−
9
View file @
ea7b6072
...
...
@@ -16,12 +16,12 @@ limitations under the License.
package
app
import
(
"errors"
"fmt"
"os"
"github.com/sigstore/rekor/cmd/cli/app/format"
"github.com/sigstore/rekor/pkg/generated/client/tlog"
"github.com/sigstore/rekor/pkg/log"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
...
...
@@ -50,23 +50,21 @@ var logProofCmd = &cobra.Command{
Use
:
"logproof"
,
Short
:
"Rekor logproof command"
,
Long
:
`Prints information required to compute the consistency proof of the transparency log`
,
PreRun
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
PreRun
E
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
// these are bound here so that they are not overwritten by other commands
if
err
:=
viper
.
BindPFlags
(
cmd
.
Flags
());
err
!=
nil
{
log
.
Logger
.
Fatal
(
"Error initializing cmd line args: "
,
err
)
return
fmt
.
Errorf
(
"Error initializing cmd line args:
%s
"
,
err
)
}
if
viper
.
GetUint64
(
"first-size"
)
>
viper
.
GetUint64
(
"last-size"
)
{
log
.
Logger
.
Error
(
"last-size must be >= to first-size"
)
os
.
Exit
(
1
)
return
errors
.
New
(
"last-size must be >= to first-size"
)
}
if
viper
.
GetUint64
(
"first-size"
)
==
0
{
log
.
Logger
.
Error
(
"first-size must be > 0"
)
os
.
Exit
(
1
)
return
errors
.
New
(
"first-size must be > 0"
)
}
if
viper
.
GetUint64
(
"last-size"
)
==
0
{
log
.
Logger
.
Error
(
"last-size must be > 0"
)
os
.
Exit
(
1
)
return
errors
.
New
(
"last-size must be > 0"
)
}
return
nil
},
Run
:
format
.
WrapCmd
(
func
(
args
[]
string
)
(
interface
{},
error
)
{
rekorClient
,
err
:=
GetRekorClient
(
viper
.
GetString
(
"rekor_server"
))
...
...
This diff is collapsed.
Click to expand it.
cmd/cli/app/verify.go
+
4
−
5
View file @
ea7b6072
...
...
@@ -20,7 +20,6 @@ import (
"errors"
"fmt"
"math/bits"
"os"
"strconv"
"github.com/google/trillian/merkle/logverifier"
...
...
@@ -73,16 +72,16 @@ var verifyCmd = &cobra.Command{
Use
:
"verify"
,
Short
:
"Rekor verify command"
,
Long
:
`Verifies an entry exists in the transparency log through an inclusion proof`
,
PreRun
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
PreRun
E
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
// these are bound here so that they are not overwritten by other commands
if
err
:=
viper
.
BindPFlags
(
cmd
.
Flags
());
err
!=
nil
{
log
.
Logger
.
Fatal
(
"Error initializing cmd line args: "
,
err
)
return
fmt
.
Errorf
(
"Error initializing cmd line args:
%s
"
,
err
)
}
if
err
:=
validateArtifactPFlags
(
true
,
true
);
err
!=
nil
{
log
.
Logger
.
Error
(
err
)
_
=
cmd
.
Help
()
os
.
Exit
(
1
)
return
err
}
return
nil
},
Run
:
format
.
WrapCmd
(
func
(
args
[]
string
)
(
interface
{},
error
)
{
rekorClient
,
err
:=
GetRekorClient
(
viper
.
GetString
(
"rekor_server"
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment