Skip to content

Set container CORS attribute#555

Merged
cthulhu-rider merged 2 commits intomasterfrom
548-provide-a-method-to-update-well-known-cors-attribute
Dec 5, 2025
Merged

Set container CORS attribute#555
cthulhu-rider merged 2 commits intomasterfrom
548-provide-a-method-to-update-well-known-cors-attribute

Conversation

@smallhive
Copy link
Contributor

Closes #548.

@smallhive smallhive force-pushed the 548-provide-a-method-to-update-well-known-cors-attribute branch from 6da3ec2 to 97cb1ed Compare November 27, 2025 09:15
@codecov
Copy link

codecov bot commented Nov 27, 2025

Codecov Report

❌ Patch coverage is 81.29496% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.10%. Comparing base (f2b1030) to head (ebdc1b7).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
contracts/container/contract.go 81.15% 26 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #555      +/-   ##
==========================================
+ Coverage   62.28%   63.10%   +0.82%     
==========================================
  Files          29       29              
  Lines        3068     3204     +136     
==========================================
+ Hits         1911     2022     +111     
- Misses       1151     1176      +25     
  Partials        6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@smallhive smallhive force-pushed the 548-provide-a-method-to-update-well-known-cors-attribute branch 2 times, most recently from 7efa1af to 5750afa Compare November 28, 2025 06:21
@smallhive smallhive marked this pull request as ready for review November 28, 2025 06:21
@roman-khimov
Copy link
Member

Rebase, please

@smallhive smallhive force-pushed the 548-provide-a-method-to-update-well-known-cors-attribute branch from 5750afa to 67827a0 Compare November 28, 2025 10:11
@smallhive
Copy link
Contributor Author

Rebase, please

Rebaed

@smallhive smallhive force-pushed the 548-provide-a-method-to-update-well-known-cors-attribute branch from 67827a0 to a840096 Compare December 1, 2025 10:26
panic(cst.NotFoundError)
}

common.CheckOwnerWitness(common.WalletToScriptHash(ownerID))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sometimes we allow the alphabet to be able to rewrite smth in the contracts (#526), can this be useful for this? @roman-khimov

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is useful, I've added alphabet witness check as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suppose the key point is net cfg allowing Alphabet witness

netmapContractAddr := storage.Get(ctx, netmapContractKey).(interop.Hash160)
vRaw := contract.Call(netmapContractAddr, "config", contract.ReadOnly, cst.AlphabetManagesQuotasKey)
if vRaw == nil || !vRaw.(bool) {
common.CheckOwnerWitness(userScriptHash)
} else {
common.CheckAlphabetWitness()
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

@smallhive smallhive force-pushed the 548-provide-a-method-to-update-well-known-cors-attribute branch from a840096 to 798d19b Compare December 1, 2025 15:23
@smallhive smallhive requested a review from carpawell December 1, 2025 15:25
@smallhive smallhive force-pushed the 548-provide-a-method-to-update-well-known-cors-attribute branch 2 times, most recently from 56c0e83 to 4984502 Compare December 2, 2025 10:06
@cthulhu-rider
Copy link
Contributor

@smallhive seems good overall. I also need exactly this, but for LOCK attribute (#558). So, lets try to fasten this PR. The only meaningful topic i wanna resolve here is https://github.com/nspcc-dev/neofs-contract/pull/555/files#r2584311944

i can improve the rest on my own

@smallhive smallhive force-pushed the 548-provide-a-method-to-update-well-known-cors-attribute branch from 4984502 to f659262 Compare December 3, 2025 12:21
@smallhive
Copy link
Contributor Author

@smallhive seems good overall. I also need exactly this, but for LOCK attribute (#558). So, lets try to fasten this PR. The only meaningful topic i wanna resolve here is https://github.com/nspcc-dev/neofs-contract/pull/555/files#r2584311944

i can improve the rest on my own

I will add ResetAttribute function. Unfortunately, the link https://github.com/nspcc-dev/neofs-contract/pull/555/files#r2584311944 opens, but shows nothing. Resolve all conversations, except you would like to discuss

@smallhive smallhive force-pushed the 548-provide-a-method-to-update-well-known-cors-attribute branch from 7e02653 to 70df532 Compare December 4, 2025 05:49
@smallhive smallhive force-pushed the 548-provide-a-method-to-update-well-known-cors-attribute branch from 70df532 to 35c5fcd Compare December 4, 2025 06:10
@smallhive smallhive force-pushed the 548-provide-a-method-to-update-well-known-cors-attribute branch from 2e481a7 to 4f52d50 Compare December 4, 2025 08:22
@smallhive smallhive force-pushed the 548-provide-a-method-to-update-well-known-cors-attribute branch 2 times, most recently from ce2ad8f to 77a987e Compare December 4, 2025 10:54
cthulhu-rider
cthulhu-rider previously approved these changes Dec 4, 2025
@smallhive smallhive force-pushed the 548-provide-a-method-to-update-well-known-cors-attribute branch 2 times, most recently from 3032e5d to 5baba65 Compare December 4, 2025 11:25
cthulhu-rider
cthulhu-rider previously approved these changes Dec 4, 2025
@smallhive smallhive force-pushed the 548-provide-a-method-to-update-well-known-cors-attribute branch from 5baba65 to 9688073 Compare December 5, 2025 06:07
@smallhive smallhive force-pushed the 548-provide-a-method-to-update-well-known-cors-attribute branch 2 times, most recently from 135c241 to a37d658 Compare December 5, 2025 07:52
@smallhive smallhive force-pushed the 548-provide-a-method-to-update-well-known-cors-attribute branch from a37d658 to 65a49f6 Compare December 5, 2025 08:39
Closes #548.

Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
@smallhive smallhive force-pushed the 548-provide-a-method-to-update-well-known-cors-attribute branch from 65a49f6 to ebdc1b7 Compare December 5, 2025 09:18
)

// CORSRule describes one rule for the container’s CORS attribute. It is the same as in contract.
type CORSRule struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be used from rpc package now?


type (
// CORSRule describes one rule for the container’s CORS attribute.
CORSRule struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so it is only used as a json holder, right? i would add json: tags then, and a little bit more info to its doc

@cthulhu-rider cthulhu-rider merged commit e3afe03 into master Dec 5, 2025
10 checks passed
@cthulhu-rider cthulhu-rider deleted the 548-provide-a-method-to-update-well-known-cors-attribute branch December 5, 2025 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide a method to update well-known CORS attribute

4 participants