SlideShare a Scribd company logo
1 of 26
Download to read offline
Developers Toolbox – Coding
 Should invoker rights be used?




Patrick Barel    , AMIS, The Netherlands

Monday, June 25, 2012
ODTUG KScope 12
San Antonio, Texas, USA
Definer Rights vs Invoker Rights
 Prior to Oracle8i, whenever you executed a stored
  program, it ran under the privileges of the account in
  which the program was defined.
  This is called the …
                                Definer Rights Model

 With Oracle8i, you can now decide at compilation time
  whether your program or package will execute in the
  definer's schema (the default) or the schema of the invoker
  of the code.
  This is called the …         Invoker Rights Model
Definer Rights
Patrick               Mitchell

 Code        Invoke
   R
   e
   f

Relations             Relations
Invoker Rights
Patrick               Mitchell

 Code        Invoke




Relations             Relations
Invoker Rights

 Allows you to centralize
  access to and control of
  underlying data structures.
 Uses roles and doesn’t rely
  on directly-granted
  privileges.
 But it can be a source of
  confusion and architectural
  problems.

                         Note: Oracle built-in packages have
                          long had the capability of running
                            under the invoker's authority.
What’s wrong with Definer Rights

 Deployment & maintenance
    Must install module in all schemas where needed
    In some databases, each user has own copy of
     table(s), requiring copy of stored module
 Security
    No declarative way to restrict privileges on certain
     modules in a package -- it's all or nothing, unless
     you write code in the package to essentially
     recreate roles programmatically.
    Difficult to audit privileges

 Sure would be nice to have a choice...and now you do!
Invoker Rights

 For top level modules:

  CREATE [ OR REPLACE ] <module type>
     [ AUTHID { DEFINER | CURRENT_USER } ]
  AS ...



 For modules with separate spec and body,
  AUTHID goes only in spec, and must be at the
  package level.
 Holds true for packages and object types.
Overview of Definer Rights




begin                           package y
  x.foo;                        authid
            package x           definer
end;
            authid
            definer
                   package z
                   authid
                   definer


  Emp            Emp              Emp
Overview of Invoker Rights




begin                             package y
  x.foo;                          authid
            package x             definer
end;
            authid
            current_user
                   package z
                   authid
                   current_user


  Emp            Emp                Emp
Overview of Invoker Rights


      begin
        x.foo;
      end;

                                       package y
           Emp                         authid
                 package x             definer
                 authid
                 current_user
begin                   package z
  x.foo;                authid
end;                    current_user


  Emp                 Emp                Emp
Mock objects

To compile code you still need the structure of the
objects.
Mock objects




begin                                                                                          begin
  x.foo;                                                                                         x.foo;
                                                  package x
end;                                                                                           end;
                                        Execute   authid                          Execute
                                                  current_user
Col1      Col2      Col3      Col4
                                                                                            Col1      Col2      Col3      Col4
A.val1    A.val2    A.val3    A.val4
                                                                                            B.val1    B.val2    B.val3    B.val4
A.val5    A.val6    A.val7    A.val8
                                                                                            B.val5    B.val6    B.val7    B.val8
A.val9    A.val10   A.val11   A.val12
                                                                                            B.val9    B.val10   B.val11   B.val12
