Skip to content

RTECO-2746 - Showing whether a valid token is revocable - #3778

Draft
hanochg wants to merge 31 commits into
jfrog:masterfrom
hanochg:RTECO-2746-token-revocability
Draft

hanochg wants to merge 31 commits into
jfrog:masterfrom
hanochg:RTECO-2746-token-revocability

Conversation

@hanochg

@hanochg hanochg commented Nov 30, 2026 •

Copy link
Copy Markdown
  • All tests have passed. If this feature is not already covered by the tests, new tests have been added.
  • The pull request is targeting the master branch.
  • The code has been validated to compile successfully by running go vet ./....
  • The code has been formatted properly using go fmt ./....

RTECO-2746 - Showing whether a valid token is revocable

Draft, builds on #3758. Until that PR is merged, this one also shows its commits; this PR's own changes are the last three commits. It also needs go.mod bumped to the jfrog-cli-core and jfrog-client-go versions from jfrog/jfrog-cli-core#1638 and jfrog/jfrog-client-go#1411. Tests pass locally against those branches.

Shows the new revocability result of jf atv (from jfrog-cli-core): Revocable, Non-revocable or Unknown.

Output (general/token/verify.go)

  • Table: the types table at the bottom gets a TOKEN REVOCABILITY column next to TOKEN TYPE:
    ┌────────────────┬────────────────────┐
    │ TOKEN TYPE     │ TOKEN REVOCABILITY │
    ├────────────────┼────────────────────┤
    │ Admin Token    │ Revocable          │
    │ Internal Token │                    │
    └────────────────┴────────────────────┘
    
    • With several types, the value is shown once, in a cell that spans the type rows (go-pretty's AutoMerge).
    • With no types (a valid reference token whose details the server didn't return), only the TOKEN REVOCABILITY column is shown.
    • Without a revocability (an invalid or unverified token, or an API key), the table is unchanged.
  • Colors: on terminals that support them, Revocable is green, Non-revocable yellow and Unknown gray. The type names are now bold, like the field names; Internal Token stays yellow and Unknown Token Type gray.
  • JSON: the last field, "revocability": "Non-revocable". It's absent for an invalid or unverified token, and for an API key.

Help (docs/general/tokenverify/help.go)

  • The description mentions the revocability.
  • A new example: jq -r .revocability.
  • A new gotcha explains what decides it, and when it's Unknown.

Tests (general/token/verify_test.go)

  • The column next to one type, for each value.
  • One merged value for several types.
  • The column alone when there are no types.
  • No column without a revocability.
  • The colors, and the bold type names.
  • The JSON field.

🤖 Generated with Claude Code

hanochg and others added 30 commits November 10, 2026 16:08
New command 'jf access-token-verify' (alias 'atv') verifies a JFrog
access token against the configured server and reports its type. The
token comes from the argument, --token-file, or stdin (with a hidden
prompt in a terminal); JSON input such as 'jf atc' output is read for
its access_token value. Output is a table by default, or JSON with
--format=json.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mints tokens with 'jf atc' and verifies them with 'jf atv' against the
configured default server: identity, admin, scoped, groups and
non-expiring tokens, file and JSON input, and the reference, revoked,
tampered, locally signed and unknown-server failures. Every case checks
the token never appears in the output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mpty input

The payload is printed even when verification fails, so control and
format characters in claims are now escaped instead of reaching the
terminal raw. An empty token argument or --token-file path is now an
error instead of a silent switch to reading stdin. The help no longer
says the profile's credentials are unused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… once

The case revoked its token and the cleanup revoked it again, and the
cleanup asserts HTTP 200.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dlers

The verification error can quote token claims and server text. It is now
escaped and logged by the command, which exits 1 without returning the
message, so the JSON error handler can't parse it as an HTTP error and print
a second, forged JSON object. JSON output also escapes DEL, C1 controls and
Unicode format characters. The integration suite runs in the external
Artifactory pipeline too, and checks that readiness rejects anonymous
requests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Command-line arguments are visible to other processes and kept in shell
history, so atv now rejects any argument and reads the token only from
--token-file or stdin. The integration tests pass tokens through
--token-file. The anonymous readiness case is removed: Access readiness
answers 200 to anonymous requests, so the revoked-token case is what shows
that a presented token is checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The output now starts with the token's format, JWT or Reference, and JSON
output has a format field. For a reference token, the table lists the token
details the server returned, with its epoch fields as dates. The help
describes the tokens/me check and reference tokens, and the integration
tests verify a reference token, a revoked reference token and a value that
isn't a token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ixing input, output and help gaps

- The hidden prompt reads its own line without x/term's 4096-character cap, discards whatever is left in the terminal so it can't reach the shell, and rejects multi-line pastes.
- Git Bash and other Cygwin terminals, which can't hide input, get an error instead of an echoed prompt.
- UTF-16 token files (Windows PowerShell 5.1 redirection) are decoded.
- A non-object ext claim is shown in the table.
- The help and --token-file text match the current behaviour.
- tokenUnderTest is renamed to tokenUnderInvestigation, and non-critical comments are removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g the INTERNAL column

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a single error line

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…olor version has

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…help

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n the atv help

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d fixing the revoked JWT test expectation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g Artifactory audience rejections

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…se the configured server

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n atv output

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rence token without details

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ng the expected messages

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…itespace in the token and showing less than a minute left

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JFrog-AI-Session: claude-code/58e47ad8-d3e7-4127-a5bf-0eaefc719bec
…en when revocable, and the types in bold

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JFrog-AI-Session: claude-code/58e47ad8-d3e7-4127-a5bf-0eaefc719bec
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JFrog-AI-Session: claude-code/58e47ad8-d3e7-4127-a5bf-0eaefc719bec

This branch is waiting to be deployed

1 waiting deployment
build-gate — e99a0e19 Waiting Nov 30, 2026 by hanochg via Approval gate #1423
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant