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

Update Useragent string to correct format #68

Merged
merged 2 commits into from
Nov 28, 2023
Merged
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
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