A.val13   A.val14   A.val15   A.val16
                                                                                            B.val13   B.val14   B.val15   B.val16



                                                     Col1`   Col2   Col3   Col4
Definer Rights

 Use a single codebase for multiple users
 (a bit of) Protection from SQL Injection
Single codebase


User1                         User2


             App




               Mock objects
Single codebase


User1                 User2


                App

         Code
Single codebase


User1              User2


             App
Single codebase
Application code in a central schema (with mock objects)

   User1                                       User2


                          App
Single codebase
Each user has it’s own set of tables, views and sequences

   User1                                        User2


                          App
Single codebase
    Columns can be different in each schema

User1                                     User2


                     App
Advantages

 One time development
 Specific code in user schema
 (partial) Protection from
  SQL Injection
Drawbacks

 Debugging can be hard
 Support can be hard
SQL Injection

 Dynamic SQL
  Modification (drop) of objects
             You cannot drop what is not there
  Modification of records
             Will only affect current users data



 You should always use binding
  instead of concatenating in
  Dynamic SQL Statements
Rules and Restrictions

AUTHID DEFINER                           Definer Rights Model
 Uses directly granted
 privileges
 Default, so no need to change current code
AUTHID CURRENT_USER                      Invoker Rights Model
 Uses ROLEs
 On entire objects
 Need for ‘mock’ objects
 (at compile time it’s Definer Rights)
AMIS definer invoker rights

More Related Content

What's hot

Java Bytecode Fundamentals - JUG.lv
Java Bytecode Fundamentals - JUG.lvJava Bytecode Fundamentals - JUG.lv
Java Bytecode Fundamentals - JUG.lv
Anton Arhipov
 
Clojure Interoperability
Clojure InteroperabilityClojure Interoperability
Clojure Interoperability
rik0
 
Phpをいじり倒す10の方法
Phpをいじり倒す10の方法Phpをいじり倒す10の方法
Phpをいじり倒す10の方法
Moriyoshi Koizumi
 
Final project powerpoint template (fndprg) (1)
Final project powerpoint template (fndprg) (1)Final project powerpoint template (fndprg) (1)
Final project powerpoint template (fndprg) (1)
heoff
 
Java if and else
Java if and elseJava if and else
Java if and else
pratik8897
 
Smart Pointer in C++
Smart Pointer in C++Smart Pointer in C++
Smart Pointer in C++
永泉 韩
 

What's hot (20)

Grand Central Dispatch
Grand Central DispatchGrand Central Dispatch
Grand Central Dispatch
 
Sdl Basic
Sdl BasicSdl Basic
Sdl Basic
 
Java Bytecode Fundamentals - JUG.lv
Java Bytecode Fundamentals - JUG.lvJava Bytecode Fundamentals - JUG.lv
Java Bytecode Fundamentals - JUG.lv
 
Android JNI
Android JNIAndroid JNI
Android JNI
 
Introduction to Swift
Introduction to SwiftIntroduction to Swift
Introduction to Swift
 
Clojure Interoperability
Clojure InteroperabilityClojure Interoperability
Clojure Interoperability
 
Phpをいじり倒す10の方法
Phpをいじり倒す10の方法Phpをいじり倒す10の方法
Phpをいじり倒す10の方法
 
Final project powerpoint template (fndprg) (1)
Final project powerpoint template (fndprg) (1)Final project powerpoint template (fndprg) (1)
Final project powerpoint template (fndprg) (1)
 
What lies beneath the beautiful code?
What lies beneath the beautiful code?What lies beneath the beautiful code?
What lies beneath the beautiful code?
 
Mirah Talk for Boulder Ruby Group
Mirah Talk for Boulder Ruby GroupMirah Talk for Boulder Ruby Group
Mirah Talk for Boulder Ruby Group
 
Lifting variability from C to mbeddr-C
Lifting variability from C to mbeddr-CLifting variability from C to mbeddr-C
Lifting variability from C to mbeddr-C
 
Java if and else
Java if and elseJava if and else
Java if and else
 
C++11 talk
C++11 talkC++11 talk
C++11 talk
 
Ruby Internals
Ruby InternalsRuby Internals
Ruby Internals
 
Switch case and looping jam
Switch case and looping jamSwitch case and looping jam
Switch case and looping jam
 
From dot net_to_rails
From dot net_to_railsFrom dot net_to_rails
From dot net_to_rails
 
Smart Pointer in C++
Smart Pointer in C++Smart Pointer in C++
Smart Pointer in C++
 
PHP 8: Process & Fixing Insanity
PHP 8: Process & Fixing InsanityPHP 8: Process & Fixing Insanity
PHP 8: Process & Fixing Insanity
 
Javascript basics
Javascript basicsJavascript basics
Javascript basics
 
Python idiomatico
Python idiomaticoPython idiomatico
Python idiomatico
 

Viewers also liked

Viewers also liked (6)

SOA_BPM_12c_launch_event_SOA_track_Servicebus12c_newfeatures_lucas_jellema
SOA_BPM_12c_launch_event_SOA_track_Servicebus12c_newfeatures_lucas_jellemaSOA_BPM_12c_launch_event_SOA_track_Servicebus12c_newfeatures_lucas_jellema
SOA_BPM_12c_launch_event_SOA_track_Servicebus12c_newfeatures_lucas_jellema
 
AMIS Oracle OpenWorld 2013 Review Part 2 - Platform Middleware Publication
AMIS Oracle OpenWorld 2013 Review Part 2 - Platform Middleware PublicationAMIS Oracle OpenWorld 2013 Review Part 2 - Platform Middleware Publication
AMIS Oracle OpenWorld 2013 Review Part 2 - Platform Middleware Publication
 
An AMIS overview of database 12c
An AMIS overview of database 12cAn AMIS overview of database 12c
An AMIS overview of database 12c
 
ADF Mobile: 10 Things you don't get from the developers guide - Luc Bors
ADF Mobile: 10 Things you don't get from the developers guide - Luc BorsADF Mobile: 10 Things you don't get from the developers guide - Luc Bors
ADF Mobile: 10 Things you don't get from the developers guide - Luc Bors
 
Should Invoker Rights be used?
Should Invoker Rights be used?Should Invoker Rights be used?
Should Invoker Rights be used?
 
Extensibility in the cloud – power to the business user
Extensibility in the cloud – power to the business userExtensibility in the cloud – power to the business user
Extensibility in the cloud – power to the business user
 

Similar to AMIS definer invoker rights

Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Christian Schneider
 
A Practical Look at SystemVerilog Coverage
A Practical Look at SystemVerilog CoverageA Practical Look at SystemVerilog Coverage
A Practical Look at SystemVerilog Coverage
DVClub
 
OpenERP Technical Memento
OpenERP Technical MementoOpenERP Technical Memento
OpenERP Technical Memento
Odoo
 
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Paul King
 
Lec 4 06_aug [compatibility mode]
Lec 4 06_aug [compatibility mode]Lec 4 06_aug [compatibility mode]
Lec 4 06_aug [compatibility mode]
Palak Sanghani
 
Qtp training session IV
Qtp training session IVQtp training session IV
Qtp training session IV
Aisha Mazhar
 
Javascriptinobject orientedway-090512225827-phpapp02
Javascriptinobject orientedway-090512225827-phpapp02Javascriptinobject orientedway-090512225827-phpapp02
Javascriptinobject orientedway-090512225827-phpapp02
Sopheak Sem
 

Similar to AMIS definer invoker rights (20)

iPhone Seminar Part 2
iPhone Seminar Part 2iPhone Seminar Part 2
iPhone Seminar Part 2
 
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
 
AngularJS Scopes
AngularJS ScopesAngularJS Scopes
AngularJS Scopes
 
Doulos coverage-tips-tricks
Doulos coverage-tips-tricksDoulos coverage-tips-tricks
Doulos coverage-tips-tricks
 
A Practical Look at SystemVerilog Coverage
A Practical Look at SystemVerilog CoverageA Practical Look at SystemVerilog Coverage
A Practical Look at SystemVerilog Coverage
 
Rogue bundles
Rogue bundlesRogue bundles
Rogue bundles
 
The Veil-Framework
The Veil-FrameworkThe Veil-Framework
The Veil-Framework
 
OpenERP Technical Memento
OpenERP Technical MementoOpenERP Technical Memento
OpenERP Technical Memento
 
Acceleo Code Generation
Acceleo Code GenerationAcceleo Code Generation
Acceleo Code Generation
 
React native
React nativeReact native
React native
 
Clojure Fundamentals Course For Beginners
Clojure Fundamentals Course For Beginners Clojure Fundamentals Course For Beginners
Clojure Fundamentals Course For Beginners
 
Xtext Webinar
Xtext WebinarXtext Webinar
Xtext Webinar
 
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
 
Lec 4 06_aug [compatibility mode]
Lec 4 06_aug [compatibility mode]Lec 4 06_aug [compatibility mode]
Lec 4 06_aug [compatibility mode]
 
Xtext Webinar
Xtext WebinarXtext Webinar
Xtext Webinar
 
College Project - Java Disassembler - Description
College Project - Java Disassembler - DescriptionCollege Project - Java Disassembler - Description
College Project - Java Disassembler - Description
 
Qtp training session IV
Qtp training session IVQtp training session IV
Qtp training session IV
 
Anatomy of a Buffer Overflow Attack
Anatomy of a Buffer Overflow AttackAnatomy of a Buffer Overflow Attack
Anatomy of a Buffer Overflow Attack
 
How to Reverse Engineer Web Applications
How to Reverse Engineer Web ApplicationsHow to Reverse Engineer Web Applications
How to Reverse Engineer Web Applications
 
Javascriptinobject orientedway-090512225827-phpapp02
Javascriptinobject orientedway-090512225827-phpapp02Javascriptinobject orientedway-090512225827-phpapp02
Javascriptinobject orientedway-090512225827-phpapp02
 

More from Getting value from IoT, Integration and Data Analytics

More from Getting value from IoT, Integration and Data Analytics (20)

AMIS Oracle OpenWorld en Code One Review 2018 - Blockchain, Integration, Serv...
AMIS Oracle OpenWorld en Code One Review 2018 - Blockchain, Integration, Serv...AMIS Oracle OpenWorld en Code One Review 2018 - Blockchain, Integration, Serv...
AMIS Oracle OpenWorld en Code One Review 2018 - Blockchain, Integration, Serv...
 
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: Custom Application ...
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: Custom Application ...AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: Custom Application ...
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: Custom Application ...
 
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: SaaS
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: SaaSAMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: SaaS
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: SaaS
 
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Data
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: DataAMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Data
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Data
 
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Cloud Infrastructure
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Cloud Infrastructure AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Cloud Infrastructure
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Cloud Infrastructure
 
10 tips voor verbetering in je Linkedin profiel
10 tips voor verbetering in je Linkedin profiel10 tips voor verbetering in je Linkedin profiel
10 tips voor verbetering in je Linkedin profiel
 
Iot in de zorg the next step - fit for purpose
Iot in de zorg   the next step - fit for purpose Iot in de zorg   the next step - fit for purpose
Iot in de zorg the next step - fit for purpose
 
Iot overview .. Best practices and lessons learned by Conclusion Conenct
Iot overview .. Best practices and lessons learned by Conclusion Conenct Iot overview .. Best practices and lessons learned by Conclusion Conenct
Iot overview .. Best practices and lessons learned by Conclusion Conenct
 
IoT Fit for purpose - how to be successful in IOT Conclusion Connect
IoT Fit for purpose - how to be successful in IOT Conclusion Connect IoT Fit for purpose - how to be successful in IOT Conclusion Connect
IoT Fit for purpose - how to be successful in IOT Conclusion Connect
 
Industry and IOT Overview of protocols and best practices Conclusion Connect
Industry and IOT Overview of protocols and best practices  Conclusion ConnectIndustry and IOT Overview of protocols and best practices  Conclusion Connect
Industry and IOT Overview of protocols and best practices Conclusion Connect
 
IoT practical case using the people counter sensing traffic density build usi...
IoT practical case using the people counter sensing traffic density build usi...IoT practical case using the people counter sensing traffic density build usi...
IoT practical case using the people counter sensing traffic density build usi...
 
R introduction decision_trees
R introduction decision_treesR introduction decision_trees
R introduction decision_trees
 
Introduction overviewmachinelearning sig Door Lucas Jellema
Introduction overviewmachinelearning sig Door Lucas JellemaIntroduction overviewmachinelearning sig Door Lucas Jellema
Introduction overviewmachinelearning sig Door Lucas Jellema
 
IoT and the Future of work
IoT and the Future of work IoT and the Future of work
IoT and the Future of work
 
Oracle OpenWorld 2017 Review (31st October 2017 - 250 slides)
Oracle OpenWorld 2017 Review (31st October 2017 - 250 slides)Oracle OpenWorld 2017 Review (31st October 2017 - 250 slides)
Oracle OpenWorld 2017 Review (31st October 2017 - 250 slides)
 
Ethereum smart contracts - door Peter Reitsma
Ethereum smart contracts - door Peter ReitsmaEthereum smart contracts - door Peter Reitsma
Ethereum smart contracts - door Peter Reitsma
 
Blockchain - Techniek en usecases door Robert van Molken - AMIS - Conclusion
Blockchain - Techniek en usecases door Robert van Molken - AMIS - ConclusionBlockchain - Techniek en usecases door Robert van Molken - AMIS - Conclusion
Blockchain - Techniek en usecases door Robert van Molken - AMIS - Conclusion
 
kennissessie blockchain - Wat is Blockchain en smart contracts @Conclusion
kennissessie blockchain -  Wat is Blockchain en smart contracts @Conclusion kennissessie blockchain -  Wat is Blockchain en smart contracts @Conclusion
kennissessie blockchain - Wat is Blockchain en smart contracts @Conclusion
 
Internet of Things propositie - Enterprise IOT - AMIS - Conclusion
Internet of Things propositie - Enterprise IOT - AMIS - Conclusion Internet of Things propositie - Enterprise IOT - AMIS - Conclusion
Internet of Things propositie - Enterprise IOT - AMIS - Conclusion
 
Omc AMIS evenement 26012017 Dennis van Soest
Omc AMIS evenement 26012017 Dennis van SoestOmc AMIS evenement 26012017 Dennis van Soest
Omc AMIS evenement 26012017 Dennis van Soest
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

AMIS definer invoker rights

  • 1. Developers Toolbox – Coding Should invoker rights be used? Patrick Barel , AMIS, The Netherlands Monday, June 25, 2012 ODTUG KScope 12 San Antonio, Texas, USA
  • 2.
  • 3. Definer Rights vs Invoker Rights  Prior to Oracle8i, whenever you executed a stored program, it ran under the privileges of the account in which the program was defined.  This is called the … Definer Rights Model  With Oracle8i, you can now decide at compilation time whether your program or package will execute in the definer's schema (the default) or the schema of the invoker of the code.  This is called the … Invoker Rights Model
  • 4. Definer Rights Patrick Mitchell Code Invoke R e f Relations Relations
  • 5. Invoker Rights Patrick Mitchell Code Invoke Relations Relations
  • 6. Invoker Rights  Allows you to centralize access to and control of underlying data structures.  Uses roles and doesn’t rely on directly-granted privileges.  But it can be a source of confusion and architectural problems. Note: Oracle built-in packages have long had the capability of running under the invoker's authority.
  • 7. What’s wrong with Definer Rights  Deployment & maintenance  Must install module in all schemas where needed  In some databases, each user has own copy of table(s), requiring copy of stored module  Security  No declarative way to restrict privileges on certain modules in a package -- it's all or nothing, unless you write code in the package to essentially recreate roles programmatically.  Difficult to audit privileges  Sure would be nice to have a choice...and now you do!
  • 8. Invoker Rights  For top level modules: CREATE [ OR REPLACE ] <module type> [ AUTHID { DEFINER | CURRENT_USER } ] AS ...  For modules with separate spec and body, AUTHID goes only in spec, and must be at the package level.  Holds true for packages and object types.
  • 9. Overview of Definer Rights begin package y x.foo; authid package x definer end; authid definer package z authid definer Emp Emp Emp
  • 10. Overview of Invoker Rights begin package y x.foo; authid package x definer end; authid current_user package z authid current_user Emp Emp Emp
  • 11. Overview of Invoker Rights begin x.foo; end; package y Emp authid package x definer authid current_user begin package z x.foo; authid end; current_user Emp Emp Emp
  • 12. Mock objects To compile code you still need the structure of the objects.
  • 13. Mock objects begin begin x.foo; x.foo; package x end; end; Execute authid Execute current_user Col1 Col2 Col3 Col4 Col1 Col2 Col3 Col4 A.val1 A.val2 A.val3 A.val4 B.val1 B.val2 B.val3 B.val4 A.val5 A.val6 A.val7 A.val8 B.val5 B.val6 B.val7 B.val8 A.val9 A.val10 A.val11 A.val12 B.val9 B.val10 B.val11 B.val12 A.val13 A.val14 A.val15 A.val16 B.val13 B.val14 B.val15 B.val16 Col1` Col2 Col3 Col4
  • 14.
  • 15. Definer Rights  Use a single codebase for multiple users  (a bit of) Protection from SQL Injection
  • 16. Single codebase User1 User2 App Mock objects
  • 17. Single codebase User1 User2 App Code
  • 19. Single codebase Application code in a central schema (with mock objects) User1 User2 App
  • 20. Single codebase Each user has it’s own set of tables, views and sequences User1 User2 App
  • 21. Single codebase Columns can be different in each schema User1 User2 App
  • 22. Advantages  One time development  Specific code in user schema  (partial) Protection from SQL Injection
  • 23. Drawbacks  Debugging can be hard  Support can be hard
  • 24. SQL Injection  Dynamic SQL  Modification (drop) of objects You cannot drop what is not there  Modification of records Will only affect current users data  You should always use binding instead of concatenating in Dynamic SQL Statements
  • 25. Rules and Restrictions AUTHID DEFINER Definer Rights Model Uses directly granted privileges Default, so no need to change current code AUTHID CURRENT_USER Invoker Rights Model Uses ROLEs On entire objects Need for ‘mock’ objects (at compile time it’s Definer Rights)