Skip to content

Commit

Permalink
Update Useragent string to correct format (#68)
Browse files Browse the repository at this point in the history
* Fix user agent string to be correct format
* 2.3.1
  • Loading branch information
nielm authored Nov 28, 2023
1 parent 5324cee commit fbc79b8
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Run and Eventarc.
installs failed
* 2023-11-22 v2.2.0 Add support for using environmental variables in the config.json file.
* 2023-11-27 v2.3.0 Remove need for cloud-run-proxy, and update versions of packages. Fixes multiple CVEs.
* 2023-11-28 v2.3.1 Fix user agent string to use correct format.

## Upgrading from v1.x to v2.x

Expand Down
3 changes: 2 additions & 1 deletion cloudrun-malware-scanner/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ const pkgJson = require('./package.json');
*/
const Config = null;

const storage = new Storage({userAgent: `${pkgJson.name}/${pkgJson.version}`});
const storage = new Storage({userAgent: `cloud-solutions/${
pkgJson.name}-usage-v${pkgJson.version}`});

/**
* Read configuration from JSON configuration file, verify
Expand Down
4 changes: 2 additions & 2 deletions cloudrun-malware-scanner/gcs-proxy-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async function accessTokenRefresh() {
client.credentials.expiry_date <=
new Date().getTime() + TOKEN_REFRESH_THRESHOLD_MILLIS) {
accessToken = await googleAuth.getAccessToken();
logger.info(`Access token expires at ${
logger.info(`Refreshed Access token; expires at ${
new Date(client.credentials.expiry_date).toISOString()}`);
}
const nextCheckDate =
Expand Down Expand Up @@ -86,7 +86,7 @@ function handleProxyReq(proxyReq, req, res) {
logger.info(`Proxying request for ${proxyReq.path} to GCS`);
proxyReq.setHeader('Authorization', 'Bearer ' + accessToken);
} else {
logger.error(`Denying Proxy request for ${proxyReq.path} to GCS`);
logger.error(`Denying Proxy request for ${proxyReq.path} to GCS - 403`);
res.writeHead(403, {
'Content-Type': 'text/plain',
});
Expand Down
4 changes: 2 additions & 2 deletions cloudrun-malware-scanner/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cloudrun-malware-scanner/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gcs-malware-scanner",
"version": "2.3.0",
"version": "2.3.1",
"description": "Service to scan GCS documents for the malware and move the analyzed documents to appropriate buckets",
"main": "index.js",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion cloudrun-malware-scanner/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ const BUCKET_CONFIG = {
const app = express();
app.use(express.json());
const scanner = clamd.createScanner(CLAMD_HOST, CLAMD_PORT);
const storage = new Storage({userAgent: `${pkgJson.name}/${pkgJson.version}`});
const storage = new Storage({userAgent: `cloud-solutions/${
pkgJson.name}-usage-v${pkgJson.version}`});
const googleAuth = new GoogleAuth();

/**
Expand Down

0 comments on commit fbc79b8

Please sign in to comment.