Skip to content

Commit

Permalink
Merge branch 'master' into update-golang
Browse files Browse the repository at this point in the history
  • Loading branch information
ivard authored Dec 18, 2023
2 parents 1f0c890 + 506fcd2 commit 41a22a6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
### Fixed
- `RemoveScheme` function in `irmaclient` already stripping storage before checking whether the scheme is in assets

### Security
- Update go toolchain to 1.21.5

Expand Down
10 changes: 9 additions & 1 deletion irmaclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1547,7 +1547,15 @@ func (client *Client) RemoveScheme(schemeID irma.SchemeManagerIdentifier) error
return errors.New("unknown scheme manager")
}

err := client.stripStorage([]irma.SchemeManagerIdentifier{schemeID}, true)
isInAssets, err := client.Configuration.IsInAssets(scheme)
if err != nil {
return err
}
if isInAssets {
return errors.New("cannot remove scheme manager that is in assets")
}

err = client.stripStorage([]irma.SchemeManagerIdentifier{schemeID}, true)
if err != nil {
return err
}
Expand Down
10 changes: 9 additions & 1 deletion schemes.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,18 @@ func (conf *Configuration) UpdateScheme(scheme Scheme, downloaded *IrmaIdentifie
return nil
}

func (conf *Configuration) IsInAssets(scheme Scheme) (bool, error) {
if conf.assets == "" {
return false, nil
}
_, exists, err := common.Stat(path.Join(conf.assets, scheme.id()))
return exists, err
}

// DangerousDeleteScheme deletes the given scheme from the configuration.
// Be aware: this action is dangerous when the scheme is still in use.
func (conf *Configuration) DangerousDeleteScheme(scheme Scheme) error {
_, exists, err := common.Stat(path.Join(conf.assets, scheme.id()))
exists, err := conf.IsInAssets(scheme)
if err != nil {
return err
}
Expand Down

0 comments on commit 41a22a6

Please sign in to comment.