Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auth token - loose hostname validation #72

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "akamai-edgeworkers-cli",
"version": "1.4.1",
"version": "1.4.2",
"description": "A tool that makes it easier to manage Akamai EdgeWorkers code bundles and EdgeKV databases. Call the EdgeWorkers and EdgeKV API from the command line.",
"repository": "https://github.com/akamai/cli-edgeworkers",
"scripts": {
Expand All @@ -25,7 +25,6 @@
"edgegrid": "^3.0.8",
"from-seconds": "^1.0.2",
"inquirer": "6.2.0",
"is-valid-domain": "^0.0.19",
"jwt-decode": "^3.1.2",
"readline-sync": "^1.4.10",
"sha256-file": "^1.0.0",
Expand Down
5 changes: 2 additions & 3 deletions src/edgeworkers/ew-cli-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import * as httpEdge from '../cli-httpRequest'
import * as edgeWorkersClientSvc from './client-manager';
import * as pkginfo from '../../package.json';
var program = require('commander');
const isValidDomain = require('is-valid-domain')
const copywrite = '\nCopyright (c) 2019-2021 Akamai Technologies, Inc. Licensed under Apache 2 license.\nYour use of Akamai\'s products and services is subject to the terms and provisions outlined in Akamai\'s legal policies.\nVisit http://github.com/akamai/cli-edgeworkers for detailed documentation';

/* ========== EdgeWorkers CLI Program Commands ========== */
Expand Down Expand Up @@ -411,9 +410,9 @@ exclusive to the --acl option; only use one or the other.")
.action(async function (hostName, options) {
try {
// deprecation msg for people using older CLI. This will be removed eventually.
if (!isValidDomain(hostName)) {
if (hostName.match(/^[0-9a-fA-F]{64}$/)) {
cliUtils.logAndExit(1, 'ERROR: Creating auth token with secret is deprecated with version CLI 1.1.0. Please use your host name to create an authentication token.');
}
}

await cliHandler.createAuthToken(hostName, options);
} catch (e) {
Expand Down