Skip to content

Commit d054d7d

Browse files
Fix false positives when using version-bump.sh script (otter-sec#3068)
1 parent 3a0fc4b commit d054d7d

2 files changed

Lines changed: 11 additions & 13 deletions

File tree

idl/src/convert.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::types::Idl;
66
/// `idl.metadata.spec` field.
77
///
88
/// If `spec` field is not specified, the conversion will fallback to the legacy IDL spec
9-
/// (pre Anchor v0.30.1).
9+
/// (pre Anchor v0.30).
1010
///
1111
/// **Note:** For legacy IDLs, `idl.metadata.address` field is required to be populated with
1212
/// program's address otherwise an error will be returned.
@@ -27,7 +27,7 @@ pub fn convert_idl(idl: &[u8]) -> Result<Idl> {
2727
}
2828
}
2929

30-
/// Legacy IDL spec (pre Anchor v0.30.1)
30+
/// Legacy IDL spec (pre Anchor v0.30)
3131
mod legacy {
3232
use crate::types as t;
3333
use anyhow::{anyhow, Result};

version-bump.sh

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,23 @@ case "$(uname)" in
1818
Darwin*) sedi=(-i "")
1919
esac
2020

21-
# Don't replace version with the following globs
22-
skip_globs=":!**/yarn.lock :!Cargo.lock :!package.json :!tests/bench/bench.json :!bench/*.md"
23-
24-
git grep -l $(cat VERSION) -- $skip_globs |
21+
# Only replace version with the following globs
22+
allow_globs=":**/Cargo.toml **/Makefile docs/src/pages/docs/*.md client/src/lib.rs"
23+
git grep -l $(cat VERSION) -- $allow_globs |
2524
xargs sed "${sedi[@]}" \
2625
-e "s/$(cat VERSION)/$version/g"
2726

28-
# Potential for collisions in package.json files, handle those separately
27+
# Potential for collisions in `package.json` files, handle those separately
2928
# Replace only matching "version": "x.xx.x" and "@coral-xyz/anchor": "x.xx.x"
30-
git grep -l $(cat VERSION) -- '**/package.json' | \
29+
git grep -l $(cat VERSION) -- "**/package.json" | \
3130
xargs sed "${sedi[@]}" \
3231
-e "s/@coral-xyz\/anchor\": \"$(cat VERSION)\"/@coral-xyz\/anchor\": \"$version\"/g" \
3332
-e "s/\"version\": \"$(cat VERSION)\"/\"version\": \"$version\"/g"
3433

35-
# Potential for collisions in Cargo.lock, use cargo update to update it
36-
cargo update --workspace
37-
38-
# Insert version number into CHANGELOG.md
39-
sed "${sedi[@]}" -e "s/## \[Unreleased\]/## [Unreleased]\n\n## [$version] - $(date '+%Y-%m-%d')/g" CHANGELOG.md
34+
# Insert version number into CHANGELOG
35+
sed "${sedi[@]}" -e \
36+
"s/## \[Unreleased\]/## [Unreleased]\n\n### Features\n\n### Fixes\n\n### Breaking\n\n## [$version] - $(date '+%Y-%m-%d')/g" \
37+
CHANGELOG.md
4038

4139
pushd ts && yarn && popd
4240
pushd tests && yarn && popd

0 commit comments

Comments
 (0)